-
Notifications
You must be signed in to change notification settings - Fork 984
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
Basic support for minBufferBindingSize #726
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. So to clarify it's use, this is the expected size of the (uniform) buffer in the shader so that if a user provides less than the required amount, they get an error?
Thanks for reviewing!
It's the size of a uniform/storage buffer that has to be at least as large as the structured part of the buffer plus one stride of an unbound array at the end. We validate against it either at pipeline and bind group creation (if BGL has it specified), or at draw time where they meet. So, in a sense, we validate that regardless. What this allows us to do is omitting any out-of-bounds checks on accessing the fields of such struct in the shader. bors r=cwfitzgerald |
377: Update with minBufferBindingSize r=cwfitzgerald a=kvark Depends on gfx-rs/wgpu#726 Also reverts #373 : buffer bindings now have to include at least one element of an unsized struct portion, so they can't be zero-sized. Co-authored-by: Dzmitry Malyshau <[email protected]>
377: Update with minBufferBindingSize r=cwfitzgerald a=kvark Depends on gfx-rs/wgpu#726 Also reverts #373 : buffer bindings now have to include at least one element of an unsized struct portion, so they can't be zero-sized. Co-authored-by: Dzmitry Malyshau <[email protected]>
377: Update with minBufferBindingSize r=cwfitzgerald a=kvark Depends on gfx-rs/wgpu#726 Also reverts #373 : buffer bindings now have to include at least one element of an unsized struct portion, so they can't be zero-sized. Co-authored-by: Dzmitry Malyshau <[email protected]>
739: Remove Peek-Poke r=cwfitzgerald a=kvark **Connections** Related to #738 Related to djg/peek-poke#10 **Description** As of #726 , the buffers have a minimum binding size that has to include the shader struct size. It, therefore, can't be zero. We can remove the hacks we had previously and switch fully to the idiomatic `Option<NonZeroU64>`. Peek-poke doesn't `NonZeroU64` and friends, so this made me reconsider the user of it entirely. Today, render bundles as well as the Player already represent command streams using a much rustier method. I tried to move everything to this method now, and I think this is going to work much better, and safer. **Testing** wgpu-rs works - gfx-rs/wgpu-rs#396 Co-authored-by: Dzmitry Malyshau <[email protected]>
377: Update with minBufferBindingSize r=cwfitzgerald a=kvark Depends on gfx-rs#726 Also reverts gfx-rs#373 : buffer bindings now have to include at least one element of an unsized struct portion, so they can't be zero-sized. Co-authored-by: Dzmitry Malyshau <[email protected]>
726: Bump wgpu-core and update texture_view_drop call r=kvark a=mkeeter This PR updates to the latest `wgpu-core` commit ([wgpu gfx-rs#1163](gfx-rs#1163)), and is the counterpart to [wgpu-native gfx-rs#66](gfx-rs/wgpu-native#66). I'm using `wait = false` in the `texture_view_drop` call to match `buffer_drop` and `texture_drop` elsewhere `backend/direct.rs`, though I don't quite understand the implications 😅 Co-authored-by: Matt Keeter <[email protected]>
Connections
Has basic (partial) implementation of gpuweb/gpuweb#678
wgpu-rs update - gfx-rs/wgpu-rs#377
Description
This change allows users to optionally specify the expected minimum binding size for buffers. We are then validating this against both the pipelines and bind groups.
If it's not provided, we'll need to validate at draw time - this PR doesn't do this (focus on API changes first).
It also moves out the
read_spirv
, since wgpu-types wasn't the right home for it ever.Testing
Tested on wgpu-rs examples