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

Unified Diff: src/gpu/effects/GrConfigConversionEffect.cpp

Issue 15719007: Make GrGLConfigConversionEffect work on Intel GPUs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Simplity the shader Created 7 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrConfigConversionEffect.cpp
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 1e65a6f29933df948a3030b9db781b507943ac7c..fd6264ffe2aaee7969557c03b1d6dc8309236cb2 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -50,8 +50,12 @@ public:
outputColor, outputColor, swiz, outputColor, outputColor);
break;
case GrConfigConversionEffect::kMulByAlpha_RoundDown_PMConversion:
+ // Add a compensation(0.001) here to avoid the side effect of the floor operation.
+ // In Intel GPUs, the integer value converted from floor(%s.r * 255.0) / 255.0
+ // is less than the integer value converted from %s.r by 1 when the %s.r is
+ // converted from the integer value 2^n, such as 1, 2, 4, 8, etc.
builder->fsCodeAppendf(
- "\t\t%s = vec4(floor(%s.%s * %s.a * 255.0) / 255.0, %s.a);\n",
+ "\t\t%s = vec4(floor(%s.%s * %s.a * 255.0 + 0.001) / 255.0, %s.a);\n",
outputColor, outputColor, swiz, outputColor, outputColor);
break;
case GrConfigConversionEffect::kDivByAlpha_RoundUp_PMConversion:
« 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