wgsl-bindgen icon indicating copy to clipboard operation
wgsl-bindgen copied to clipboard

Add support for binding arrays

Open IcanDivideBy0 opened this issue 8 months ago • 2 comments

Currently, the following binding:

@group(0) @binding(0) var textures: binding_array<texture_2d<f32>>;

is not supported:

wgsl_bindgen-0.18.1/src/generate/bind_group/single_bind_group.rs:422:16:
Failed to generate BindingType for BindingArray { base: [14], size: Dynamic }

related wgpu features: BUFFER_BINDING_ARRAY, STORAGE_RESOURCE_BINDING_ARRAY, TEXTURE_BINDING_ARRAY, UNIFORM_BUFFER_BINDING_ARRAYS

Maybe I can try my hands on if you think it might be a good "first issue"

IcanDivideBy0 avatar Apr 30 '25 14:04 IcanDivideBy0

Thanks for reporting. I think this might be relatively simple (given no other panics occur further 😄 )

I normally start by trying to recreate the issue in the example crate. https://github.com/Swoorup/wgsl-bindgen/blob/main/example/shaders/triangle.wgsl

And use debug messages if necessary. Once done, would either add a unit test or the snapshot tests

Let me know if you run into any issues.

Swoorup avatar Apr 30 '25 15:04 Swoorup

Completed. See https://github.com/Swoorup/wgsl-bindgen/blob/main/example/src/demos/texture_array_demo.rs for example usage

Swoorup avatar Jun 27 '25 17:06 Swoorup