Index: src/gpu/gl/GrGLShaderBuilder.h |
=================================================================== |
--- src/gpu/gl/GrGLShaderBuilder.h (revision 8392) |
+++ src/gpu/gl/GrGLShaderBuilder.h (working copy) |
@@ -84,6 +84,22 @@ |
GrGLShaderBuilder(const GrGLContextInfo&, GrGLUniformManager&, bool explicitLocalCoords); |
/** |
+ * 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) { |
@@ -269,7 +285,6 @@ |
// TODO: Everything below here private. |
public: |
- SkString fHeader; // VS+FS, GLSL version, etc |
VarArray fVSAttrs; |
VarArray fVSOutputs; |
VarArray fGSInputs; |
@@ -284,9 +299,22 @@ |
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); |
+ |
const GrGLContextInfo& fCtxInfo; |
GrGLUniformManager& fUniformManager; |
int fCurrentStageIdx; |
+ uint32_t fFSFeaturesAddedMask; |
SkString fFSFunctions; |
SkString fFSHeader; |