Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: src/gpu/gl/GrGLShaderBuilder.h

Issue 14633007: Key shader on whether frag pos read is relative to top-left or bottom-left (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698