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

Side by Side Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp

Issue 1246773003: Possible fix for Moto E compilation failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix order (due to codePrependf) Created 5 years, 5 months 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 "GrGLFragmentShaderBuilder.h" 8 #include "GrGLFragmentShaderBuilder.h"
9 #include "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 fInputs.push_back().set(kVec4f_GrSLType, 153 fInputs.push_back().set(kVec4f_GrSLType,
154 GrGLShaderVar::kIn_TypeModifier, 154 GrGLShaderVar::kIn_TypeModifier,
155 "gl_FragCoord", 155 "gl_FragCoord",
156 kDefault_GrSLPrecision, 156 kDefault_GrSLPrecision,
157 GrGLShaderVar::kUpperLeft_Origin); 157 GrGLShaderVar::kUpperLeft_Origin);
158 fSetupFragPosition = true; 158 fSetupFragPosition = true;
159 } 159 }
160 return "gl_FragCoord"; 160 return "gl_FragCoord";
161 } else { 161 } else {
162 static const char* kTempName = "tmpXYFragCoord";
162 static const char* kCoordName = "fragCoordYDown"; 163 static const char* kCoordName = "fragCoordYDown";
163 if (!fSetupFragPosition) { 164 if (!fSetupFragPosition) {
164 // temporarily change the stage index because we're inserting non-st age code. 165 // temporarily change the stage index because we're inserting non-st age code.
165 GrGLProgramBuilder::AutoStageRestore asr(fProgramBuilder); 166 GrGLProgramBuilder::AutoStageRestore asr(fProgramBuilder);
166 SkASSERT(!fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); 167 SkASSERT(!fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
167 const char* rtHeightName; 168 const char* rtHeightName;
168 169
169 fProgramBuilder->fUniformHandles.fRTHeightUni = 170 fProgramBuilder->fUniformHandles.fRTHeightUni =
170 fProgramBuilder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility, 171 fProgramBuilder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility,
171 kFloat_GrSLType, 172 kFloat_GrSLType,
172 kDefault_GrSLPrecision, 173 kDefault_GrSLPrecision,
173 "RTHeight", 174 "RTHeight",
174 &rtHeightName); 175 &rtHeightName);
175 176
176 // Using glFragCoord.zw for the last two components tickles an Adren o driver bug that 177 // The Adreno compiler seems to be very touchy about access to "gl_F ragCoord".
177 // causes programs to fail to link. Making this function return a ve c2() didn't fix the 178 // Accessing glFragCoord.zw can cause a program to fail to link. Add itionally,
178 // problem but using 1.0 for the last two components does. 179 // depending on the surrounding code, accessing .xy with a uniform i nvolved can
179 this->codePrependf("\tvec4 %s = vec4(gl_FragCoord.x, %s - gl_FragCoo rd.y, 1.0, " 180 // do the same thing. Copying gl_FragCoord.xy into a temp vec2 befor ehand
180 "1.0);\n", kCoordName, rtHeightName); 181 // (and only accessing .xy) seems to "fix" things.
182 this->codePrependf("\tvec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n",
183 kCoordName, kTempName, rtHeightName, kTempName);
184 this->codePrependf("vec2 %s = gl_FragCoord.xy;", kTempName);
181 fSetupFragPosition = true; 185 fSetupFragPosition = true;
182 } 186 }
183 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); 187 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
184 return kCoordName; 188 return kCoordName;
185 } 189 }
186 } 190 }
187 191
188 const char* GrGLFragmentShaderBuilder::dstColor() { 192 const char* GrGLFragmentShaderBuilder::dstColor() {
189 fHasReadDstColor = true; 193 fHasReadDstColor = true;
190 194
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 278 }
275 } 279 }
276 280
277 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) { 281 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) {
278 v->fFsIn = v->fVsOut; 282 v->fFsIn = v->fVsOut;
279 if (v->fGsOut) { 283 if (v->fGsOut) {
280 v->fFsIn = v->fGsOut; 284 v->fFsIn = v->fGsOut;
281 } 285 }
282 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v- >fFsIn, fsPrec); 286 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v- >fFsIn, fsPrec);
283 } 287 }
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