Index: src/gpu/gl/GrGLShaderBuilder.cpp |
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp |
index c5df4c803ce501011616bef7c7d458d1668d8996..1fd1967e21ba4d6e54ccd116adb1a8c5eab3f1d1 100644 |
--- a/src/gpu/gl/GrGLShaderBuilder.cpp |
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp |
@@ -757,11 +757,19 @@ GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGpuGL* gpu, |
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 |