2021-06-05 18:40:33 -07:00
|
|
|
// Vertex shader bindings
|
|
|
|
|
|
|
|
struct VertexOutput {
|
2022-08-17 17:30:04 -07:00
|
|
|
@location(0) tex_coord: vec2<f32>,
|
|
|
|
@builtin(position) position: vec4<f32>,
|
|
|
|
}
|
2021-06-05 18:40:33 -07:00
|
|
|
|
2021-12-31 14:57:57 -08:00
|
|
|
struct Locals {
|
2022-08-17 17:30:04 -07:00
|
|
|
transform: mat4x4<f32>,
|
|
|
|
}
|
|
|
|
@group(0) @binding(2) var<uniform> r_locals: Locals;
|
2021-06-05 18:40:33 -07:00
|
|
|
|
2022-08-17 17:30:04 -07:00
|
|
|
@vertex
|
2021-06-27 11:09:29 -07:00
|
|
|
fn vs_main(
|
2022-08-17 17:30:04 -07:00
|
|
|
@location(0) position: vec2<f32>,
|
2021-06-27 11:09:29 -07:00
|
|
|
) -> VertexOutput {
|
2021-06-05 18:40:33 -07:00
|
|
|
var out: VertexOutput;
|
2021-12-31 15:40:12 -08:00
|
|
|
out.tex_coord = fma(position, vec2<f32>(0.5, -0.5), vec2<f32>(0.5, 0.5));
|
2021-06-27 11:09:29 -07:00
|
|
|
out.position = r_locals.transform * vec4<f32>(position, 0.0, 1.0);
|
2021-06-05 18:40:33 -07:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fragment shader bindings
|
|
|
|
|
2022-08-17 17:30:04 -07:00
|
|
|
@group(0) @binding(0) var r_tex_color: texture_2d<f32>;
|
|
|
|
@group(0) @binding(1) var r_tex_sampler: sampler;
|
2021-06-05 18:40:33 -07:00
|
|
|
|
2022-08-17 17:30:04 -07:00
|
|
|
@fragment
|
|
|
|
fn fs_main(@location(0) tex_coord: vec2<f32>) -> @location(0) vec4<f32> {
|
2021-06-05 18:40:33 -07:00
|
|
|
return textureSample(r_tex_color, r_tex_sampler, tex_coord);
|
|
|
|
}
|