27 lines
564 B
WebGPU Shading Language
27 lines
564 B
WebGPU Shading Language
struct VertexInput {
|
|
@location(0) position: vec4f,
|
|
@location(1) color: vec4f,
|
|
};
|
|
|
|
struct Uniforms {
|
|
u_projection: mat4x4f,
|
|
u_view: mat4x4f,
|
|
u_world: mat4x4f,
|
|
};
|
|
|
|
@group(0) @binding(0)
|
|
var<uniform> uniforms: Uniforms;
|
|
|
|
struct VertexOutput {
|
|
@builtin(position) position: vec4f,
|
|
@location(0) v_color: vec4f,
|
|
};
|
|
|
|
@vertex
|
|
fn main(input: VertexInput) -> VertexOutput {
|
|
var out: VertexOutput;
|
|
out.position = uniforms.u_projection * uniforms.u_view * uniforms.u_world * input.position;
|
|
out.v_color = input.color;
|
|
return out;
|
|
}
|
|
|