Fix invalid shaders with RX_VK_FOLLOW_MESH enabled #225

Merged
klimovich008 merged 3 commits from codex/spirv-struct-identity into main 2026-11-07 23:46:13 +00:00
klimovich008 commented 2026-11-07 16:38:12 +00:00 (Migrated from github.com)

What this fixes

With RX_VK_FOLLOW_MESH=1, loading Kokiri Forest on an RX 9070 XT produces invalid task/mesh shaders: VUID-VkShaderModuleCreateInfo-pCode-08737 and VUID-StandaloneSpirv-None-10684. Errors include duplicate Block decorations and explicit layout on Private variables.

Why merge

  • One-line change. Independently declared structures keep their own IDs and layout decorations.
  • Scalar/pointer reuse and the existing physical-buffer block wrappers stay unchanged.
  • Defaults and environment-variable controls stay unchanged; the translator stamp rejects older program caches.

Change

  • gpu/vk/sirit/src/stream.h: if (stream.words[stream.op_index] == static_cast<u32>(spv::Op::OpTypeStruct)) return stream << EndOp{};.
  • nx2/test_spirv_struct_identity.py: validate physical-buffer wrappers with/without Private local memory and check scalar/pointer reuse.

Tested

  • In a compiler developer shell with RX_CPM set and SPIR-V Tools on PATH: python nx2/test_spirv_struct_identity.py --headers "$env:RX_CPM/spirv-headers/vulkan-sdk-1.4.341.0/include" --spirv-val spirv-val --cxx clang++. Fails on the old code, passes now.
  • RX 9070 XT: the newer renderer produces 23 invalid modules. With #225, #217 and #162, all 73 reached task/mesh modules validate; a 258-second run reaches Kokiri Forest with zero validation errors. No game data is included.

Not covered

  • Tested on AMD only; the latest GPU run combines the three fixes.
  • Colored noise remains; this is a shader-validity fix.
## What this fixes With `RX_VK_FOLLOW_MESH=1`, loading Kokiri Forest on an RX 9070 XT produces invalid task/mesh shaders: `VUID-VkShaderModuleCreateInfo-pCode-08737` and `VUID-StandaloneSpirv-None-10684`. Errors include duplicate `Block` decorations and explicit layout on Private variables. ## Why merge - One-line change. Independently declared structures keep their own IDs and layout decorations. - Scalar/pointer reuse and the existing physical-buffer block wrappers stay unchanged. - Defaults and environment-variable controls stay unchanged; the translator stamp rejects older program caches. ## Change - `gpu/vk/sirit/src/stream.h`: `if (stream.words[stream.op_index] == static_cast<u32>(spv::Op::OpTypeStruct)) return stream << EndOp{};`. - `nx2/test_spirv_struct_identity.py`: validate physical-buffer wrappers with/without Private local memory and check scalar/pointer reuse. ## Tested - In a compiler developer shell with `RX_CPM` set and SPIR-V Tools on PATH: `python nx2/test_spirv_struct_identity.py --headers "$env:RX_CPM/spirv-headers/vulkan-sdk-1.4.341.0/include" --spirv-val spirv-val --cxx clang++`. Fails on the old code, passes now. - RX 9070 XT: the newer renderer produces 23 invalid modules. With #225, #217 and #162, all 73 reached task/mesh modules validate; a 258-second run reaches Kokiri Forest with zero validation errors. No game data is included. ## Not covered - Tested on AMD only; the latest GPU run combines the three fixes. - Colored noise remains; this is a shader-validity fix.
Commenting is not possible because the repository is archived.
No description provided.