Issue 164908
Summary [SPIRV] Should Clang targeting Vulkan support multidimensional resource arrays?
Labels HLSL, clang:HLSL:SPIRV
Assignees
Reporter hekota
    DXC on Vulkan does not support multi-dimensional resource arrays. This task is to track whether they should be supported in Clang when the targeting Vulkan/SPIR-V or not.

https://godbolt.org/z/4e14GjMhM
```
RWStructuredBuffer<float> In[4][2] : register(u0);
RWStructuredBuffer<float> Out : register(u0, space1);

[numthreads(4,1,1)]
void main(uint GI : SV_GroupIndex) {
  for (int i = 0; i < 4; i++)
    Out[i] = In[i][0][0] + In[i][1][0];
}
```
`error: Multi-dimensional arrays of RW/append/consume structured buffers are unsupported in Vulkan`

If the `RWStructuredBuffer` type is changed to `RWBuffer` the DXC compiler generates invalid SPIR-V:
```
fatal error: generated SPIR-V is invalid: [VUID-StandaloneSpirv-UniformConstant-04655] UniformConstant OpVariable <id> '4[%In]' has illegal type.
Variables identified with the UniformConstant storage class are used only as handles to refer to opaque resources. Such variables must be typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, OpTypeAccelerationStructureKHR, or an array of one of these types.
  %In = OpVariable %_ptr_UniformConstant__arr__arr_type_buffer_image_uint_2_uint_4 UniformConstant
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to