wowserhq / wowser

World of Warcraft in the browser using JavaScript and WebGL
MIT License
240 stars 63 forks source link

Terrain shader issue: WebGL: INVALID_VALUE: uniform1iv: no array #114

Closed fallenoak closed 8 years ago

fallenoak commented 8 years ago

Certain ADT chunks cause the following error to appear on the console:

WebGL: INVALID_VALUE: uniform1iv: no array

The error appears to happen within THREE's loadUniformsGeneric, in particular, at this line:

_gl.uniform1iv( location, uniform._array );

in:

                    case 'tv':

                        // array of THREE.Texture (2d or cube)

                        if ( uniform._array === undefined ) {

                            uniform._array = [];

                        }

                        for ( var i = 0, il = uniform.value.length; i < il; i ++ ) {

                            uniform._array[ i ] = getTextureUnit();

                        }

                        _gl.uniform1iv( location, uniform._array );

                        for ( var i = 0, il = uniform.value.length; i < il; i ++ ) {

                            texture = uniform.value[ i ];
                            textureUnit = uniform._array[ i ];

                            if ( ! texture ) continue;

                            if ( texture instanceof THREE.CubeTexture ||
                                 ( texture.image instanceof Array && texture.image.length === 6 ) ) {

                                // CompressedTexture can have Array in image :/

                                setCubeTexture( texture, textureUnit );

                            } else if ( texture instanceof THREE.WebGLRenderTarget ) {

                                _this.setTexture( texture.texture, textureUnit );

                            } else if ( texture instanceof THREE.WebGLRenderTargetCube ) {

                                setCubeTextureDynamic( texture.texture, textureUnit );

                            } else {

                                _this.setTexture( texture, textureUnit );

                            }

                        }

                        break;

To repro, visit the following location: 0, -9672.202, -1899.518, 81.560 and move the camera up a bit.