Required size for texture data layout (747936) exceeds the linear data size (560952) with offset (0)

The situation:

I am performing a WebGL to WebGPU migration for an app that previously used a Raw RGB texture to hold vertex positions for a special mesh. WebGPU does not accept RGB textures , so I am padding the data and storing it into a Raw RGBA texture. I attempted to re-create the error in a PG following the same approach used in the application however, I don’t get the error in the PG. I had even broke the data up into two separate textures and received the same result referencing different numbers of bytes but having the same 4/3 ratio. The number of bytes of data to write, which I log, matches the data layout, but the error references 1/3 less bytes.

Application Code:

Error Log in Application:

Attempt to reproduce the error in a PG:

Check highPos.length, you will see it doesn’t have the right value (441*106*4=186984), but 140238 instead (441*106*3).

I’ve reproduced your error:

The “* 3” line 21 should be “* 4”.

1 Like

@Evgeni_Popov Thank you so much for the advice.

When I log highPos.length I do get 186984 however, the rgbaValues Float32Array based upon highPos is not yielding the proper length. I don’t get it.

@Evgeni_Popov I believe it is another texture with similar dimensions that is causing the problem. I believe I was cleaning the wrong closet.