diff options
author | 2015-12-14 11:37:55 -0800 | |
---|---|---|
committer | 2015-12-14 11:37:55 -0800 | |
commit | 1cbb5ea0a07255bcc0b8351ddf1fc84f50887aef (patch) | |
tree | e4ab731e7e71ce2f81a730e21b49c6bb8a840e7f /src/gpu | |
parent | 6f37b4a4757ea3eb00c76162cc37f8a56c3b8bdb (diff) |
Switch fragment coordinate to 'highp' to fix various broken GMs.
BUG=skia:4693
Review URL: https://codereview.chromium.org/1523793002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index 47708f370d..54e0b7f956 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -146,9 +146,10 @@ const char* GrGLSLFragmentShaderBuilder::fragmentPosition() { // depending on the surrounding code, accessing .xy with a uniform involved can // do the same thing. Copying gl_FragCoord.xy into a temp vec2 beforehand // (and only accessing .xy) seems to "fix" things. - this->codePrependf("\tvec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n", - kCoordName, kTempName, rtHeightName, kTempName); - this->codePrependf("vec2 %s = gl_FragCoord.xy;", kTempName); + const char* precision = glslCaps->usesPrecisionModifiers() ? "highp " : ""; + this->codePrependf("\t%svec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n", + precision, kCoordName, kTempName, rtHeightName, kTempName); + this->codePrependf("%svec2 %s = gl_FragCoord.xy;", precision, kTempName); fSetupFragPosition = true; } SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); |