Make GrGLShaderBuilder produce the shader strings
Review URL: http://codereview.appspot.com/6356089/
git-svn-id: http://skia.googlecode.com/svn/trunk@4544 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
index bf308f3..5884a90 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -12,8 +12,7 @@
#include "gl/GrGLShaderVar.h"
#include "gl/GrGLSL.h"
-typedef GrTAllocator<GrGLShaderVar> VarArray;
-
+class GrGLContextInfo;
/**
Contains all the incremental state of a shader as it is being built,as well as helpers to
manipulate that state.
@@ -23,6 +22,7 @@
class GrGLShaderBuilder {
public:
+ typedef GrTAllocator<GrGLShaderVar> VarArray;
enum ShaderType {
kVertex_ShaderType = 0x1,
@@ -30,7 +30,7 @@
kFragment_ShaderType = 0x4,
};
- GrGLShaderBuilder();
+ GrGLShaderBuilder(const GrGLContextInfo&);
void computeSwizzle(uint32_t configFlags);
void computeModulate(const char* fsInColor);
@@ -56,7 +56,6 @@
void emitDefaultFetch(const char* outColor,
const char* samplerName);
-
/** Add a uniform variable to the current program, that has visibilty in one or more shaders.
If stageNum is specified, it is appended to the name to guarantee uniqueness; if count is
specified, the uniform is an array. visibility is a bitfield of ShaderType values indicating
@@ -86,6 +85,9 @@
const char** vsOutName = NULL,
const char** fsInName = NULL);
+ /** Called after building is complete to get the final shader string. */
+ void getShader(ShaderType, SkString*) const;
+
// TODO: Everything below here private.
SkString fHeader; // VS+FS, GLSL version, etc
@@ -122,6 +124,8 @@
//@}
+private:
+ const GrGLContextInfo& fContext;
};
#endif