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

Side by Side Diff: src/effects/gradients/SkSweepGradient.cpp

Issue 2413363002: added SkSL support for mustForceNegatedAtanParamToFloat cap (Closed)
Patch Set: updated comment again Created 4 years, 2 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 | src/gpu/gl/builders/GrGLShaderStringBuilder.cpp » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkSweepGradient.h" 8 #include "SkSweepGradient.h"
9 9
10 static SkMatrix translate(SkScalar dx, SkScalar dy) { 10 static SkMatrix translate(SkScalar dx, SkScalar dy) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 ///////////////////////////////////////////////////////////////////// 205 /////////////////////////////////////////////////////////////////////
206 206
207 void GrSweepGradient::GLSLSweepProcessor::emitCode(EmitArgs& args) { 207 void GrSweepGradient::GLSLSweepProcessor::emitCode(EmitArgs& args) {
208 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); 208 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>();
209 this->emitUniforms(args.fUniformHandler, ge); 209 this->emitUniforms(args.fUniformHandler, ge);
210 SkString coords2D = args.fFragBuilder->ensureCoords2D(args.fTransformedCoord s[0]); 210 SkString coords2D = args.fFragBuilder->ensureCoords2D(args.fTransformedCoord s[0]);
211 SkString t; 211 SkString t;
212 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] 212 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
213 // On Intel GPU there is an issue where it reads the second arguement to ata n "- %s.x" as an int 213 t.printf("(atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5)",
214 // thus must us -1.0 * %s.x to work correctly 214 coords2D.c_str(), coords2D.c_str());
215 if (args.fGLSLCaps->mustForceNegatedAtanParamToFloat()){
216 t.printf("(atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5)",
217 coords2D.c_str(), coords2D.c_str());
218 } else {
219 t.printf("(atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5)",
220 coords2D.c_str(), coords2D.c_str());
221 }
222 this->emitColor(args.fFragBuilder, 215 this->emitColor(args.fFragBuilder,
223 args.fUniformHandler, 216 args.fUniformHandler,
224 args.fGLSLCaps, 217 args.fGLSLCaps,
225 ge, t.c_str(), 218 ge, t.c_str(),
226 args.fOutputColor, 219 args.fOutputColor,
227 args.fInputColor, 220 args.fInputColor,
228 args.fTexSamplers); 221 args.fTexSamplers);
229 } 222 }
230 223
231 ///////////////////////////////////////////////////////////////////// 224 /////////////////////////////////////////////////////////////////////
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 str->appendScalar(fCenter.fX); 256 str->appendScalar(fCenter.fX);
264 str->append(", "); 257 str->append(", ");
265 str->appendScalar(fCenter.fY); 258 str->appendScalar(fCenter.fY);
266 str->append(") "); 259 str->append(") ");
267 260
268 this->INHERITED::toString(str); 261 this->INHERITED::toString(str);
269 262
270 str->append(")"); 263 str->append(")");
271 } 264 }
272 #endif 265 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/builders/GrGLShaderStringBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698