I'm following this WebGPU tutorial, and I copied the below shader code (shader.wgsl, full file is here):
// vertex shader
struct Output {
@builtin(position) Position : vec4<f32>; // <-- error in this line
@location(0) vColor : vec4<f32>;
};
I get an error in the dev console saying:
Tint WGSL reader failure: :4:44 error: expected '}' for struct declaration
@builtin(position) Position : vec4<f32>;
Is this an error with the actual code, or with the way I'm loading it? I'm using ts-shader-loader because I'm inside an Angular/TypeScript application.
The way I'm using the shader.wgsl file can be seen here.
Any pointers as to what might be going wrong would be highly appreciated!
structure fields in WGSL end with ,
not with ;
struct Output {
@builtin(position) Position : vec4<f32>,
@location(0) vColor : vec4<f32>,
};