Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Shaders should not implicitly enable VulkanMemoryModel

Open
#77 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/1090
Old labels: t: bug
Originally creatd by Firestar99 on 2023-08-10T11:29:34Z


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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the target handling around SpirvBuilder and the example/build.rs TARGET value described in the report. Reproduce with spirv-unknown-vulkan1.2 and inspect the resulting SPIR-V capability, comparing it with spirv-unknown-spv1.3. Done means Vulkan targets no longer emit VulkanMemoryModel implicitly, while explicit SpirvBuilder.capability(Capability::VulkanMemoryModel) still enables it.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.