Skip to content

Commit 781c3c8

Browse files
author
David DeSimone
committed
Fixing improper logical error in assigning values to uniformByName and uniformByLocation map
1 parent 430a321 commit 781c3c8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cocos2d/shaders/CCGLProgramState.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ cc.GLProgramState = function (glprogram) {
156156

157157
var activeUniforms = glprogram._glContext.getProgramParameter(glprogram._programObj,
158158
glprogram._glContext.ACTIVE_UNIFORMS);
159-
159+
160+
var count = 0;
160161
for (var i = 0; i < activeUniforms; ++i) {
161162
var uniform = glprogram._glContext.getActiveUniform(glprogram._programObj, i);
162163
if (uniform.name.indexOf("CC_") !== 0) {
@@ -165,8 +166,9 @@ cc.GLProgramState = function (glprogram) {
165166
uniform.name = uniform.name.replace("[]", "");
166167
var uniformValue = new cc.UniformValue(uniform, glprogram);
167168
this._uniforms.push(uniformValue);
168-
this._uniformsByName[uniform.name] = i;
169-
this._uniformsByLocation[uniform.location] = i;
169+
this._uniformsByName[uniform.name] = count;
170+
this._uniformsByLocation[uniform.location] = count;
171+
count++;
170172
}
171173
}
172174
};

0 commit comments

Comments
 (0)