diff options
author | 2015-01-20 14:37:14 -0800 | |
---|---|---|
committer | 2015-01-20 14:37:15 -0800 | |
commit | 3e3b58d57a358e2d52bc23ad2409a95d59310100 (patch) | |
tree | e0bd3220444e1615e739c86c7953b3eb23d533ae /src/gpu/GrGeometryProcessor.cpp | |
parent | 6c5fed2d5c18129a2ae6ef461d75e388f1b0bacd (diff) |
Add perspective divide when we're mapping down to a 2D varying
This fixes a few of the perspective errors in SampleApp but not all.
BUG=skia:3326
Review URL: https://codereview.chromium.org/861553008
Diffstat (limited to 'src/gpu/GrGeometryProcessor.cpp')
-rw-r--r-- | src/gpu/GrGeometryProcessor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gpu/GrGeometryProcessor.cpp b/src/gpu/GrGeometryProcessor.cpp index 7214220ba2..3980767b1b 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()) { |