Index: src/gpu/glsl/GrGLSLFragmentShaderBuilder.h |
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h |
index 1219d34b463fb21ba79848f2cc4fab65f08c16a9..bcf1f373d34b987972e5d6bf95bf82f0bac09d4c 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 { |
bsalomon
2016/03/01 14:28:55
Why do we need both of these?
Chris Dalton
2016/03/01 20:37:47
The short answer is that it makes life easier for
|
+ 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. |
@@ -153,6 +170,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,13 +184,12 @@ public: |
void enableAdvancedBlendEquationIfNeeded(GrBlendEquation) override; |
private: |
- bool hasFragmentPosition() const; |
- |
// Private public interface, used by GrGLProgramBuilder to build a fragment shader |
void enableCustomOutput(); |
void enableSecondaryOutput(); |
const char* getPrimaryColorOutputName() const; |
const char* getSecondaryColorOutputName() const; |
+ void defineSampleOffsetArray(const char* name, const SkMatrix&); |
#ifdef SK_DEBUG |
// As GLSLProcessors emit code, there are some conditions we need to verify. We use the below |
@@ -224,12 +241,13 @@ private: |
*/ |
SkString fMangleString; |
- bool fSetupFragPosition; |
- bool fTopLeftFragPosRead; |
- bool fHasCustomColorOutput; |
- int fCustomColorOutputIndex; |
- bool fHasSecondaryOutput; |
- bool fHasInitializedSampleMask; |
+ bool fSetupFragPosition; |
+ bool fTopLeftFragPosRead; |
+ 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 |