Drop unused shader support for sample variables
Bug: skia:
Change-Id: I9e2b7da8c916703027d8dd4303ae67f4e69bcf87
Reviewed-on: https://skia-review.googlesource.com/107356
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index 6de545b..92a0034 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -85,7 +85,6 @@
, fCustomColorOutputIndex(-1)
, fHasSecondaryOutput(false)
, fUsedSampleOffsetArrays(0)
- , fHasInitializedSampleMask(false)
, fForceHighPrecision(false) {
fSubstageIndices.push_back(0);
#ifdef SK_DEBUG
@@ -135,46 +134,6 @@
fUsedSampleOffsetArrays |= (1 << coords);
}
-void GrGLSLFragmentShaderBuilder::maskSampleCoverage(const char* mask, bool invert) {
- const GrShaderCaps& shaderCaps = *fProgramBuilder->shaderCaps();
- if (!shaderCaps.sampleVariablesSupport()) {
- SkDEBUGFAIL("Attempted to mask sample coverage without support.");
- return;
- }
- if (const char* extension = shaderCaps.sampleVariablesExtensionString()) {
- this->addFeature(1 << kSampleVariables_GLSLPrivateFeature, extension);
- }
- if (!fHasInitializedSampleMask) {
- this->codePrependf("gl_SampleMask[0] = -1;");
- fHasInitializedSampleMask = true;
- }
- if (invert) {
- this->codeAppendf("gl_SampleMask[0] &= ~(%s);", mask);
- } else {
- this->codeAppendf("gl_SampleMask[0] &= %s;", mask);
- }
-}
-
-void GrGLSLFragmentShaderBuilder::overrideSampleCoverage(const char* mask) {
- const GrShaderCaps& shaderCaps = *fProgramBuilder->shaderCaps();
- if (!shaderCaps.sampleMaskOverrideCoverageSupport()) {
- SkDEBUGFAIL("Attempted to override sample coverage without support.");
- return;
- }
- SkASSERT(shaderCaps.sampleVariablesSupport());
- if (const char* extension = shaderCaps.sampleVariablesExtensionString()) {
- this->addFeature(1 << kSampleVariables_GLSLPrivateFeature, extension);
- }
- if (this->addFeature(1 << kSampleMaskOverrideCoverage_GLSLPrivateFeature,
- "GL_NV_sample_mask_override_coverage")) {
- // Redeclare gl_SampleMask with layout(override_coverage) if we haven't already.
- fOutputs.push_back().set(kInt_GrSLType, "gl_SampleMask", 1, GrShaderVar::kOut_TypeModifier,
- kHigh_GrSLPrecision, "override_coverage");
- }
- this->codeAppendf("gl_SampleMask[0] = %s;", mask);
- fHasInitializedSampleMask = true;
-}
-
const char* GrGLSLFragmentShaderBuilder::dstColor() {
SkDEBUGCODE(fHasReadDstColor = true;)
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
index f124a44..a9e665b 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
@@ -79,17 +79,6 @@
virtual void appendOffsetToSample(const char* sampleIdx, Coordinates) = 0;
/**
- * Subtracts sample coverage from the fragment. Any sample whose corresponding bit is not found
- * in the mask will not be written out to the framebuffer.
- *
- * @param mask int that contains the sample mask. Bit N corresponds to the Nth sample.
- * @param invert perform a bit-wise NOT on the provided mask before applying it?
- *
- * Requires GLSL support for sample variables.
- */
- virtual void maskSampleCoverage(const char* mask, bool invert = false) = 0;
-
- /**
* Fragment procs with child procs should call these functions before/after calling emitCode
* on a child proc.
*/
@@ -102,29 +91,6 @@
};
/*
- * This class is used by primitive processors to build their fragment code.
- */
-class GrGLSLPPFragmentBuilder : public GrGLSLFPFragmentBuilder {
-public:
- /** Appease the compiler; the derived class initializes GrGLSLFragmentBuilder. */
- GrGLSLPPFragmentBuilder() : GrGLSLFragmentBuilder(nullptr) {}
-
- /**
- * Overrides the fragment's sample coverage. The provided mask determines which samples will now
- * be written out to the framebuffer. Note that this mask can be reduced by a future call to
- * maskSampleCoverage.
- *
- * If a primitive processor uses this method, it must guarantee that every codepath through the
- * shader overrides the sample mask at some point.
- *
- * @param mask int that contains the new coverage mask. Bit N corresponds to the Nth sample.
- *
- * Requires NV_sample_mask_override_coverage.
- */
- virtual void overrideSampleCoverage(const char* mask) = 0;
-};
-
-/*
* This class is used by Xfer processors to build their fragment code.
*/
class GrGLSLXPFragmentBuilder : virtual public GrGLSLFragmentBuilder {
@@ -148,7 +114,7 @@
/*
* This class implements the various fragment builder interfaces.
*/
-class GrGLSLFragmentShaderBuilder : public GrGLSLPPFragmentBuilder, public GrGLSLXPFragmentBuilder {
+class GrGLSLFragmentShaderBuilder : public GrGLSLFPFragmentBuilder, public GrGLSLXPFragmentBuilder {
public:
/** Returns a nonzero key for a surface's origin. This should only be called if a processor will
use the fragment position and/or sample locations. */
@@ -162,8 +128,6 @@
// GrGLSLFPFragmentBuilder interface.
void appendOffsetToSample(const char* sampleIdx, Coordinates) override;
- void maskSampleCoverage(const char* mask, bool invert = false) override;
- void overrideSampleCoverage(const char* mask) override;
const SkString& getMangleString() const override { return fMangleString; }
void onBeforeChildProcEmitCode() override;
void onAfterChildProcEmitCode() override;
@@ -223,13 +187,12 @@
*/
SkString fMangleString;
- bool fSetupFragPosition;
- bool fHasCustomColorOutput;
- int fCustomColorOutputIndex;
- bool fHasSecondaryOutput;
- uint8_t fUsedSampleOffsetArrays;
- bool fHasInitializedSampleMask;
- bool fForceHighPrecision;
+ bool fSetupFragPosition;
+ bool fHasCustomColorOutput;
+ int fCustomColorOutputIndex;
+ bool fHasSecondaryOutput;
+ uint8_t fUsedSampleOffsetArrays;
+ bool fForceHighPrecision;
#ifdef SK_DEBUG
// some state to verify shaders and effects are consistent, this is reset between effects by
diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp b/src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp
index 02fa2e7..fb6e7f2 100644
--- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp
@@ -36,7 +36,7 @@
return combined;
}
-void GrGLSLPrimitiveProcessor::setupUniformColor(GrGLSLPPFragmentBuilder* fragBuilder,
+void GrGLSLPrimitiveProcessor::setupUniformColor(GrGLSLFPFragmentBuilder* fragBuilder,
GrGLSLUniformHandler* uniformHandler,
const char* outputName,
UniformHandle* colorUniform) {
diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
index 30ca143..613ae07 100644
--- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
+++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
@@ -14,7 +14,7 @@
#include "glsl/GrGLSLUniformHandler.h"
class GrPrimitiveProcessor;
-class GrGLSLPPFragmentBuilder;
+class GrGLSLFPFragmentBuilder;
class GrGLSLGeometryBuilder;
class GrGLSLGPBuilder;
class GrGLSLVaryingHandler;
@@ -67,7 +67,7 @@
struct EmitArgs {
EmitArgs(GrGLSLVertexBuilder* vertBuilder,
GrGLSLGeometryBuilder* geomBuilder,
- GrGLSLPPFragmentBuilder* fragBuilder,
+ GrGLSLFPFragmentBuilder* fragBuilder,
GrGLSLVaryingHandler* varyingHandler,
GrGLSLUniformHandler* uniformHandler,
const GrShaderCaps* caps,
@@ -93,7 +93,7 @@
, fFPCoordTransformHandler(transformHandler) {}
GrGLSLVertexBuilder* fVertBuilder;
GrGLSLGeometryBuilder* fGeomBuilder;
- GrGLSLPPFragmentBuilder* fFragBuilder;
+ GrGLSLFPFragmentBuilder* fFragBuilder;
GrGLSLVaryingHandler* fVaryingHandler;
GrGLSLUniformHandler* fUniformHandler;
const GrShaderCaps* fShaderCaps;
@@ -129,7 +129,7 @@
static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoordTransform&);
protected:
- void setupUniformColor(GrGLSLPPFragmentBuilder* fragBuilder,
+ void setupUniformColor(GrGLSLFPFragmentBuilder* fragBuilder,
GrGLSLUniformHandler* uniformHandler,
const char* outputName,
UniformHandle* colorUniform);
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h
index 0708625..8459218 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -173,9 +173,7 @@
kTexelBuffer_GLSLPrivateFeature,
kFramebufferFetch_GLSLPrivateFeature,
kNoPerspectiveInterpolation_GLSLPrivateFeature,
- kSampleVariables_GLSLPrivateFeature,
- kSampleMaskOverrideCoverage_GLSLPrivateFeature,
- kLastGLSLPrivateFeature = kSampleMaskOverrideCoverage_GLSLPrivateFeature
+ kLastGLSLPrivateFeature = kNoPerspectiveInterpolation_GLSLPrivateFeature
};
/*