// The `VertexInput` location numbers match the numbers in // `vertexBufferLayouts` struct VertexInput { @location(0) position: vec3f, @location(1) texture: vec2f, @location(2) normal: vec3f, }; // location numbers for passing values from the vertex stage to the // fragment stage are arbitrary--they just need to match. Because // fragmentMain uses the same VertexOutput struct that vertexMain // returns, they do match. struct VertexOutput { @builtin(position) position: vec4f, @location(0) texture: vec2f, }; @vertex fn vertexMain(input: VertexInput) -> VertexOutput { let position = vec4f(input.position * 0.5, 1.0); var output: VertexOutput; output.position = position; output.texture = input.texture; return output; } @fragment fn fragmentMain(input: VertexOutput) -> @location(0) vec4f { return vec4(input.texture, 0.0, 1.0); }