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

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

Issue 12668019: Make GrGLShaderBuilder responsible for enabling GLSL extensions (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync to TOT Created 7 years, 9 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/GrGLSL.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
===================================================================
--- src/gpu/gl/GrGLShaderBuilder.h (revision 8458)
+++ src/gpu/gl/GrGLShaderBuilder.h (working copy)
@@ -107,6 +107,22 @@
GrGLShaderBuilder(const GrGLContextInfo&, GrGLUniformManager&, const GrGLProgramDesc&);
/**
+ * Use of these features may require a GLSL extension to be enabled. Shaders may not compile
+ * if code is added that uses one of these features without calling enableFeature()
+ */
+ enum GLSLFeature {
+ kStandardDerivatives_GLSLFeature = 0,
+
+ kLastGLSLFeature = kStandardDerivatives_GLSLFeature
+ };
+
+ /**
+ * If the feature is supported then true is returned and any necessary #extension declarations
+ * are added to the shaders. If the feature is not supported then false will be returned.
+ */
+ bool enableFeature(GLSLFeature);
+
+ /**
* Called by GrGLEffects to add code to one of the shaders.
*/
void vsCodeAppendf(const char format[], ...) SK_PRINTF_LIKE(2, 3) {
@@ -313,7 +329,6 @@
// TODO: Everything below here private.
public:
- SkString fHeader; // VS+FS, GLSL version, etc
VarArray fVSAttrs;
VarArray fVSOutputs;
VarArray fGSInputs;
@@ -327,6 +342,18 @@
kNonStageIdx = -1,
};
+ /**
+ * Features that should only be enabled by GrGLShaderBuilder itself.
+ */
+ enum GLSLPrivateFeature {
+ kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1
+ };
+ bool enablePrivateFeature(GLSLPrivateFeature);
+
+ // If we ever have VS/GS features we can expand this to take a bitmask of ShaderType and track
+ // the enables separately for each shader.
+ void addFSFeature(uint32_t featureBit, const char* extensionName);
+
// Interpretation of DstReadKey when generating code
enum {
kNoDstRead_DstReadKey = 0,
@@ -338,6 +365,7 @@
const GrGLContextInfo& fCtxInfo;
GrGLUniformManager& fUniformManager;
int fCurrentStageIdx;
+ uint32_t fFSFeaturesAddedMask;
SkString fFSFunctions;
SkString fFSHeader;
« no previous file with comments | « src/gpu/gl/GrGLSL.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698