Add a workaround to allow sample variables for stencil draws

gl_SampleMask seems broken in general on Adreno and Radeon, but hasn't
proven to be an issue yet when rendering only to stencil.

Bug: skia:
Change-Id: I67c6b5bc2ecc3667381bd43f7bb3849c723490ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213051
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2019-05-13 17:59:54 -06:00 committed by Skia Commit-Bot
parent 209ebc015a
commit 69258ffdb8
3 changed files with 14 additions and 3 deletions

View File

@ -48,6 +48,7 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) {
fPreferFlatInterpolation = false;
fNoPerspectiveInterpolationSupport = false;
fSampleVariablesSupport = false;
fSampleVariablesStencilSupport = false;
fExternalTextureSupport = false;
fVertexIDSupport = false;
fFPManipulationSupport = false;
@ -123,6 +124,8 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
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("External texture support", fExternalTextureSupport);
writer->appendBool("sk_VertexID support", fVertexIDSupport);
writer->appendBool("Floating point manipulation support", fFPManipulationSupport);

View File

@ -73,8 +73,13 @@ 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 externalTextureSupport() const { return fExternalTextureSupport; }
bool vertexIDSupport() const { return fVertexIDSupport; }
@ -264,6 +269,7 @@ private:
bool fPreferFlatInterpolation : 1;
bool fNoPerspectiveInterpolationSupport : 1;
bool fSampleVariablesSupport : 1;
bool fSampleVariablesStencilSupport : 1;
bool fExternalTextureSupport : 1;
bool fVertexIDSupport : 1;
bool fFPManipulationSupport : 1;

View File

@ -831,11 +831,13 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli
shaderCaps->fSampleVariablesExtensionString = "GL_OES_sample_variables";
}
}
shaderCaps->fSampleVariablesStencilSupport = shaderCaps->fSampleVariablesSupport;
// FIXME: The sample mask round rect op draws nothing on several Adreno and Radeon bots.
// Temporarily disable while we investigate.
// http://skbug.com/8921
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;
}