File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 5757 // to ease the transition from using glPrograms directly, to
5858 // using glProgramStates.
5959 Object . defineProperty ( proto , '_shaderProgram' , {
60- set : function ( ) { this . setShaderProgram . apply ( this , arguments ) ; } ,
60+ set : function ( value ) { this . setShaderProgram ( value ) ; } ,
6161 get : function ( ) { return this . getShaderProgram ( ) ; }
6262 } ) ;
6363} ) ( ) ;
Original file line number Diff line number Diff line change @@ -153,7 +153,6 @@ cc.GLProgramState = function (glprogram) {
153153 this . _boundTextureUnits = { } ;
154154 this . _textureUnitIndex = 1 ; // Start at 1, as CC_Texture0 is bound to 0
155155
156-
157156 var activeUniforms = glprogram . _glContext . getProgramParameter ( glprogram . _programObj ,
158157 glprogram . _glContext . ACTIVE_UNIFORMS ) ;
159158
@@ -168,7 +167,7 @@ cc.GLProgramState = function (glprogram) {
168167 this . _uniforms . push ( uniformValue ) ;
169168 this . _uniformsByName [ uniform . name ] = count ;
170169 this . _uniformsByLocation [ uniform . location ] = count ;
171- count ++ ;
170+ count ++ ;
172171 }
173172 }
174173} ;
@@ -181,7 +180,10 @@ cc.GLProgramState.prototype = {
181180 }
182181
183182 for ( var i = 0 ; i < this . _uniforms . length ; ++ i ) {
184- this . _uniforms [ i ] . apply ( ) ;
183+ var uniform = this . _uniforms [ i ] ;
184+ if ( uniform . _currentBoundValue !== uniform . _value ) {
185+ uniform . apply ( ) ;
186+ }
185187 }
186188 } ,
187189
You can’t perform that action at this time.
0 commit comments