Support RuntimeDescriptorArray when ingesting SPIR-V
While testing "slang" as a shader language, I produced SPIR-V that contained unbound texture arrays (for which I would write a binding array in WGSL):
[[vk::binding(0, 2)]]
Texture2D textures[];
// WGSL equivelent:
// @group(2) @binding(0) var textures: binding_array<texture_2d<f32>>;
When compiling the shader with this SPIR-V using the include_spirv!() macro, I get the following validation error:
parsing error: UnsupportedCapability(RuntimeDescriptorArray)
It would be great if naga could ingest SPIR-V that use runtime descriptor arrays.
PS: When bounding the txture array, naga will happily accept the SPIR-V and wgpu will run the shader. Since it seems that wgpu does not properly do bounds checking, the shader will work as if it was boundless (which could be seens as kind of a workaround).
What wgpu version - I just tested adding that cap on trunk and it works fine. I do get a different error though
I tested this using the current stable ("22.1.0") and also using trunk version (4f1a9b53deb053ca65f6a57e2e4c2b59e34ed1c2). I get the same, above error in both cases.
Re-tested with with WGPU 26, and we still face the same blocker. @cwfitzgerald Is there any way I could help getting this issue forward?
@hasenbanck Yeah, if you are able to push this along that would be great. This is supported at an IR level (WGSL has unbounded arrays) already, so hopefully will be fixing up the spirv frontend to generate that IR. I can't imagine it will be too much of an issue, the capability needs to be marked supported, then any resulting errors need to be fixed up, and a naga snapshot test added. I'm happy to field any questions that come up during the implementation.
@cwfitzgerald Okay, I will try to find my way around the code and try to implement the missing parts.