Index: src/gpu/gl/GrGLShaderBuilder.h |
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h |
index 765a2edf8dbdbbe312e364136274ddcad332fe6d..e379ae10fc0d73f0e4c800091b9c41f26bd7093c 100644 |
--- a/src/gpu/gl/GrGLShaderBuilder.h |
+++ b/src/gpu/gl/GrGLShaderBuilder.h |
@@ -193,12 +193,16 @@ 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. */ |
static DstReadKey KeyForDstRead(const GrTexture* dstCopy, const GrGLCaps&); |
+ /** Returns a key for reading the fragment location. */ |
+ 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 +428,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 +453,8 @@ private: |
GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform; |
GrGLUniformManager::UniformHandle fDstCopyScaleUniform; |
+ bool fTopLeftFragPosRead; |
+ |
SkSTArray<10, AttributePair, true> fEffectAttributes; |
GrGLShaderVar* fPositionVar; |