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

Side by Side Diff: src/gpu/gl/GrGLGeometryProcessor.cpp

Issue 1131513005: remove localmatrix from GrGeometryProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup4
Patch Set: tweaks 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/GrGLPathProcessor.cpp » ('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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (kVec2f_GrSLType == varyingType) { 82 if (kVec2f_GrSLType == varyingType) {
83 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", v.vsOut(), un iName, localCoords); 83 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", v.vsOut(), un iName, localCoords);
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
93 GrGLGeometryProcessor::setTransformData(const GrPrimitiveProcessor& primProc,
94 const GrGLProgramDataManager& pdman,
95 int index,
96 const SkTArray<const GrCoordTransform*, true>& transforms) {
97 SkSTArray<2, Transform, true>& procTransforms = fInstalledTransforms[index];
98 int numTransforms = transforms.count();
99 for (int t = 0; t < numTransforms; ++t) {
100 SkASSERT(procTransforms[t].fHandle.isValid());
101 const SkMatrix& transform = GetTransformMatrix(primProc.localMatrix(), * transforms[t]);
102 if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) {
103 pdman.setSkMatrix(procTransforms[t].fHandle.convertToUniformHandle() , transform);
104 procTransforms[t].fCurrentValue = transform;
105 }
106 }
107 }
108
109 void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb, 92 void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
110 GrGPArgs* gpArgs, 93 GrGPArgs* gpArgs,
111 const char* posName, 94 const char* posName,
112 const SkMatrix& mat) { 95 const SkMatrix& mat) {
113 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); 96 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
114 if (mat.isIdentity()) { 97 if (mat.isIdentity()) {
115 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); 98 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
116 99
117 vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), po sName); 100 vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), po sName);
118 } else if (!mat.hasPerspective()) { 101 } else if (!mat.hasPerspective()) {
119 this->addUniformViewMatrix(pb); 102 this->addUniformViewMatrix(pb);
120 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); 103 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
121 104
122 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));", 105 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
123 gpArgs->fPositionVar.c_str(), this->uViewM(), pos Name); 106 gpArgs->fPositionVar.c_str(), this->uViewM(), pos Name);
124 } else { 107 } else {
125 this->addUniformViewMatrix(pb); 108 this->addUniformViewMatrix(pb);
126 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3"); 109 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
127 110
128 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);", 111 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
129 gpArgs->fPositionVar.c_str(), this->uViewM(), pos Name); 112 gpArgs->fPositionVar.c_str(), this->uViewM(), pos Name);
130 } 113 }
131 } 114 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.h ('k') | src/gpu/gl/GrGLPathProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698