Skip to content

Support BindingType StorageTexture in AsBindGroup #7640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pkupper opened this issue Feb 12, 2023 · 4 comments
Closed

Support BindingType StorageTexture in AsBindGroup #7640

pkupper opened this issue Feb 12, 2023 · 4 comments
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible

Comments

@pkupper
Copy link
Contributor

pkupper commented Feb 12, 2023

What problem does this solve or what need does it fill?

Currently the AsBindGroup macro supports the BindingTypes Uniform, Texture, Sampler and Storage.
Wgpu also has the BindingType type StorageTexture which enables direct read/write access to textures without sampling (e.g. from a compute shader where samplers are not supported). This is currently not supported by the AsBindGroup macro.

For an example use case check out Bevy's compute_shader_game_of_life example. This example currently cannot be written using AsBindGroup.

What solution would you like?

The AsBindGroup derive macro should support the BindingType StorageTexture in ReadOnly, ReadWrite and WriteOnly configurations in order to enable compute shader processing of textures.

What alternative(s) have you considered?

Continue constructing BindGroups and BindGroupLayouts manually for this use case.

Additional context

The BindingType Storage was added in #6129. This PR could perhaps serve as reference for implementing the BindingType StorageTexture

@pkupper pkupper added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Feb 12, 2023
@Patryk27
Copy link

e.g. from a compute shader where samplers are not supported

fwiw, compute shaders support samplers - you just have to provide explicit LOD 🙂

@pkupper
Copy link
Contributor Author

pkupper commented Feb 13, 2023

Thank you @Patryk27, that's good to know!
Unfortunately, I also need to write to a texture which cannot be done with a regular Texture binding. That still requires a StorageTexture binding.

@james7132 james7132 added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Feb 17, 2023
@MMukundi
Copy link

Hi all!
I'm new to the repo (and open source in general actually), but I came across this issue myself after reading over the compute_shader_game_of_life example, and was inspired to take a look. I have a functioning implementation in a fork I've been toying around with locally and would be happy to contribute it to the main repo!
I would appreciate some guidance on what the process looks like though if possible: should I just open the PR from my fork and go from there?

@kristoff3r
Copy link
Contributor

This was introduced in #9943, so this issue can be closed

@pkupper pkupper closed this as completed Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible
Projects
None yet
Development

No branches or pull requests

5 participants