|
@@ -15808,12 +15808,13 @@ function setValue4fm( gl, v ) {
|
|
|
|
|
|
function setValueT1( gl, v, renderer ) {
|
|
|
|
|
|
+ var cache = this.cache;
|
|
|
var unit = renderer.allocTextureUnit();
|
|
|
|
|
|
- if ( this.cache[ 0 ] !== unit ) {
|
|
|
+ if ( cache[ 0 ] !== unit ) {
|
|
|
|
|
|
gl.uniform1i( this.addr, unit );
|
|
|
- this.cache[ 0 ] = unit;
|
|
|
+ cache[ 0 ] = unit;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -15823,12 +15824,13 @@ function setValueT1( gl, v, renderer ) {
|
|
|
|
|
|
function setValueT6( gl, v, renderer ) {
|
|
|
|
|
|
+ var cache = this.cache;
|
|
|
var unit = renderer.allocTextureUnit();
|
|
|
|
|
|
- if ( this.cache[ 0 ] !== unit ) {
|
|
|
+ if ( cache[ 0 ] !== unit ) {
|
|
|
|
|
|
gl.uniform1i( this.addr, unit );
|
|
|
- this.cache[ 0 ] = unit;
|
|
|
+ cache[ 0 ] = unit;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -15840,31 +15842,37 @@ function setValueT6( gl, v, renderer ) {
|
|
|
|
|
|
function setValue2iv( gl, v ) {
|
|
|
|
|
|
- if ( arraysEqual( this.cache, v ) ) return;
|
|
|
+ var cache = this.cache;
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, v ) ) return;
|
|
|
|
|
|
gl.uniform2iv( this.addr, v );
|
|
|
|
|
|
- copyArray( this.cache, v );
|
|
|
+ copyArray( cache, v );
|
|
|
|
|
|
}
|
|
|
|
|
|
function setValue3iv( gl, v ) {
|
|
|
|
|
|
- if ( arraysEqual( this.cache, v ) ) return;
|
|
|
+ var cache = this.cache;
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, v ) ) return;
|
|
|
|
|
|
gl.uniform3iv( this.addr, v );
|
|
|
|
|
|
- copyArray( this.cache, v );
|
|
|
+ copyArray( cache, v );
|
|
|
|
|
|
}
|
|
|
|
|
|
function setValue4iv( gl, v ) {
|
|
|
|
|
|
- if ( arraysEqual( this.cache, v ) ) return;
|
|
|
+ var cache = this.cache;
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, v ) ) return;
|
|
|
|
|
|
gl.uniform4iv( this.addr, v );
|
|
|
|
|
|
- copyArray( this.cache, v );
|
|
|
+ copyArray( cache, v );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -15899,13 +15907,25 @@ function getSingularSetter( type ) {
|
|
|
|
|
|
function setValue1fv( gl, v ) {
|
|
|
|
|
|
+ var cache = this.cache;
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, v ) ) return;
|
|
|
+
|
|
|
gl.uniform1fv( this.addr, v );
|
|
|
|
|
|
+ copyArray( cache, v );
|
|
|
+
|
|
|
}
|
|
|
function setValue1iv( gl, v ) {
|
|
|
|
|
|
+ var cache = this.cache;
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, v ) ) return;
|
|
|
+
|
|
|
gl.uniform1iv( this.addr, v );
|
|
|
|
|
|
+ copyArray( cache, v );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// Array of vectors (flat or from THREE classes)
|
|
@@ -15952,10 +15972,17 @@ function setValueM4a( gl, v ) {
|
|
|
|
|
|
function setValueT1a( gl, v, renderer ) {
|
|
|
|
|
|
- var n = v.length,
|
|
|
- units = allocTexUnits( renderer, n );
|
|
|
+ var cache = this.cache;
|
|
|
+ var n = v.length;
|
|
|
+
|
|
|
+ var units = allocTexUnits( renderer, n );
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, units ) === false ) {
|
|
|
|
|
|
- gl.uniform1iv( this.addr, units );
|
|
|
+ gl.uniform1iv( this.addr, units );
|
|
|
+ copyArray( cache, units );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
for ( var i = 0; i !== n; ++ i ) {
|
|
|
|
|
@@ -15967,10 +15994,17 @@ function setValueT1a( gl, v, renderer ) {
|
|
|
|
|
|
function setValueT6a( gl, v, renderer ) {
|
|
|
|
|
|
- var n = v.length,
|
|
|
- units = allocTexUnits( renderer, n );
|
|
|
+ var cache = this.cache;
|
|
|
+ var n = v.length;
|
|
|
+
|
|
|
+ var units = allocTexUnits( renderer, n );
|
|
|
+
|
|
|
+ if ( arraysEqual( cache, units ) === false ) {
|
|
|
|
|
|
- gl.uniform1iv( this.addr, units );
|
|
|
+ gl.uniform1iv( this.addr, units );
|
|
|
+ copyArray( cache, units );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
for ( var i = 0; i !== n; ++ i ) {
|
|
|
|
|
@@ -16024,6 +16058,7 @@ function PureArrayUniform( id, activeInfo, addr ) {
|
|
|
|
|
|
this.id = id;
|
|
|
this.addr = addr;
|
|
|
+ this.cache = [];
|
|
|
this.size = activeInfo.size;
|
|
|
this.setValue = getPureArraySetter( activeInfo.type );
|
|
|
|
|
@@ -19240,23 +19275,7 @@ function WebGLState( gl, extensions, utils ) {
|
|
|
|
|
|
function enableAttribute( attribute ) {
|
|
|
|
|
|
- newAttributes[ attribute ] = 1;
|
|
|
-
|
|
|
- if ( enabledAttributes[ attribute ] === 0 ) {
|
|
|
-
|
|
|
- gl.enableVertexAttribArray( attribute );
|
|
|
- enabledAttributes[ attribute ] = 1;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( attributeDivisors[ attribute ] !== 0 ) {
|
|
|
-
|
|
|
- var extension = extensions.get( 'ANGLE_instanced_arrays' );
|
|
|
-
|
|
|
- extension.vertexAttribDivisorANGLE( attribute, 0 );
|
|
|
- attributeDivisors[ attribute ] = 0;
|
|
|
-
|
|
|
- }
|
|
|
+ enableAttributeAndDivisor( attribute, 0 );
|
|
|
|
|
|
}
|
|
|
|