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

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

Issue 1136803002: print on unused uniforms in debug builds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak 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/GrGLProgramDataManager.h ('k') | no next file » | 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 "gl/GrGLPathRendering.h" 8 #include "gl/GrGLPathRendering.h"
9 #include "gl/GrGLUniformHandle.h" 9 #include "gl/GrGLUniformHandle.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 } 43 }
44 44
45 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const { 45 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const {
46 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 46 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
47 SkASSERT(uni.fType == kSampler2D_GrSLType); 47 SkASSERT(uni.fType == kSampler2D_GrSLType);
48 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 48 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
49 // FIXME: We still insert a single sampler uniform for every stage. If the s hader does not 49 // 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 50 // reference the sampler then the compiler may have optimized it out. Uncomm ent this assert
51 // once stages insert their own samplers. 51 // once stages insert their own samplers.
52 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLo cation); 52 // this->printUnused(uni);
53 if (kUnusedUniform != uni.fFSLocation) { 53 if (kUnusedUniform != uni.fFSLocation) {
54 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); 54 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
55 } 55 }
56 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 56 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
57 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); 57 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit));
58 } 58 }
59 } 59 }
60 60
61 void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const { 61 void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const {
62 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 62 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
63 SkASSERT(uni.fType == kFloat_GrSLType); 63 SkASSERT(uni.fType == kFloat_GrSLType);
64 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 64 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
65 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 65 this->printUnused(uni);
66 if (kUnusedUniform != uni.fFSLocation) { 66 if (kUnusedUniform != uni.fFSLocation) {
67 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); 67 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
68 } 68 }
69 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 69 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
70 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); 70 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
71 } 71 }
72 } 72 }
73 73
74 void GrGLProgramDataManager::set1fv(UniformHandle u, 74 void GrGLProgramDataManager::set1fv(UniformHandle u,
75 int arrayCount, 75 int arrayCount,
76 const GrGLfloat v[]) const { 76 const GrGLfloat v[]) const {
77 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 77 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
78 SkASSERT(uni.fType == kFloat_GrSLType); 78 SkASSERT(uni.fType == kFloat_GrSLType);
79 SkASSERT(arrayCount > 0); 79 SkASSERT(arrayCount > 0);
80 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 80 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
81 // This assert fires in some instances of the two-pt gradient for its VSPara ms. 81 // 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 82 // 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. 83 // arrays in VS and FS driver bug workaround, this can be enabled.
84 //SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLoc ation); 84 // this->printUni(uni);
85 if (kUnusedUniform != uni.fFSLocation) { 85 if (kUnusedUniform != uni.fFSLocation) {
86 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v)); 86 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
87 } 87 }
88 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 88 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
89 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v)); 89 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v));
90 } 90 }
91 } 91 }
92 92
93 void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const { 93 void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const {
94 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 94 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
95 SkASSERT(uni.fType == kVec2f_GrSLType); 95 SkASSERT(uni.fType == kVec2f_GrSLType);
96 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 96 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
97 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 97 this->printUnused(uni);
98 if (kUnusedUniform != uni.fFSLocation) { 98 if (kUnusedUniform != uni.fFSLocation) {
99 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1)); 99 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
100 } 100 }
101 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 101 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
102 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1)); 102 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1));
103 } 103 }
104 } 104 }
105 105
106 void GrGLProgramDataManager::set2fv(UniformHandle u, 106 void GrGLProgramDataManager::set2fv(UniformHandle u,
107 int arrayCount, 107 int arrayCount,
108 const GrGLfloat v[]) const { 108 const GrGLfloat v[]) const {
109 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 109 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
110 SkASSERT(uni.fType == kVec2f_GrSLType); 110 SkASSERT(uni.fType == kVec2f_GrSLType);
111 SkASSERT(arrayCount > 0); 111 SkASSERT(arrayCount > 0);
112 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 112 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
113 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 113 this->printUnused(uni);
114 if (kUnusedUniform != uni.fFSLocation) { 114 if (kUnusedUniform != uni.fFSLocation) {
115 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v)); 115 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
116 } 116 }
117 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 117 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
118 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v)); 118 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v));
119 } 119 }
120 } 120 }
121 121
122 void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const { 122 void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const {
123 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 123 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
124 SkASSERT(uni.fType == kVec3f_GrSLType); 124 SkASSERT(uni.fType == kVec3f_GrSLType);
125 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 125 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
126 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 126 this->printUnused(uni);
127 if (kUnusedUniform != uni.fFSLocation) { 127 if (kUnusedUniform != uni.fFSLocation) {
128 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2)); 128 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
129 } 129 }
130 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 130 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
131 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2)); 131 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
132 } 132 }
133 } 133 }
134 134
135 void GrGLProgramDataManager::set3fv(UniformHandle u, 135 void GrGLProgramDataManager::set3fv(UniformHandle u,
136 int arrayCount, 136 int arrayCount,
137 const GrGLfloat v[]) const { 137 const GrGLfloat v[]) const {
138 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 138 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
139 SkASSERT(uni.fType == kVec3f_GrSLType); 139 SkASSERT(uni.fType == kVec3f_GrSLType);
140 SkASSERT(arrayCount > 0); 140 SkASSERT(arrayCount > 0);
141 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 141 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
142 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 142 this->printUnused(uni);
143 if (kUnusedUniform != uni.fFSLocation) { 143 if (kUnusedUniform != uni.fFSLocation) {
144 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v)); 144 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
145 } 145 }
146 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 146 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
147 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v)); 147 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v));
148 } 148 }
149 } 149 }
150 150
151 void GrGLProgramDataManager::set4f(UniformHandle u, 151 void GrGLProgramDataManager::set4f(UniformHandle u,
152 GrGLfloat v0, 152 GrGLfloat v0,
153 GrGLfloat v1, 153 GrGLfloat v1,
154 GrGLfloat v2, 154 GrGLfloat v2,
155 GrGLfloat v3) const { 155 GrGLfloat v3) const {
156 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 156 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
157 SkASSERT(uni.fType == kVec4f_GrSLType); 157 SkASSERT(uni.fType == kVec4f_GrSLType);
158 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 158 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
159 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 159 this->printUnused(uni);
160 if (kUnusedUniform != uni.fFSLocation) { 160 if (kUnusedUniform != uni.fFSLocation) {
161 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v 3)); 161 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v 3));
162 } 162 }
163 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 163 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
164 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v 3)); 164 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v 3));
165 } 165 }
166 } 166 }
167 167
168 void GrGLProgramDataManager::set4fv(UniformHandle u, 168 void GrGLProgramDataManager::set4fv(UniformHandle u,
169 int arrayCount, 169 int arrayCount,
170 const GrGLfloat v[]) const { 170 const GrGLfloat v[]) const {
171 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 171 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
172 SkASSERT(uni.fType == kVec4f_GrSLType); 172 SkASSERT(uni.fType == kVec4f_GrSLType);
173 SkASSERT(arrayCount > 0); 173 SkASSERT(arrayCount > 0);
174 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 174 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
175 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 175 this->printUnused(uni);
176 if (kUnusedUniform != uni.fFSLocation) { 176 if (kUnusedUniform != uni.fFSLocation) {
177 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v)); 177 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
178 } 178 }
179 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 179 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
180 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v)); 180 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v));
181 } 181 }
182 } 182 }
183 183
184 void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix []) const { 184 void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix []) const {
185 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 185 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
186 SkASSERT(uni.fType == kMat33f_GrSLType); 186 SkASSERT(uni.fType == kMat33f_GrSLType);
187 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 187 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
188 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 188 this->printUnused(uni);
189 if (kUnusedUniform != uni.fFSLocation) { 189 if (kUnusedUniform != uni.fFSLocation) {
190 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, fal se, matrix)); 190 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, fal se, matrix));
191 } 191 }
192 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 192 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
193 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, fal se, matrix)); 193 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, fal se, matrix));
194 } 194 }
195 } 195 }
196 196
197 void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix []) const { 197 void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix []) const {
198 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 198 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
199 SkASSERT(uni.fType == kMat44f_GrSLType); 199 SkASSERT(uni.fType == kMat44f_GrSLType);
200 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 200 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
201 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 201 this->printUnused(uni);
202 if (kUnusedUniform != uni.fFSLocation) { 202 if (kUnusedUniform != uni.fFSLocation) {
203 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, fal se, matrix)); 203 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, fal se, matrix));
204 } 204 }
205 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 205 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
206 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, fal se, matrix)); 206 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, fal se, matrix));
207 } 207 }
208 } 208 }
209 209
210 void GrGLProgramDataManager::setMatrix3fv(UniformHandle u, 210 void GrGLProgramDataManager::setMatrix3fv(UniformHandle u,
211 int arrayCount, 211 int arrayCount,
212 const GrGLfloat matrices[]) const { 212 const GrGLfloat matrices[]) const {
213 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 213 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
214 SkASSERT(uni.fType == kMat33f_GrSLType); 214 SkASSERT(uni.fType == kMat33f_GrSLType);
215 SkASSERT(arrayCount > 0); 215 SkASSERT(arrayCount > 0);
216 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 216 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
217 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 217 this->printUnused(uni);
218 if (kUnusedUniform != uni.fFSLocation) { 218 if (kUnusedUniform != uni.fFSLocation) {
219 GR_GL_CALL(fGpu->glInterface(), 219 GR_GL_CALL(fGpu->glInterface(),
220 UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices )); 220 UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices ));
221 } 221 }
222 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 222 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
223 GR_GL_CALL(fGpu->glInterface(), 223 GR_GL_CALL(fGpu->glInterface(),
224 UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices )); 224 UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices ));
225 } 225 }
226 } 226 }
227 227
228 void GrGLProgramDataManager::setMatrix4fv(UniformHandle u, 228 void GrGLProgramDataManager::setMatrix4fv(UniformHandle u,
229 int arrayCount, 229 int arrayCount,
230 const GrGLfloat matrices[]) const { 230 const GrGLfloat matrices[]) const {
231 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 231 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
232 SkASSERT(uni.fType == kMat44f_GrSLType); 232 SkASSERT(uni.fType == kMat44f_GrSLType);
233 SkASSERT(arrayCount > 0); 233 SkASSERT(arrayCount > 0);
234 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); 234 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
235 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocat ion); 235 this->printUnused(uni);
236 if (kUnusedUniform != uni.fFSLocation) { 236 if (kUnusedUniform != uni.fFSLocation) {
237 GR_GL_CALL(fGpu->glInterface(), 237 GR_GL_CALL(fGpu->glInterface(),
238 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices )); 238 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices ));
239 } 239 }
240 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 240 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
241 GR_GL_CALL(fGpu->glInterface(), 241 GR_GL_CALL(fGpu->glInterface(),
242 UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices )); 242 UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices ));
243 } 243 }
244 } 244 }
245 245
246 void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix ) const { 246 void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix ) const {
247 GrGLfloat mt[] = { 247 GrGLfloat mt[] = {
248 matrix.get(SkMatrix::kMScaleX), 248 matrix.get(SkMatrix::kMScaleX),
249 matrix.get(SkMatrix::kMSkewY), 249 matrix.get(SkMatrix::kMSkewY),
250 matrix.get(SkMatrix::kMPersp0), 250 matrix.get(SkMatrix::kMPersp0),
251 matrix.get(SkMatrix::kMSkewX), 251 matrix.get(SkMatrix::kMSkewX),
252 matrix.get(SkMatrix::kMScaleY), 252 matrix.get(SkMatrix::kMScaleY),
253 matrix.get(SkMatrix::kMPersp1), 253 matrix.get(SkMatrix::kMPersp1),
254 matrix.get(SkMatrix::kMTransX), 254 matrix.get(SkMatrix::kMTransX),
255 matrix.get(SkMatrix::kMTransY), 255 matrix.get(SkMatrix::kMTransY),
256 matrix.get(SkMatrix::kMPersp2), 256 matrix.get(SkMatrix::kMPersp2),
257 }; 257 };
258 this->setMatrix3f(u, mt); 258 this->setMatrix3f(u, mt);
259 } 259 }
260
261 #ifdef SK_DEBUG
262 void GrGLProgramDataManager::printUnused(const Uniform& uni) const {
263 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) {
264 SkDebugf("Unused uniform in shader\n");
265 }
266 }
267 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698