Search code examples
wgpu-rs

Read from texture in compute shader


I am trying to read (and write) to a texture in my compute shader. And getting the following message:

Read-write and read-only storage textures are not allowed by webgpu, they require the native only feature TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES

Reading from a texture in a compute shader is extremely useful, surely there must a way to accomplish this in some other way.

Edit:

I am writing a raytracer eerily similar to this one. https://github.com/jgrazian/wgpu-raytracer.

And this used to be possible in the past


Solution

  • Reading from a texture in a compute shader is possible when binding the texture as a normal Texture (not as a StorageTexture) and then usingtextureLoad on it: https://github.com/gfx-rs/wgpu/issues/2735