Index: src/gpu/glsl/GrGLSL.cpp |
diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp |
index c77b7fab20719f3042de5c9376948181ce665246..2de81ddd60efb85bbe1eefdf205454735910bbe0 100644 |
--- a/src/gpu/glsl/GrGLSL.cpp |
+++ b/src/gpu/glsl/GrGLSL.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "GrGLSL.h" |
+#include "GrGLSLCaps.h" |
#include "SkString.h" |
bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) { |
@@ -22,6 +23,26 @@ bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) { |
return false; |
} |
+void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision p, |
+ const GrGLSLCaps& glslCaps, |
+ SkString* out) { |
+ if (glslCaps.usesPrecisionModifiers()) { |
+ switch (p) { |
+ case kHigh_GrSLPrecision: |
+ out->append("precision highp float;\n"); |
+ break; |
+ case kMedium_GrSLPrecision: |
+ out->append("precision mediump float;\n"); |
+ break; |
+ case kLow_GrSLPrecision: |
+ out->append("precision lowp float;\n"); |
+ break; |
+ default: |
+ SkFAIL("Unknown precision value."); |
+ } |
+ } |
+} |
+ |
void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor) { |
if (mulFactor.isOnes()) { |
*outAppend = SkString(); |