When running the app, I get the following error immediately:
error: failed to build a valid final module: Global variable [4] 'params' is invalid
┌─ shaders/groups.wgsl:18:23
│
18 │ @group(2) @binding(0) var<uniform> params: array<GroupParams>;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ naga::ir::GlobalVariable [4]
│
= Type flags TypeFlags(DATA | COPY | HOST_SHAREABLE | CREATION_RESOLVED) do not meet the required TypeFlags(DATA | SIZED | COPY | HOST_SHAREABLE | CREATION_RESOLVED)
So based on that error, it's pretty obvious that "SIZED" is the flag that's missing and that it's relevant to the array nature. However, I can't figure out how to fix it. array<T,N> seems valid in some circumstances but isn't working in this case.
Here's the type definitions:
#[repr(C)]
#[derive(Clone, Copy, ShaderType)]
struct GroupParams {
base_color: Vec4,
a: f32,
b: f32,
c: f32,
d: f32,
e: f32,
f: f32,
g: f32,
h: f32,
}
#[repr(C)]
#[derive(Asset, AsBindGroup, Clone, TypePath)]
struct GroupsMaterial {
#[uniform(0)]
groups_params: [GroupParams; 10],
}
And then the definition in wgsl:
struct GroupParams {
base_color: vec4<f32>,
a: f32,
b: f32,
c: f32,
d: f32,
e: f32,
f: f32,
g: f32,
h: f32,
}
@group(2) @binding(0) var<uniform> params: array<GroupParams>;
What am I missing? Thank you.