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

Side by Side Diff: src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp

Issue 1523793002: Switch fragment coordinate to 'highp' to fix various broken GMs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLSLFragmentShaderBuilder.h" 8 #include "GrGLSLFragmentShaderBuilder.h"
9 #include "GrRenderTarget.h" 9 #include "GrRenderTarget.h"
10 #include "glsl/GrGLSL.h" 10 #include "glsl/GrGLSL.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (!fSetupFragPosition) { 139 if (!fSetupFragPosition) {
140 const char* rtHeightName; 140 const char* rtHeightName;
141 141
142 fProgramBuilder->addRTHeightUniform("RTHeight", &rtHeightName); 142 fProgramBuilder->addRTHeightUniform("RTHeight", &rtHeightName);
143 143
144 // The Adreno compiler seems to be very touchy about access to "gl_F ragCoord". 144 // The Adreno compiler seems to be very touchy about access to "gl_F ragCoord".
145 // Accessing glFragCoord.zw can cause a program to fail to link. Add itionally, 145 // Accessing glFragCoord.zw can cause a program to fail to link. Add itionally,
146 // depending on the surrounding code, accessing .xy with a uniform i nvolved can 146 // depending on the surrounding code, accessing .xy with a uniform i nvolved can
147 // do the same thing. Copying gl_FragCoord.xy into a temp vec2 befor ehand 147 // do the same thing. Copying gl_FragCoord.xy into a temp vec2 befor ehand
148 // (and only accessing .xy) seems to "fix" things. 148 // (and only accessing .xy) seems to "fix" things.
149 this->codePrependf("\tvec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n", 149 const char* precision = glslCaps->usesPrecisionModifiers() ? "highp " : "";
150 kCoordName, kTempName, rtHeightName, kTempName); 150 this->codePrependf("\t%svec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n ",
151 this->codePrependf("vec2 %s = gl_FragCoord.xy;", kTempName); 151 precision, kCoordName, kTempName, rtHeightName, k TempName);
152 this->codePrependf("%svec2 %s = gl_FragCoord.xy;", precision, kTempN ame);
152 fSetupFragPosition = true; 153 fSetupFragPosition = true;
153 } 154 }
154 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); 155 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
155 return kCoordName; 156 return kCoordName;
156 } 157 }
157 } 158 }
158 159
159 const char* GrGLSLFragmentShaderBuilder::dstColor() { 160 const char* GrGLSLFragmentShaderBuilder::dstColor() {
160 fHasReadDstColor = true; 161 fHasReadDstColor = true;
161 162
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 249 }
249 250
250 void GrGLSLFragmentBuilder::onAfterChildProcEmitCode() { 251 void GrGLSLFragmentBuilder::onAfterChildProcEmitCode() {
251 SkASSERT(fSubstageIndices.count() >= 2); 252 SkASSERT(fSubstageIndices.count() >= 2);
252 fSubstageIndices.pop_back(); 253 fSubstageIndices.pop_back();
253 fSubstageIndices.back()++; 254 fSubstageIndices.back()++;
254 int removeAt = fMangleString.findLastOf('_'); 255 int removeAt = fMangleString.findLastOf('_');
255 fMangleString.remove(removeAt, fMangleString.size() - removeAt); 256 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
256 } 257 }
257 258
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698