Currently, a struct has to be used to specify inputs and outputs.
[nzsl_version("1.1")]
module;
const vertPos = array[vec2[f32]](
vec2[f32](-1.0, -3.0),
vec2[f32](-1.0, 1.0),
vec2[f32]( 3.0, 1.0)
);
struct Input
{
[builtin(vertex_index)] vert_index: i32
}
struct Output
{
[builtin(position)] pos: vec4[f32]
}
[entry(vert)]
fn main(input: Input) -> Output
{
let output: Output;
output.pos = vec4[f32](position, 0.0, 1.0);
return output;
}
To simplify code we could allow some simpler syntax, perhaps something like
[entry(vert)]
fn main(vert_index: i32 @vertex_index) -> vec4[f32] @position
{
return vec4[f32](position, 0.0, 1.0);
}
However this syntax is pretty heavy and will make the parser/AST more complex to support attributes on parameters and return type, does anyone have a better idea?
Currently, a struct has to be used to specify inputs and outputs.
To simplify code we could allow some simpler syntax, perhaps something like
However this syntax is pretty heavy and will make the parser/AST more complex to support attributes on parameters and return type, does anyone have a better idea?