Skip to content

DataTexture issue introduced in r145  #29160

Open
@Usnul

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:

image

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:

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:
image

here's what that looks like in r144:
image

Nothing special there really, but perhaps important is the fact that these two use different ShaderMaterials, because if I comment out uniform assignment for one of the shaders (the one used for central element), the error goes away:

image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions