Rename sampleVariablesSupport() to sampleMaskSupport()
We have only implemented support for the sample mask. This CL renames the cap to reflect that. It also replaces sampleVariablesStencilSupport() with the more aptly named canOnlyUseSampleMaskWithStencil(), to make it more clear that this is a driver workaround. Change-Id: Ibf54092c63181232fb3b94cad7ddb16e3a15e3d1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251580 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
a9ac8a51fd
commit
8a64a44244
@ -262,8 +262,8 @@ DrawResult SampleLocationsGM::onDraw(
|
||||
*errorMsg = "Requires support for sample locations.";
|
||||
return DrawResult::kSkip;
|
||||
}
|
||||
if (!ctx->priv().caps()->shaderCaps()->sampleVariablesSupport()) {
|
||||
*errorMsg = "Requires support for sample variables.";
|
||||
if (!ctx->priv().caps()->shaderCaps()->sampleMaskSupport()) {
|
||||
*errorMsg = "Requires support for sample mask.";
|
||||
return DrawResult::kSkip;
|
||||
}
|
||||
if (rtc->numSamples() <= 1 && !ctx->priv().caps()->mixedSamplesSupport()) {
|
||||
|
@ -43,11 +43,11 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) {
|
||||
fRemovePowWithConstantExponent = false;
|
||||
fMustWriteToFragColor = false;
|
||||
fNoDefaultPrecisionForExternalSamplers = false;
|
||||
fCanOnlyUseSampleMaskWithStencil = false;
|
||||
fFlatInterpolationSupport = false;
|
||||
fPreferFlatInterpolation = false;
|
||||
fNoPerspectiveInterpolationSupport = false;
|
||||
fSampleVariablesSupport = false;
|
||||
fSampleVariablesStencilSupport = false;
|
||||
fSampleMaskSupport = false;
|
||||
fExternalTextureSupport = false;
|
||||
fVertexIDSupport = false;
|
||||
fFPManipulationSupport = false;
|
||||
@ -120,12 +120,11 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
|
||||
writer->appendBool("Must write to sk_FragColor [workaround]", fMustWriteToFragColor);
|
||||
writer->appendBool("Don't add default precision statement for samplerExternalOES",
|
||||
fNoDefaultPrecisionForExternalSamplers);
|
||||
writer->appendBool("Can only use sample mask with stencil", fCanOnlyUseSampleMaskWithStencil);
|
||||
writer->appendBool("Flat interpolation support", fFlatInterpolationSupport);
|
||||
writer->appendBool("Prefer flat interpolation", fPreferFlatInterpolation);
|
||||
writer->appendBool("No perspective interpolation support", fNoPerspectiveInterpolationSupport);
|
||||
writer->appendBool("Sample variables support", fSampleVariablesSupport);
|
||||
writer->appendBool("Sample variables stencil support [workaround]",
|
||||
fSampleVariablesStencilSupport);
|
||||
writer->appendBool("Sample mask support", fSampleMaskSupport);
|
||||
writer->appendBool("External texture support", fExternalTextureSupport);
|
||||
writer->appendBool("sk_VertexID support", fVertexIDSupport);
|
||||
writer->appendBool("Floating point manipulation support", fFPManipulationSupport);
|
||||
|
@ -70,12 +70,7 @@ public:
|
||||
|
||||
bool noperspectiveInterpolationSupport() const { return fNoPerspectiveInterpolationSupport; }
|
||||
|
||||
// Can we use sample variables everywhere?
|
||||
bool sampleVariablesSupport() const { return fSampleVariablesSupport; }
|
||||
|
||||
// Can we use sample variables when rendering to stencil? (This is a workaround for platforms
|
||||
// where sample variables are broken in general, but seem to work when rendering to stencil.)
|
||||
bool sampleVariablesStencilSupport() const { return fSampleVariablesStencilSupport; }
|
||||
bool sampleMaskSupport() const { return fSampleMaskSupport; }
|
||||
|
||||
bool externalTextureSupport() const { return fExternalTextureSupport; }
|
||||
|
||||
@ -164,6 +159,11 @@ public:
|
||||
return fNoDefaultPrecisionForExternalSamplers;
|
||||
}
|
||||
|
||||
// The sample mask round rect op draws nothing on several Adreno and Radeon bots. Other ops that
|
||||
// use sample mask while rendering to stencil seem to work fine.
|
||||
// http://skbug.com/8921
|
||||
bool canOnlyUseSampleMaskWithStencil() const { return fCanOnlyUseSampleMaskWithStencil; }
|
||||
|
||||
// Returns the string of an extension that must be enabled in the shader to support
|
||||
// derivatives. If nullptr is returned then no extension needs to be enabled. Before calling
|
||||
// this function, the caller should check that shaderDerivativeSupport exists.
|
||||
@ -222,7 +222,7 @@ public:
|
||||
}
|
||||
|
||||
const char* sampleVariablesExtensionString() const {
|
||||
SkASSERT(this->sampleVariablesSupport() || this->sampleVariablesStencilSupport());
|
||||
SkASSERT(this->sampleMaskSupport());
|
||||
return fSampleVariablesExtensionString;
|
||||
}
|
||||
|
||||
@ -250,8 +250,7 @@ private:
|
||||
bool fFlatInterpolationSupport : 1;
|
||||
bool fPreferFlatInterpolation : 1;
|
||||
bool fNoPerspectiveInterpolationSupport : 1;
|
||||
bool fSampleVariablesSupport : 1;
|
||||
bool fSampleVariablesStencilSupport : 1;
|
||||
bool fSampleMaskSupport : 1;
|
||||
bool fExternalTextureSupport : 1;
|
||||
bool fVertexIDSupport : 1;
|
||||
bool fFPManipulationSupport : 1;
|
||||
@ -282,6 +281,7 @@ private:
|
||||
bool fRemovePowWithConstantExponent : 1;
|
||||
bool fMustWriteToFragColor : 1;
|
||||
bool fNoDefaultPrecisionForExternalSamplers : 1;
|
||||
bool fCanOnlyUseSampleMaskWithStencil : 1;
|
||||
|
||||
const char* fVersionDeclString;
|
||||
|
||||
|
@ -43,7 +43,7 @@ bool GrCoverageCountingPathRenderer::IsSupported(const GrCaps& caps, CoverageTyp
|
||||
if (!caps.driverBlacklistMSAACCPR() &&
|
||||
caps.internalMultisampleCount(defaultA8Format) > 1 &&
|
||||
caps.sampleLocationsSupport() &&
|
||||
shaderCaps.sampleVariablesStencilSupport()) {
|
||||
shaderCaps.sampleMaskSupport()) {
|
||||
if (coverageType) {
|
||||
*coverageType = CoverageType::kA8_Multisample;
|
||||
}
|
||||
|
@ -839,24 +839,15 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli
|
||||
} // Not sure for WebGL
|
||||
|
||||
if (GR_IS_GR_GL(standard)) {
|
||||
shaderCaps->fSampleVariablesSupport = ctxInfo.glslGeneration() >= k400_GrGLSLGeneration;
|
||||
shaderCaps->fSampleMaskSupport = ctxInfo.glslGeneration() >= k400_GrGLSLGeneration;
|
||||
} else if (GR_IS_GR_GL_ES(standard)) {
|
||||
if (ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) {
|
||||
shaderCaps->fSampleVariablesSupport = true;
|
||||
shaderCaps->fSampleMaskSupport = true;
|
||||
} else if (ctxInfo.hasExtension("GL_OES_sample_variables")) {
|
||||
shaderCaps->fSampleVariablesSupport = true;
|
||||
shaderCaps->fSampleMaskSupport = true;
|
||||
shaderCaps->fSampleVariablesExtensionString = "GL_OES_sample_variables";
|
||||
}
|
||||
}
|
||||
shaderCaps->fSampleVariablesStencilSupport = shaderCaps->fSampleVariablesSupport;
|
||||
|
||||
if (kQualcomm_GrGLVendor == ctxInfo.vendor() || kATI_GrGLVendor == ctxInfo.vendor()) {
|
||||
// FIXME: The sample mask round rect op draws nothing on several Adreno and Radeon bots.
|
||||
// Other ops that use sample mask while rendering to stencil seem to work fine. Temporarily
|
||||
// disable sample mask on color buffers while we investigate.
|
||||
// http://skbug.com/8921
|
||||
shaderCaps->fSampleVariablesSupport = false;
|
||||
}
|
||||
|
||||
shaderCaps->fVersionDeclString = get_glsl_version_decl_string(standard,
|
||||
shaderCaps->fGLSLGeneration,
|
||||
@ -3722,6 +3713,13 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
|
||||
if (kAdreno3xx_GrGLRenderer == ctxInfo.renderer()) {
|
||||
fTiledRenderingSupport = false;
|
||||
}
|
||||
|
||||
if (kQualcomm_GrGLVendor == ctxInfo.vendor() || kATI_GrGLVendor == ctxInfo.vendor()) {
|
||||
// The sample mask round rect op draws nothing on several Adreno and Radeon bots. Other ops
|
||||
// that use sample mask while rendering to stencil seem to work fine.
|
||||
// http://skbug.com/8921
|
||||
shaderCaps->fCanOnlyUseSampleMaskWithStencil = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
|
||||
@ -3736,6 +3734,7 @@ void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
|
||||
SkASSERT(!fDetachStencilFromMSAABuffersBeforeReadPixels);
|
||||
SkASSERT(!fDontSetBaseOrMaxLevelForExternalTextures);
|
||||
SkASSERT(!fNeverDisableColorWrites);
|
||||
SkASSERT(!fShaderCaps->fCanOnlyUseSampleMaskWithStencil);
|
||||
}
|
||||
if (options.fDoManualMipmapping) {
|
||||
fDoManualMipmapping = true;
|
||||
|
@ -94,7 +94,7 @@ const char* GrGLSLFragmentShaderBuilder::sampleOffsets() {
|
||||
void GrGLSLFragmentShaderBuilder::maskOffMultisampleCoverage(
|
||||
const char* mask, ScopeFlags scopeFlags) {
|
||||
const GrShaderCaps& shaderCaps = *fProgramBuilder->shaderCaps();
|
||||
if (!shaderCaps.sampleVariablesSupport() && !shaderCaps.sampleVariablesStencilSupport()) {
|
||||
if (!shaderCaps.sampleMaskSupport()) {
|
||||
SkDEBUGFAIL("Attempted to mask sample coverage without support.");
|
||||
return;
|
||||
}
|
||||
|
@ -34,8 +34,7 @@ public:
|
||||
fShaderCaps->fMaxFragmentSamplers = options.fMaxFragmentSamplers;
|
||||
fShaderCaps->fShaderDerivativeSupport = options.fShaderDerivativeSupport;
|
||||
fShaderCaps->fDualSourceBlendingSupport = options.fDualSourceBlendingSupport;
|
||||
fShaderCaps->fSampleVariablesSupport = true;
|
||||
fShaderCaps->fSampleVariablesStencilSupport = true;
|
||||
fShaderCaps->fSampleMaskSupport = true;
|
||||
|
||||
this->applyOptionsOverrides(contextOptions);
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ std::unique_ptr<GrFillRRectOp> GrFillRRectOp::Make(
|
||||
}
|
||||
} else {
|
||||
if (GrAAType::kMSAA == aaType) {
|
||||
if (!caps.sampleLocationsSupport() || !caps.shaderCaps()->sampleVariablesSupport()) {
|
||||
if (!caps.sampleLocationsSupport() || !caps.shaderCaps()->sampleMaskSupport() ||
|
||||
caps.shaderCaps()->canOnlyUseSampleMaskWithStencil()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -797,8 +797,7 @@ void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) {
|
||||
this->write(fProgram.fSettings.fFlipY ? "(!gl_FrontFacing)" : "gl_FrontFacing");
|
||||
break;
|
||||
case SK_SAMPLEMASK_BUILTIN:
|
||||
SkASSERT(fProgram.fSettings.fCaps->sampleVariablesSupport() ||
|
||||
fProgram.fSettings.fCaps->sampleVariablesStencilSupport());
|
||||
SkASSERT(fProgram.fSettings.fCaps->sampleMaskSupport());
|
||||
this->write("gl_SampleMask");
|
||||
break;
|
||||
case SK_VERTEXID_BUILTIN:
|
||||
|
@ -96,11 +96,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sampleVariablesSupport() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sampleVariablesStencilSupport() const {
|
||||
bool sampleMaskSupport() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -384,7 +380,7 @@ public:
|
||||
|
||||
static sk_sp<GrShaderCaps> SampleMaskSupport() {
|
||||
sk_sp<GrShaderCaps> result = Default();
|
||||
result->fSampleVariablesSupport = true;
|
||||
result->fSampleMaskSupport = true;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user