| Index: src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
|
| diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
|
| index 1219d34b463fb21ba79848f2cc4fab65f08c16a9..7fc7db0aff5c63be9a782c06742e09fcea9d21ae 100644
|
| --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
|
| +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
|
| @@ -67,6 +67,23 @@ public:
|
| /** Appease the compiler; the derived class initializes GrGLSLFragmentBuilder. */
|
| GrGLSLFPFragmentBuilder() : GrGLSLFragmentBuilder(nullptr) {}
|
|
|
| + enum Coordinates {
|
| + kSkiaDevice_Coordinates,
|
| + kGLSLWindow_Coordinates,
|
| +
|
| + kLast_Coordinates = kGLSLWindow_Coordinates
|
| + };
|
| +
|
| + /**
|
| + * Appends the offset from the center of the pixel to a specified sample.
|
| + *
|
| + * @param sampleIdx GLSL expression of the sample index.
|
| + * @param Coordinates Coordinate space in which to emit the offset.
|
| + *
|
| + * A processor must call setWillUseSampleLocations in its constructor before using this method.
|
| + */
|
| + 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.
|
| @@ -137,14 +154,11 @@ public:
|
| */
|
| class GrGLSLFragmentShaderBuilder : public GrGLSLPPFragmentBuilder, public GrGLSLXPFragmentBuilder {
|
| public:
|
| - typedef uint8_t FragPosKey;
|
| -
|
| - /** Returns a key for reading the fragment location. This should only be called if there is an
|
| - effect that will requires the fragment position. If the fragment position is not required,
|
| - the key is 0. */
|
| - static FragPosKey KeyForFragmentPosition(const GrRenderTarget* dst);
|
| + /** 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. */
|
| + static uint8_t KeyForSurfaceOrigin(GrSurfaceOrigin);
|
|
|
| - GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program, uint8_t fragPosKey);
|
| + GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program);
|
|
|
| // Shared GrGLSLFragmentBuilder interface.
|
| bool enableFeature(GLSLFeature) override;
|
| @@ -153,6 +167,7 @@ public:
|
| const char* fragmentPosition() override;
|
|
|
| // 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; }
|
| @@ -166,8 +181,6 @@ public:
|
| void enableAdvancedBlendEquationIfNeeded(GrBlendEquation) override;
|
|
|
| private:
|
| - bool hasFragmentPosition() const;
|
| -
|
| // Private public interface, used by GrGLProgramBuilder to build a fragment shader
|
| void enableCustomOutput();
|
| void enableSecondaryOutput();
|
| @@ -188,19 +201,10 @@ private:
|
| static const char* DeclaredColorOutputName() { return "fsColorOut"; }
|
| static const char* DeclaredSecondaryColorOutputName() { return "fsSecondaryColorOut"; }
|
|
|
| - /*
|
| - * An internal call for GrGLProgramBuilder to use to add varyings to the vertex shader
|
| - */
|
| - void addVarying(GrGLSLVarying*, GrSLPrecision);
|
| + GrSurfaceOrigin getSurfaceOrigin() const;
|
|
|
| void onFinalize() override;
|
| -
|
| - // Interpretation of FragPosKey when generating code
|
| - enum {
|
| - kNoFragPosRead_FragPosKey = 0, // The fragment positition will not be needed.
|
| - kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to top-left.
|
| - kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to bottom-left.
|
| - };
|
| + void defineSampleOffsetArray(const char* name, const SkMatrix&);
|
|
|
| static const char* kDstTextureColorName;
|
|
|
| @@ -224,12 +228,12 @@ private:
|
| */
|
| SkString fMangleString;
|
|
|
| - bool fSetupFragPosition;
|
| - bool fTopLeftFragPosRead;
|
| - bool fHasCustomColorOutput;
|
| - int fCustomColorOutputIndex;
|
| - bool fHasSecondaryOutput;
|
| - bool fHasInitializedSampleMask;
|
| + bool fSetupFragPosition;
|
| + bool fHasCustomColorOutput;
|
| + int fCustomColorOutputIndex;
|
| + bool fHasSecondaryOutput;
|
| + uint8_t fUsedSampleOffsetArrays;
|
| + bool fHasInitializedSampleMask;
|
|
|
| #ifdef SK_DEBUG
|
| // some state to verify shaders and effects are consistent, this is reset between effects by
|
|
|