EmbarkStudios/rust-gpu

Shaders should not implicitly enable VulkanMemoryModel

Firestar99 opened this issue · 0 comments

Expected Behaviour

rust-gpu compiling for any spirv-unknown-vulkan1.X target should not implicitly emit OpCapability VulkanMemoryModel in the resulting spv, instead one would need to call SpirvBuilder.capability(Capability::VulkanMemoryModel) to enable the VulkanMemoryModel explicitly.
This implicit enabling of that Capability can get in the way of 1:1 porting of glsl shaders to rust-gpu, as it also requires changes to the CPU code to enable the VulkanMemoryModel device feature. Switching to target spirv-unknown-spv1.X does remove the implicit capability from the shader, but it is disencouraged as it also "disables a bunch of rules in spirv-val".

Example & Steps To Reproduce

  1. git clone https://github.com/Firestar99/rust-gpu-vulkano-example.git
  2. In example/build.rs change TARGET from spirv-unknown-spv1.3 to spirv-unknown-vulkan1.2 (or any other vulkan version)
  3. cargo run to see it fail when changes of 2. are applied

System Info

  • Rust: nightly-2023-05-27
  • OS: Ubuntu 23.04
  • GPU: RADV REMBRANDT
  • SPIR-V: SPIRV-Tools v2023.3 unknown hash, 2023-05-25T20:33:54