Vulkan validation errors on examples (Invalid explicit layout decorations on type for operand...)
Description New vulkan validation errors on the 3d wgpu examples and bevy.
Repro steps Update vulkan validation layers to 1.4.313
Run any of the water/cube/skybox/shadow examples.
Extra materials
[2025-05-16T21:22:45Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-StandaloneSpirv-None-10684 (0xb210f7c2)]
vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
Invalid explicit layout decorations on type for operand '478[%478]'
%result = OpVariable %_ptr_Function_VertexOutput Function %479
The Vulkan spec states: All variables must have valid explicit layout decorations as described in Shader Interfaces (https://vulkan.lunarg.com/doc/view/1.4.313.0/windows/antora/spec/latestappendices/spirvenv.html#VUID-StandaloneSpirv-None-10684)
[2025-05-16T21:22:45Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-StandaloneSpirv-None-10684 (0xb210f7c2)]
vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
Invalid explicit layout decorations on type for operand '45[%45]'
%result = OpVariable %_ptr_Function_VertexOutput Function %46
The Vulkan spec states: All variables must have valid explicit layout decorations as described in Shader Interfaces (https://vulkan.lunarg.com/doc/view/1.4.313.0/windows/antora/spec/latestappendices/spirvenv.html#VUID-StandaloneSpirv-None-10684)
Platform Happens on both Windows and Linux, vulkan sdk 1.4.313.
When this is fixed, please revert 24752af93a5706bf89d2fdd78f32fe46de6cf4b1
I think we are violating this rule (it's written as an allow in the other direction)
when using SPIR-V versions 1.4 and earlier: Block, BufferBlock, Offset, ArrayStride, and MatrixStride can also decorate types and type members used by variables in the Private and Function storage classes.
from https://vulkan.lunarg.com/doc/view/1.4.313.2/windows/antora/spec/latest/chapters/interfaces.html (top of spec)
I think the best way is to create both decorated and non-decorated structs, use the decorated structs for most things except variables in private and function class, and then using OpCopyLogical to convert in/out of those variables (when above spirv 1.4).