Skip to content

Commit fdaa7e2

Browse files
author
David DeSimone
committed
Updating CCGLProgramState based on code review feedback. Removing uneeded object creation and lookup. Removing uneeded repeated calls to bind uniform values. Changing GLProgramState to not use cc.Class but instead using classic prototypical inheritance.
1 parent beee1dc commit fdaa7e2

File tree

2 files changed

+288
-300
lines changed

2 files changed

+288
-300
lines changed

cocos2d/shaders/CCGLProgram.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ cc.GLProgram = cc.Class.extend(/** @lends cc.GLProgram# */{
116116
ctor: function (vShaderFileName, fShaderFileName, glContext) {
117117
this._uniforms = {};
118118
this._hashForUniforms = {};
119-
this._userUniforms = {};
120119
this._glContext = glContext || cc._renderContext;
121120

122121
vShaderFileName && fShaderFileName && this.init(vShaderFileName, fShaderFileName);
@@ -232,7 +231,6 @@ cc.GLProgram = cc.Class.extend(/** @lends cc.GLProgram# */{
232231
}
233232

234233
this._glContext.linkProgram(this._programObj);
235-
this._parseUniforms();
236234

237235
if (this._vertShader)
238236
this._glContext.deleteShader(this._vertShader);
@@ -255,18 +253,6 @@ cc.GLProgram = cc.Class.extend(/** @lends cc.GLProgram# */{
255253
return true;
256254
},
257255

258-
_parseUniforms: function _parseUniforms() {
259-
var activeUniforms = this._glContext.getProgramParameter(this._programObj, this._glContext.ACTIVE_UNIFORMS);
260-
for (var i = 0; i < activeUniforms; ++i) {
261-
var uniform = this._glContext.getActiveUniform(this._programObj, i);
262-
uniform.location = this._glContext.getUniformLocation(this._programObj, uniform.name);
263-
if (uniform.name.indexOf("CC_") !== 0) {
264-
uniform.location = this._glContext.getUniformLocation(this._programObj, uniform.name);
265-
uniform.name = uniform.name.replace("[]", "");
266-
this._userUniforms[uniform.name] = uniform;
267-
}
268-
}
269-
},
270256
/**
271257
* it will call glUseProgram()
272258
*/

0 commit comments

Comments
 (0)