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

Unified Diff: src/gpu/GrGeometryProcessor.cpp

Issue 861553008: Add perspective divide when we're mapping down to a 2D varying (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « 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/GrGeometryProcessor.cpp
diff --git a/src/gpu/GrGeometryProcessor.cpp b/src/gpu/GrGeometryProcessor.cpp
index 662f28f38694eaee2556a0eff6b15016b8569469..d2cf5f52f3e5f8081b40f4b7d26a81530712bd6f 100644
--- a/src/gpu/GrGeometryProcessor.cpp
+++ b/src/gpu/GrGeometryProcessor.cpp
@@ -218,7 +218,9 @@ void GrGLGeometryProcessor::emitTransforms(GrGLGPBuilder* pb,
vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;",
v.vsOut(), uniName, posVar.c_str());
} else {
- vb->codeAppendf("%s = (%s * %s).xy;", v.vsOut(), uniName, posVar.c_str());
+ // The brackets here are just to scope the temp variable
+ vb->codeAppendf("{ vec3 temp = %s * %s;", uniName, posVar.c_str());
+ vb->codeAppendf("%s = vec2(temp.x/temp.z, temp.y/temp.z); }", v.vsOut());
}
} else {
if (kVec2f_GrSLType == posVar.getType()) {
« 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