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

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

Issue 1333273003: Start trying to collapse path program stuff (Closed) Base URL: https://skia.googlesource.com/skia.git@removebt
Patch Set: windows Created 5 years, 3 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/GrGLProgramDataManager.h ('k') | src/gpu/gl/GrGLUniformHandle.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 2012 Google Inc. 2 * Copyright 2012 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 "SkMatrix.h"
8 #include "gl/GrGLProgramDataManager.h" 9 #include "gl/GrGLProgramDataManager.h"
9 #include "gl/GrGLUniformHandle.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
11 #include "SkMatrix.h"
12 11
13 #define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \ 12 #define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \
14 SkASSERT(arrayCount <= uni.fArrayCount || \ 13 SkASSERT(arrayCount <= uni.fArrayCount || \
15 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCoun t)) 14 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCoun t))
16 15
17 GrGLProgramDataManager::GrGLProgramDataManager(GrGLGpu* gpu, const UniformInfoAr ray& uniforms) 16 GrGLProgramDataManager::GrGLProgramDataManager(GrGLGpu* gpu, const UniformInfoAr ray& uniforms)
18 : fGpu(gpu) { 17 : fGpu(gpu) {
19 int count = uniforms.count(); 18 int count = uniforms.count();
20 fUniforms.push_back_n(count); 19 fUniforms.push_back_n(count);
21 for (int i = 0; i < count; i++) { 20 for (int i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
36 } 35 }
37 if (GrGLProgramBuilder::kFragment_Visibility & builderUniform.fVisibilit y) { 36 if (GrGLProgramBuilder::kFragment_Visibility & builderUniform.fVisibilit y) {
38 uniform.fFSLocation = builderUniform.fLocation; 37 uniform.fFSLocation = builderUniform.fLocation;
39 } else { 38 } else {
40 uniform.fFSLocation = kUnusedUniform; 39 uniform.fFSLocation = kUnusedUniform;
41 } 40 }
42 } 41 }
43 } 42 }
44 43
45 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const { 44 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const {
46 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 45 const Uniform& uni = fUniforms[u.toIndex()];
47 SkASSERT(uni.fType == kSampler2D_GrSLType); 46 SkASSERT(uni.fType == kSampler2D_GrSLType);
48 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 47 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
49 // FIXME: We still insert a single sampler uniform for every stage. If the s hader does not 48 // FIXME: We still insert a single sampler uniform for every stage. If the s hader does not
50 // reference the sampler then the compiler may have optimized it out. Uncomm ent this assert 49 // reference the sampler then the compiler may have optimized it out. Uncomm ent this assert
51 // once stages insert their own samplers. 50 // once stages insert their own samplers.
52 // this->printUnused(uni); 51 // this->printUnused(uni);
53 if (kUnusedUniform != uni.fFSLocation) { 52 if (kUnusedUniform != uni.fFSLocation) {
54 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); 53 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
55 } 54 }
56 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 55 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
57 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); 56 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit));
58 } 57 }
59 } 58 }
60 59
61 void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const { 60 void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const {
62 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 61 const Uniform& uni = fUniforms[u.toIndex()];
63 SkASSERT(uni.fType == kFloat_GrSLType); 62 SkASSERT(uni.fType == kFloat_GrSLType);
64 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 63 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
65 SkDEBUGCODE(this->printUnused(uni);) 64 SkDEBUGCODE(this->printUnused(uni);)
66 if (kUnusedUniform != uni.fFSLocation) { 65 if (kUnusedUniform != uni.fFSLocation) {
67 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); 66 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
68 } 67 }
69 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 68 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
70 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); 69 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
71 } 70 }
72 } 71 }
73 72
74 void GrGLProgramDataManager::set1fv(UniformHandle u, 73 void GrGLProgramDataManager::set1fv(UniformHandle u,
75 int arrayCount, 74 int arrayCount,
76 const GrGLfloat v[]) const { 75 const GrGLfloat v[]) const {
77 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 76 const Uniform& uni = fUniforms[u.toIndex()];
78 SkASSERT(uni.fType == kFloat_GrSLType); 77 SkASSERT(uni.fType == kFloat_GrSLType);
79 SkASSERT(arrayCount > 0); 78 SkASSERT(arrayCount > 0);
80 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 79 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
81 // This assert fires in some instances of the two-pt gradient for its VSPara ms. 80 // This assert fires in some instances of the two-pt gradient for its VSPara ms.
82 // Once the uniform manager is responsible for inserting the duplicate unifo rm 81 // Once the uniform manager is responsible for inserting the duplicate unifo rm
83 // arrays in VS and FS driver bug workaround, this can be enabled. 82 // arrays in VS and FS driver bug workaround, this can be enabled.
84 // this->printUni(uni); 83 // this->printUni(uni);
85 if (kUnusedUniform != uni.fFSLocation) { 84 if (kUnusedUniform != uni.fFSLocation) {
86 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v)); 85 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
87 } 86 }
88 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 87 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
89 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v)); 88 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v));
90 } 89 }
91 } 90 }
92 91
93 void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const { 92 void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const {
94 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 93 const Uniform& uni = fUniforms[u.toIndex()];
95 SkASSERT(uni.fType == kVec2f_GrSLType); 94 SkASSERT(uni.fType == kVec2f_GrSLType);
96 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 95 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
97 SkDEBUGCODE(this->printUnused(uni);) 96 SkDEBUGCODE(this->printUnused(uni);)
98 if (kUnusedUniform != uni.fFSLocation) { 97 if (kUnusedUniform != uni.fFSLocation) {
99 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1)); 98 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
100 } 99 }
101 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
102 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1)); 101 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1));
103 } 102 }
104 } 103 }
105 104
106 void GrGLProgramDataManager::set2fv(UniformHandle u, 105 void GrGLProgramDataManager::set2fv(UniformHandle u,
107 int arrayCount, 106 int arrayCount,
108 const GrGLfloat v[]) const { 107 const GrGLfloat v[]) const {
109 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 108 const Uniform& uni = fUniforms[u.toIndex()];
110 SkASSERT(uni.fType == kVec2f_GrSLType); 109 SkASSERT(uni.fType == kVec2f_GrSLType);
111 SkASSERT(arrayCount > 0); 110 SkASSERT(arrayCount > 0);
112 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 111 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
113 SkDEBUGCODE(this->printUnused(uni);) 112 SkDEBUGCODE(this->printUnused(uni);)
114 if (kUnusedUniform != uni.fFSLocation) { 113 if (kUnusedUniform != uni.fFSLocation) {
115 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v)); 114 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
116 } 115 }
117 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 116 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
118 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v)); 117 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v));
119 } 118 }
120 } 119 }
121 120
122 void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const { 121 void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const {
123 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 122 const Uniform& uni = fUniforms[u.toIndex()];
124 SkASSERT(uni.fType == kVec3f_GrSLType); 123 SkASSERT(uni.fType == kVec3f_GrSLType);
125 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 124 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
126 SkDEBUGCODE(this->printUnused(uni);) 125 SkDEBUGCODE(this->printUnused(uni);)
127 if (kUnusedUniform != uni.fFSLocation) { 126 if (kUnusedUniform != uni.fFSLocation) {
128 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2)); 127 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
129 } 128 }
130 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 129 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
131 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2)); 130 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
132 } 131 }
133 } 132 }
134 133
135 void GrGLProgramDataManager::set3fv(UniformHandle u, 134 void GrGLProgramDataManager::set3fv(UniformHandle u,
136 int arrayCount, 135 int arrayCount,
137 const GrGLfloat v[]) const { 136 const GrGLfloat v[]) const {
138 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 137 const Uniform& uni = fUniforms[u.toIndex()];
139 SkASSERT(uni.fType == kVec3f_GrSLType); 138 SkASSERT(uni.fType == kVec3f_GrSLType);
140 SkASSERT(arrayCount > 0); 139 SkASSERT(arrayCount > 0);
141 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 140 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
142 SkDEBUGCODE(this->printUnused(uni);) 141 SkDEBUGCODE(this->printUnused(uni);)
143 if (kUnusedUniform != uni.fFSLocation) { 142 if (kUnusedUniform != uni.fFSLocation) {
144 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v)); 143 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
145 } 144 }
146 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 145 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
147 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v)); 146 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v));
148 } 147 }
149 } 148 }
150 149
151 void GrGLProgramDataManager::set4f(UniformHandle u, 150 void GrGLProgramDataManager::set4f(UniformHandle u,
152 GrGLfloat v0, 151 GrGLfloat v0,
153 GrGLfloat v1, 152 GrGLfloat v1,
154 GrGLfloat v2, 153 GrGLfloat v2,
155 GrGLfloat v3) const { 154 GrGLfloat v3) const {
156 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 155 const Uniform& uni = fUniforms[u.toIndex()];
157 SkASSERT(uni.fType == kVec4f_GrSLType); 156 SkASSERT(uni.fType == kVec4f_GrSLType);
158 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 157 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
159 SkDEBUGCODE(this->printUnused(uni);) 158 SkDEBUGCODE(this->printUnused(uni);)
160 if (kUnusedUniform != uni.fFSLocation) { 159 if (kUnusedUniform != uni.fFSLocation) {
161 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v 3)); 160 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v 3));
162 } 161 }
163 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 162 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
164 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v 3)); 163 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v 3));
165 } 164 }
166 } 165 }
167 166
168 void GrGLProgramDataManager::set4fv(UniformHandle u, 167 void GrGLProgramDataManager::set4fv(UniformHandle u,
169 int arrayCount, 168 int arrayCount,
170 const GrGLfloat v[]) const { 169 const GrGLfloat v[]) const {
171 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 170 const Uniform& uni = fUniforms[u.toIndex()];
172 SkASSERT(uni.fType == kVec4f_GrSLType); 171 SkASSERT(uni.fType == kVec4f_GrSLType);
173 SkASSERT(arrayCount > 0); 172 SkASSERT(arrayCount > 0);
174 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 173 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
175 SkDEBUGCODE(this->printUnused(uni);) 174 SkDEBUGCODE(this->printUnused(uni);)
176 if (kUnusedUniform != uni.fFSLocation) { 175 if (kUnusedUniform != uni.fFSLocation) {
177 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v)); 176 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
178 } 177 }
179 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 178 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
180 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v)); 179 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v));
181 } 180 }
182 } 181 }
183 182
184 void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix []) const { 183 void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix []) const {
185 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 184 const Uniform& uni = fUniforms[u.toIndex()];
186 SkASSERT(uni.fType == kMat33f_GrSLType); 185 SkASSERT(uni.fType == kMat33f_GrSLType);
187 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 186 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
188 SkDEBUGCODE(this->printUnused(uni);) 187 SkDEBUGCODE(this->printUnused(uni);)
189 if (kUnusedUniform != uni.fFSLocation) { 188 if (kUnusedUniform != uni.fFSLocation) {
190 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, fal se, matrix)); 189 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, fal se, matrix));
191 } 190 }
192 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 191 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
193 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, fal se, matrix)); 192 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, fal se, matrix));
194 } 193 }
195 } 194 }
196 195
197 void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix []) const { 196 void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix []) const {
198 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 197 const Uniform& uni = fUniforms[u.toIndex()];
199 SkASSERT(uni.fType == kMat44f_GrSLType); 198 SkASSERT(uni.fType == kMat44f_GrSLType);
200 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 199 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
201 SkDEBUGCODE(this->printUnused(uni);) 200 SkDEBUGCODE(this->printUnused(uni);)
202 if (kUnusedUniform != uni.fFSLocation) { 201 if (kUnusedUniform != uni.fFSLocation) {
203 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, fal se, matrix)); 202 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, fal se, matrix));
204 } 203 }
205 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 204 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
206 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, fal se, matrix)); 205 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, fal se, matrix));
207 } 206 }
208 } 207 }
209 208
210 void GrGLProgramDataManager::setMatrix3fv(UniformHandle u, 209 void GrGLProgramDataManager::setMatrix3fv(UniformHandle u,
211 int arrayCount, 210 int arrayCount,
212 const GrGLfloat matrices[]) const { 211 const GrGLfloat matrices[]) const {
213 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 212 const Uniform& uni = fUniforms[u.toIndex()];
214 SkASSERT(uni.fType == kMat33f_GrSLType); 213 SkASSERT(uni.fType == kMat33f_GrSLType);
215 SkASSERT(arrayCount > 0); 214 SkASSERT(arrayCount > 0);
216 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 215 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
217 SkDEBUGCODE(this->printUnused(uni);) 216 SkDEBUGCODE(this->printUnused(uni);)
218 if (kUnusedUniform != uni.fFSLocation) { 217 if (kUnusedUniform != uni.fFSLocation) {
219 GR_GL_CALL(fGpu->glInterface(), 218 GR_GL_CALL(fGpu->glInterface(),
220 UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices )); 219 UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices ));
221 } 220 }
222 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 221 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
223 GR_GL_CALL(fGpu->glInterface(), 222 GR_GL_CALL(fGpu->glInterface(),
224 UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices )); 223 UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices ));
225 } 224 }
226 } 225 }
227 226
228 void GrGLProgramDataManager::setMatrix4fv(UniformHandle u, 227 void GrGLProgramDataManager::setMatrix4fv(UniformHandle u,
229 int arrayCount, 228 int arrayCount,
230 const GrGLfloat matrices[]) const { 229 const GrGLfloat matrices[]) const {
231 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 230 const Uniform& uni = fUniforms[u.toIndex()];
232 SkASSERT(uni.fType == kMat44f_GrSLType); 231 SkASSERT(uni.fType == kMat44f_GrSLType);
233 SkASSERT(arrayCount > 0); 232 SkASSERT(arrayCount > 0);
234 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 233 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
235 SkDEBUGCODE(this->printUnused(uni);) 234 SkDEBUGCODE(this->printUnused(uni);)
236 if (kUnusedUniform != uni.fFSLocation) { 235 if (kUnusedUniform != uni.fFSLocation) {
237 GR_GL_CALL(fGpu->glInterface(), 236 GR_GL_CALL(fGpu->glInterface(),
238 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices )); 237 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices ));
239 } 238 }
240 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 239 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
241 GR_GL_CALL(fGpu->glInterface(), 240 GR_GL_CALL(fGpu->glInterface(),
(...skipping 16 matching lines...) Expand all
258 this->setMatrix3f(u, mt); 257 this->setMatrix3f(u, mt);
259 } 258 }
260 259
261 #ifdef SK_DEBUG 260 #ifdef SK_DEBUG
262 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { 261 void GrGLProgramDataManager::printUnused(const Uniform& uni) const {
263 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) { 262 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) {
264 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); 263 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n");
265 } 264 }
266 } 265 }
267 #endif 266 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | src/gpu/gl/GrGLUniformHandle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698