rg/vaja_1/shader.wgsl
2024-11-22 18:15:18 +01:00

39 lines
689 B
WebGPU Shading Language

struct VertexInput {
@location(0) position: vec4f,
@location(1) color: vec4f,
}
struct VertexOutput {
@builtin(position) position: vec4f,
@location(0) color: vec4f,
}
struct FragmentInput {
@location(0) color: vec4f,
}
struct FragmentOutput {
@location(0) color: vec4f,
}
@group(0) @binding(0) var<uniform> mtrx: mat4x4f;
@vertex
fn vertex(input: VertexInput) -> VertexOutput {
var output: VertexOutput;
output.position = mtrx * input.position;
output.color = input.color;
return output;
}
@fragment
fn fragment(input: FragmentInput) -> FragmentOutput {
var output: FragmentOutput;
output.color = input.color;
return output;
}