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

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

Issue 1151693005: Remove uniform view matrix from GrGLPrimitiveProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 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/GrGLGeometryProcessor.h ('k') | src/gpu/gl/GrGLPrimitiveProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGeometryProcessor.cpp
diff --git a/src/gpu/gl/GrGLGeometryProcessor.cpp b/src/gpu/gl/GrGLGeometryProcessor.cpp
index 60c00432ce0b6d4c163e10b58b851fa4f9fb440c..dc4518f978f026ea4e0b714fcf81eb44ef24d5b4 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.cpp
+++ b/src/gpu/gl/GrGLGeometryProcessor.cpp
@@ -91,24 +91,35 @@ void GrGLGeometryProcessor::emitTransforms(GrGLGPBuilder* pb,
void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
GrGPArgs* gpArgs,
+ const char* posName) {
+ GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
+ vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
+}
+
+void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
+ GrGPArgs* gpArgs,
const char* posName,
- const SkMatrix& mat) {
+ const SkMatrix& mat,
+ UniformHandle* viewMatrixUniform) {
GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
if (mat.isIdentity()) {
gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
-
vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
- } else if (!mat.hasPerspective()) {
- this->addUniformViewMatrix(pb);
- gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
-
- vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
- gpArgs->fPositionVar.c_str(), this->uViewM(), posName);
} else {
- this->addUniformViewMatrix(pb);
- gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
-
- vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
- gpArgs->fPositionVar.c_str(), this->uViewM(), posName);
+ const char* viewMatrixName;
+ *viewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
+ kMat33f_GrSLType, kHigh_GrSLPrecision,
+ "uViewM",
+ &viewMatrixName);
+ if (!mat.hasPerspective()) {
+ gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
+ vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
+ gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
+ } else {
+ gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
+ vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
+ gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
+ }
}
}
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.h ('k') | src/gpu/gl/GrGLPrimitiveProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698