37 lines
640 B
Plaintext
37 lines
640 B
Plaintext
|
|
#[set(everything)]
|
|
const constants: {
|
|
P: float4x4;
|
|
pos: float4; // xywh
|
|
col: float4;
|
|
};
|
|
|
|
struct vert_in {
|
|
pos: float2;
|
|
}
|
|
|
|
struct vert_out {
|
|
pos: float4;
|
|
col: float4;
|
|
}
|
|
|
|
fun draw_colored_vert(input: vert_in): vert_out {
|
|
var output: vert_out;
|
|
output.pos = float4(input.pos, 0.0, 1.0);
|
|
output.pos.xy = output.pos.xy * constants.pos.zw + constants.pos.xy;
|
|
output.pos.xy = output.pos.xy * 2.0 - 1.0;
|
|
output.pos.y = -output.pos.y;
|
|
output.col = constants.col;
|
|
return output;
|
|
}
|
|
|
|
fun draw_colored_frag(input: vert_out): float4 {
|
|
return input.col;
|
|
}
|
|
|
|
#[pipe]
|
|
struct pipe {
|
|
vertex = draw_colored_vert;
|
|
fragment = draw_colored_frag;
|
|
}
|