Texel fetch not working

My issue is that Texel fetch is not working, and neither is reading from 2d texture arrays. I’m using the webGPU engine, but the particular shader I’m working in is GLSL. I’ve been creating the texture with these settings:
samplingMode: Texture.NEAREST_SAMPLINGMODE
samplingMode: Constants.TEXTURE_NEAREST_NEAREST
noMipmapOrOptions: true

When I make the call to read from the texture, I’m always using the 0 level for mipmap.
I’m not really sure where I’m going wrong here. Here’s an example playground using the 2d texture array:
webGL2: Babylon.js Playground
webGPU: https://playground.babylonjs.com/#XEVUD9#184

You’ll see in the webgpu version that the cube is black - and it doesn’t matter if you hardcode the mipmap level value to 0.0

Also note that for the second playground I set the texture format to BABYLON.Engine.TEXTUREFORMAT_RGBA

Let me add @Evgeni_Popov our WebGPU expert to this thread.

1 Like

It’s not a problem with WebGPU, your PG does not work in WebGL either. The problem is in constructing the texture (lines 9-21) after you changed the format from RGB to RGBA:

Okay, I get it now I think. I did not think that the format argument would change the expected texture size as those are independently specified as separate arguments to the texture constructor. I guess I’m not really sure what I was expecting in terms of sampling behavior haha