Remove COPY_DST from AsBindGroup uniform buffers (#16705)

# Objective
- Wgpu barrier tracking is expensive. Making buffers read-only makes
ideally lets wgpu skip worrying about barriers, although in wgpu 23 it
apparently won't yet.

## Solution
- Remove COPY_DST usage from AsBindGroup uniform buffers to allow future
wgpu versions to make this cheaper.
- AsBindGroup never updates buffers, so there's no need for COPY_DST. We
always recreate all buffers and the bind group every time data changes,
which yeah is also expensive.

## Testing
- Ran the animated materials example with/without bindless enabled. No
crashes.
This commit is contained in:
JMS55 2024-12-16 15:38:48 -08:00 committed by GitHub
parent 35826be6f7
commit 1e5d2c8867
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -483,7 +483,7 @@ pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result<TokenStream> {
#render_path::render_resource::OwnedBindingResource::Buffer(render_device.create_buffer_with_data(
&#render_path::render_resource::BufferInitDescriptor {
label: None,
usage: #render_path::render_resource::BufferUsages::COPY_DST | #uniform_buffer_usages,
usage: #uniform_buffer_usages,
contents: buffer.as_ref(),
},
))
@ -529,7 +529,7 @@ pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result<TokenStream> {
#render_path::render_resource::OwnedBindingResource::Buffer(render_device.create_buffer_with_data(
&#render_path::render_resource::BufferInitDescriptor {
label: None,
usage: #render_path::render_resource::BufferUsages::COPY_DST | #uniform_buffer_usages,
usage: #uniform_buffer_usages,
contents: buffer.as_ref(),
},
))