diff options
author | egdaniel <egdaniel@google.com> | 2015-10-26 08:38:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-26 08:38:26 -0700 |
commit | cb7ba1eafce89a2f90239a7be56050fa98a47b9f (patch) | |
tree | eb332246d1e7ec586c5074c30b0714982f2879cf /src/gpu/glsl/GrGLSL.cpp | |
parent | 5c3ea4cd3921e8904d4f201bcdedfd5b8a726542 (diff) |
Make appending default precision be controled by GLSL
BUG=skia:
Review URL: https://codereview.chromium.org/1403373012
Diffstat (limited to 'src/gpu/glsl/GrGLSL.cpp')
-rw-r--r-- | src/gpu/glsl/GrGLSL.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp index c77b7fab20..2de81ddd60 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(); |