Open Runi-c opened 2 months ago
Thanks for the suggestion. Currently the places where an array can be sized by an override expression limited to what's common between Metal and Vulkan. (Direct3D doesn't support it, so we cover it up by delaying shader compilation until pipeline creation time.)
Putting this in M2 for consideration.
I'm working on a hefty compute shader project in WGSL and running into a pair of issues that feel very constricting.
workgroup
address space and therefore can't be bound.maxStorageBuffersPerShaderStage
(Chromium uses 10, wgpu uses 16, not sure why they're different)What I would prefer to be able to do when I have multiple tightly related arrays with sizes only known at pipeline creation time is to put them all in a single read-only buffer binding like this:
But because of the constraints on runtime- and pipeline-sized arrays, the only option I have is to allocate 3 runtime-sized storage buffers to what I would prefer to fill 1 buffer with:
For a workload with many small arrays of CPU-derived data, this will run into the storage buffers limit very quickly unless we do something more drastic like a shader preprocessor hack, or setting an arbitrary max array size, or in the worst case, packing everything into one flat array and marshalling out the struct data manually in the shader kernel.