27 lines
559 B
WebGPU Shading Language
27 lines
559 B
WebGPU Shading Language
struct VertexOutput {
|
|
@location(0) color: vec3<f32>,
|
|
@builtin(position) position: vec4<f32>
|
|
};
|
|
|
|
struct Locals {
|
|
transform: mat4x4<f32>
|
|
};
|
|
|
|
@group(0) @binding(0)
|
|
var r_locals: Locals;
|
|
|
|
@vertex
|
|
fn vs_main(
|
|
@location(0) position: vec4<f32>,
|
|
@location(1) color: vec3<f32>,
|
|
) -> VertexOutput {
|
|
var out: VertexOutput;
|
|
out.color = color;
|
|
out.position = r_locals.transform * position;
|
|
return out;
|
|
}
|
|
|
|
@fragment
|
|
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
|
return vec4<f32>(in.color.r, in.color.g, in.color.b, 1.0);
|
|
} |