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

Unified Diff: src/effects/gradients/SkSweepGradient.cpp

Issue 152233006: Bug Fix for Intel atan on gpu sweep gradient (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkSweepGradient.cpp
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 494569df5dc23362710933827253144121e19dc4..cb9d2763d5a3bed2af77d65a2be6c1ec198b6b83 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -249,8 +249,18 @@ void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder,
const TextureSamplerArray& samplers) {
this->emitUniforms(builder, key);
SkString coords2D = builder->ensureFSCoords2D(coords, 0);
+ const GrGLContextInfo ctxInfo = builder->ctxInfo();
SkString t;
- t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords2D.c_str(), coords2D.c_str());
+ // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
+ // On Intel GPU there is an issue where it reads the second arguement to atan "- %s.x" as an int
+ // thus must us -1.0 * %s.x to work correctly
+ if (kIntel_GrGLVendor != ctxInfo.vendor()){
+ t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5",
+ coords2D.c_str(), coords2D.c_str());
+ } else {
+ t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5",
+ coords2D.c_str(), coords2D.c_str());
+ }
this->emitColor(builder, t.c_str(), key,
outputColor, inputColor, samplers);
}
« no previous file with comments | « no previous file | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698