gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.12k stars 881 forks source link

Make `SPV_KHR_storage_buffer_storage_class` optional #4427

Closed teoxoy closed 7 months ago

teoxoy commented 1 year ago

The SPV_KHR_storage_buffer_storage_class extension requires the VK_KHR_storage_buffer_storage_class extension which might not be supported. We can instead conditionally translate storage buffers to Uniform address space and decorate them with BufferBlock.

wgpu issue: https://github.com/gfx-rs/wgpu/issues/3348

jimblandy commented 1 year ago

The SPIR-V spec says that the BufferBlock decoration is deprecated, and says we should instead:

use Block-decorated StorageBuffer Storage Class objects

Maybe there are details here, but generally we should take deprecation at face value.

Maybe the ideal solution would be to have the SPIR-V backend take an option to indicate whether it should require SPV_KHR_storage_buffer_storage_class or instead fall back to the BufferBlock decoration. Then wgpu-core could look at the device, and check the device for VK_KHR_storage_buffer_storage_class to see how it should set the Naga option.

jimblandy commented 7 months ago

Since the Naga issues and WGPU issues were merged, this is now really just a duplicate of #3348. Let's track further work there.