microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] Array containing a Block or BufferBlock must not be decorated with ArrayStride
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Having an array of read-write structured buffers and passing one of them into a function produces the following error upon loading the shader module:
validation layer: vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error): Array containing a Block or BufferBlock must not be decorated with ArrayStride %_arr_type_ACSBuffer_counter_uint_7 = OpTypeArray %type_ACSBuffer_counter %uint_7 The Vulkan spec states: If pCode is a pointer to SPIR-V code, pCode must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix (https://docs.vulkan.org/spec/latest/chapters/shaders.html#VUID-VkShaderModuleCreateInfo-pCode-08737)
Steps to Reproduce
[[vk::binding(0, 0)]]
RWStructuredBuffer<uint> bufs[7];
void Func(RWStructuredBuffer<uint> buf)
{
}
void main()
{
Func(bufs[0]);
}
Might be related to this? https://github.com/microsoft/DirectXShaderCompiler/issues/7867
Environment
- DXC version
libdxcompiler.so: 1.8(dev;0-00000000); libdxil.so: 1.8 - Host Operating System NixOS 2.28.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal HLSL reproducer using the Func and main entry points, then inspect the generated SPIR-V around the array of RWStructuredBuffer values. Done means the shader module no longer produces the SPIR-V validation error that an array containing a Block or BufferBlock is decorated with ArrayStride.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100