aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLShaderBuilder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/GrGLShaderBuilder.h')
-rw-r--r--src/gpu/gl/GrGLShaderBuilder.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
index f143af39a7..aa88cf2b15 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -129,7 +129,7 @@ public:
the generated shader code. This potentially allows greater reuse of cached shaders. */
static const GrGLenum* GetTexParamSwizzle(GrPixelConfig config, const GrGLCaps& caps);
- /** Add a uniform variable to the current program, that has visibilty in one or more shaders.
+ /** Add a uniform variable to the current program, that has visibility in one or more shaders.
visibility is a bitfield of ShaderType values indicating from which shaders the uniform
should be accessible. At least one bit must be set. Geometry shader uniforms are not
supported at this time. The actual uniform name will be mangled. If outName is not NULL then
@@ -151,7 +151,7 @@ public:
const GrGLShaderVar& getUniformVariable(GrGLUniformManager::UniformHandle) const;
/**
- * Shorcut for getUniformVariable(u).c_str()
+ * Shortcut for getUniformVariable(u).c_str()
*/
const char* getUniformCStr(GrGLUniformManager::UniformHandle u) const {
return this->getUniformVariable(u).c_str();
@@ -165,6 +165,10 @@ public:
const char** vsOutName = NULL,
const char** fsInName = NULL);
+ /** Returns a variable name that represents the position of the fragment in the FS. The position
+ is in device space (e.g. 0,0 is the top left and pixel centers are at half-integers). */
+ const char* fragmentPosition();
+
/** Called after building is complete to get the final shader string. */
void getShader(ShaderType, SkString*) const;
@@ -180,6 +184,8 @@ public:
void setCurrentStage(int stage) { fCurrentStage = stage; }
void setNonStage() { fCurrentStage = kNonStageIdx; }
+ GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHeightUniform; }
+
private:
typedef GrTAllocator<GrGLShaderVar> VarArray;
@@ -211,10 +217,14 @@ private:
kNonStageIdx = -1,
};
- const GrGLContextInfo& fContext;
- GrGLUniformManager& fUniformManager;
- int fCurrentStage;
- SkString fFSFunctions;
+ const GrGLContextInfo& fContext;
+ GrGLUniformManager& fUniformManager;
+ int fCurrentStage;
+ SkString fFSFunctions;
+ SkString fFSHeader;
+
+ bool fSetupFragPosition;
+ GrGLUniformManager::UniformHandle fRTHeightUniform;
/// Per-stage settings - only valid while we're inside GrGLProgram::genStageCode().
//@{