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

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 299943002: separate view matrix from rt adjustment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase on tot: Created 6 years, 7 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/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698