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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.h ('k') | src/gpu/gl/GrGLPrimitiveProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLGeometryProcessor.h" 8 #include "GrGLGeometryProcessor.h"
9 9
10 #include "builders/GrGLProgramBuilder.h" 10 #include "builders/GrGLProgramBuilder.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } else { 84 } else {
85 vb->codeAppendf("%s = %s * vec3(%s, 1);", v.vsOut(), uniName , localCoords); 85 vb->codeAppendf("%s = %s * vec3(%s, 1);", v.vsOut(), uniName , localCoords);
86 } 86 }
87 } 87 }
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb, 92 void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
93 GrGPArgs* gpArgs, 93 GrGPArgs* gpArgs,
94 const char* posName) {
95 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
96 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
97 vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posNam e);
98 }
99
100 void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
101 GrGPArgs* gpArgs,
94 const char* posName, 102 const char* posName,
95 const SkMatrix& mat) { 103 const SkMatrix& mat,
104 UniformHandle* viewMatrixUniform) {
96 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); 105 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
97 if (mat.isIdentity()) { 106 if (mat.isIdentity()) {
98 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); 107 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
99
100 vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), po sName); 108 vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), po sName);
101 } else if (!mat.hasPerspective()) {
102 this->addUniformViewMatrix(pb);
103 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
104
105 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
106 gpArgs->fPositionVar.c_str(), this->uViewM(), pos Name);
107 } else { 109 } else {
108 this->addUniformViewMatrix(pb); 110 const char* viewMatrixName;
109 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3"); 111 *viewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibili ty,
110 112 kMat33f_GrSLType, kHigh_GrSLPrecisio n,
111 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);", 113 "uViewM",
112 gpArgs->fPositionVar.c_str(), this->uViewM(), pos Name); 114 &viewMatrixName);
115 if (!mat.hasPerspective()) {
116 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
117 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
118 gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
119 } else {
120 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
121 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
122 gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
123 }
113 } 124 }
114 } 125 }
OLDNEW
« 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