Support for inferred typed arrays
greggman opened this issue · 3 comments
greggman commented
the current version doesn't like this style of array declaration
@vertex fn vs(@builtin(vertex_index) vertexIndex : u32) -> @builtin(position) vec4f {
let pos = array(
vec2f( 0.0, 0.5), // top center
vec2f(-0.5, -0.5), // bottom left
vec2f( 0.5, -0.5) // bottom right
);
return vec4f(pos[vertexIndex], 0.0, 1.0);
}
array
works as a constructor if all the arguments are of the same type so in the case above, the type of pos
is inferred as array<vec2<f32>, 3>
. I'm not sure wgsl_reflect has to figure that out but it probably needs to parse the expression.
brendan-duncan commented
I'll get this added.
brendan-duncan commented
Made it at least not error parsing. I still need to have it update the reflection info for inferred arrays, but I don't think inferred arrays would be used in a place that needs reflection info.
greggman commented
thanks Brendan!