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

Unified Diff: src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp

Issue 877473005: Add device space "nudge" to gpu draws Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix 'f' again Created 5 years, 11 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 | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
index f17e741169859adac2a4ba0e7d282cd20a8846f1..f7f38a983e2b0696c74f0ce1ff9c8472c52c3bdd 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -47,13 +47,15 @@ void GrGLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& posV
// Transform from Skia's device coords to GL's normalized device coords. Note that
// because we want to "nudge" the device space positions we are converting to
// non-homogeneous NDC.
+ // The "0.003" nudge serves to match the raster path's rounding for bw draws.
+ // For aa draws we just assume the impact will be minimal - so we always perform the nudge.
if (kVec3f_GrSLType == posVar.getType()) {
- this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy)/%s.z, dot(%s.yz, %s.zw)/%s.z, 0, 1);",
- posVar.c_str(), fRtAdjustName, posVar.c_str(),
- posVar.c_str(), fRtAdjustName, posVar.c_str());
+ this->codeAppendf("gl_Position = vec4((dot(%s.xz, %s.xy)/%s.z) + 0.003 * %s.x, (dot(%s.yz, %s.zw)/%s.z) + 0.003 * %s.z, 0, 1);",
+ posVar.c_str(), fRtAdjustName, posVar.c_str(), fRtAdjustName,
+ posVar.c_str(), fRtAdjustName, posVar.c_str(), fRtAdjustName);
} else {
SkASSERT(kVec2f_GrSLType == posVar.getType());
- this->codeAppendf("gl_Position = vec4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);",
+ this->codeAppendf("gl_Position = vec4((%s.x + 0.003) * %s.x + %s.y, (%s.y + 0.003) * %s.z + %s.w, 0, 1);",
posVar.c_str(), fRtAdjustName, fRtAdjustName,
posVar.c_str(), fRtAdjustName, fRtAdjustName);
}
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698