Index: src/gpu/gl/GrGLShaderBuilder.h |
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h |
index 6e990aad01b17c56150221d47cda0b869a250545..b67846a621e05b5feb9e0cf26d2a1c64e78a42be 100644 |
--- a/src/gpu/gl/GrGLShaderBuilder.h |
+++ b/src/gpu/gl/GrGLShaderBuilder.h |
@@ -193,12 +193,18 @@ public: |
const GrGLCaps&); |
typedef uint8_t DstReadKey; |
+ typedef uint8_t FragPosKey; |
/** Returns a key for adding code to read the copy-of-dst color in service of effects that |
require reading the dst. It must not return 0 because 0 indicates that there is no dst |
- copy read at all. */ |
+ copy read at all (in which case this function should not be called). */ |
static DstReadKey KeyForDstRead(const GrTexture* dstCopy, const GrGLCaps&); |
+ /** 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, const GrGLCaps&); |
+ |
/** If texture swizzling is available using tex parameters then it is preferred over mangling |
the generated shader code. This potentially allows greater reuse of cached shaders. */ |
static const GrGLenum* GetTexParamSwizzle(GrPixelConfig config, const GrGLCaps& caps); |
@@ -424,6 +430,12 @@ private: |
kTopLeftOrigin_DstReadKeyBit = 0x4, // Set if dst-copy origin is top-left. |
}; |
+ 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. |
+ }; |
+ |
const GrGLContextInfo& fCtxInfo; |
GrGLUniformManager& fUniformManager; |
uint32_t fFSFeaturesAddedMask; |
@@ -443,6 +455,8 @@ private: |
GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform; |
GrGLUniformManager::UniformHandle fDstCopyScaleUniform; |
+ bool fTopLeftFragPosRead; |
+ |
SkSTArray<10, AttributePair, true> fEffectAttributes; |
GrGLShaderVar* fPositionVar; |