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

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

Issue 1453623003: Move glsl onto EmitArgs struct for emitCode (Closed) Base URL: https://skia.googlesource.com/skia.git@moveShaders
Patch Set: nit Created 5 years, 1 month 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ///////////////////////////////////////////////////////////////////// 246 /////////////////////////////////////////////////////////////////////
247 247
248 void GrGLSweepGradient::emitCode(EmitArgs& args) { 248 void GrGLSweepGradient::emitCode(EmitArgs& args) {
249 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); 249 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>();
250 this->emitUniforms(args.fBuilder, ge); 250 this->emitUniforms(args.fBuilder, ge);
251 SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); 251 SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
252 SkString t; 252 SkString t;
253 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] 253 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
254 // On Intel GPU there is an issue where it reads the second arguement to ata n "- %s.x" as an int 254 // On Intel GPU there is an issue where it reads the second arguement to ata n "- %s.x" as an int
255 // thus must us -1.0 * %s.x to work correctly 255 // thus must us -1.0 * %s.x to work correctly
256 if (args.fBuilder->glslCaps()->mustForceNegatedAtanParamToFloat()){ 256 if (args.fGLSLCaps->mustForceNegatedAtanParamToFloat()){
257 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", 257 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5",
258 coords2D.c_str(), coords2D.c_str()); 258 coords2D.c_str(), coords2D.c_str());
259 } else { 259 } else {
260 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", 260 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5",
261 coords2D.c_str(), coords2D.c_str()); 261 coords2D.c_str(), coords2D.c_str());
262 } 262 }
263 this->emitColor(args.fBuilder, 263 this->emitColor(args.fBuilder,
264 args.fFragBuilder, 264 args.fFragBuilder,
265 args.fGLSLCaps,
265 ge, t.c_str(), 266 ge, t.c_str(),
266 args.fOutputColor, 267 args.fOutputColor,
267 args.fInputColor, 268 args.fInputColor,
268 args.fSamplers); 269 args.fSamplers);
269 } 270 }
270 271
271 ///////////////////////////////////////////////////////////////////// 272 /////////////////////////////////////////////////////////////////////
272 273
273 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( 274 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor(
274 GrContext* context, 275 GrContext* context,
(...skipping 29 matching lines...) Expand all
304 str->appendScalar(fCenter.fX); 305 str->appendScalar(fCenter.fX);
305 str->append(", "); 306 str->append(", ");
306 str->appendScalar(fCenter.fY); 307 str->appendScalar(fCenter.fY);
307 str->append(") "); 308 str->append(") ");
308 309
309 this->INHERITED::toString(str); 310 this->INHERITED::toString(str);
310 311
311 str->append(")"); 312 str->append(")");
312 } 313 }
313 #endif 314 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698