Description
Description
I was upgrading my virtual texture system to the latest revision up from r136, going directly to current version (r167.1) yielded a curious error:
WebGL: INVALID_OPERATION: texSubImage2D: no texture bound to target
GL_INVALID_OPERATION: Invalid combination of format, type and internalFormat.
I looked deeper and found that the problem was coming from copyTextureToTexture
:
So I started looking for the point where the breakage occurs, r144 is fine, r145 breaks.
Looking through the patch notes yield little of interest except for:
- Minimize glActiveTexture calls #24492
- WebGLTextures: Store source version in properties object. #24599
and possibly
#24637
Here's the actual code that sets up the offending texture:
#page_texture = new DataTexture(
new Uint8Array(4096 * 4096 * 4),
4096 ,
4096 ,
RGBAFormat,
UnsignedByteType,
);
/* ... */
const texture = this.#page_texture;
texture.unpackAlignment = 4;
texture.type = UnsignedByteType;
texture.format = RGBAFormat;
texture.internalFormat = "RGBA8";
texture.generateMipmaps = false;
texture.minFilter = NearestFilter;
texture.magFilter = LinearFilter;
texture.wrapS = ClampToEdgeWrapping;
texture.wrapT = ClampToEdgeWrapping;
texture.anisotropy = 8;
All of the above is done in the constructor of the containing class, so all parts are done before first usage.
The texture is bound to two custom shaders:
here's what that looks like in r144:
Nothing special there really, but perhaps important is the fact that these two use different ShaderMaterial
s, because if I comment out uniform assignment for one of the shaders (the one used for central element), the error goes away:
The console is clean too.
My best guess is that when textures.setTexture2D( dstTexture, 0 );
is being called inside copyTextureToTexture
, it binds / activates the wrong texture. Why? - no idea.
Version
r167.1
Device
Desktop
Browser
Chrome
OS
Windows
Activity