separate view matrix from rt adjustment
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/299943002
git-svn-id: http://skia.googlecode.com/svn/trunk@14944 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index c5df4c8..1fd1967 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -757,11 +757,19 @@
const char* viewMName;
fViewMatrixUniform = this->addUniform(GrGLShaderBuilder::kVertex_Visibility,
kMat33f_GrSLType, "ViewM", &viewMName);
+ const char* rtAdjustName;
+ fRTAdustmentVecUniform = this->addUniform(GrGLShaderBuilder::kVertex_Visibility,
+ kVec4f_GrSLType, "rtAdjustment", &rtAdjustName);
- this->vsCodeAppendf("\tvec3 pos3 = %s * vec3(%s, 1);\n"
- "\tgl_Position = vec4(pos3.xy, 0, pos3.z);\n",
+ // Transform the position into Skia's device coords.
+ this->vsCodeAppendf("\tvec3 pos3 = %s * vec3(%s, 1);\n",
viewMName, fPositionVar->c_str());
+ // Transform from Skia's device coords to GL's normalized device coords.
+ this->vsCodeAppendf(
+ "\tgl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.zw), 0, pos3.z);\n",
+ rtAdjustName, rtAdjustName);
+
// we output point size in the GS if present
if (header.fEmitsPointSize
#if GR_GL_EXPERIMENTAL_GS