-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow re-use of bind groups #33
Comments
Not quite sure since we use the naga oil syntax. It seems you can choose only certain bind group entries in the current module. And also possibly override certain entries for the same group by using an import from another file? If that weren't the case otherwise, it would have been a simple change. |
Was thinking this, One way is to make all entries optional for the bond group that is common across modules. To support a mix match, could use enum. But it would make the code complex. |
I kinda need this ATM myself. It would be great if you could provide an example files for your use case. |
You might need to handle wgsl files individually, rather than using entry points. My solution to this was to build a .rs file for each .wgsl file, and mirror the import path in Rust so that each entry point for example has access to the same shared bind group: https://github.com/bconnorwhite/wgsl_to_wgpu/tree/import-modules |
Think that should be fairly simple, if we just look up the mangled symbols. Just worried about the common bind group entry themselves being overridden, as that is allowed by naga_oil. That seems like a rare thing to do. I'll try to write up a prototype sometime. |
Thank you very much for this project, I can see it improving QoL when using wgsl very much!
I have a question/feature request: can you re-use bind groups with same layouts between different shader entries?
For example, I want to have a bind group for a texture consisting of a texture binding and a sampler that I use in multiple shader entries. As I understand it, with current codegen, I will have to create a separate bind group object for each entry, as the newtype wrappers would be incompatible.
Ideally, I would have a common newtype
TextureBindGroup
(either defined in my or in the generated code) which I would just store in the same struct as my texture and re-use it whenever I need to pass it to a shader.The text was updated successfully, but these errors were encountered: