shaders-rt: explain fullscreen_vertex coordinates with a drawing

This commit is contained in:
firestar99
2025-09-05 00:23:23 +02:00
parent 7c7fea2e32
commit aba44eb676

View File

@@ -3,6 +3,21 @@ use spirv_std::spirv;
/// webgpu NDC is like OpenGL: (-1.0 .. 1.0, -1.0 .. 1.0, 0.0 .. 1.0)
/// https://www.w3.org/TR/webgpu/#coordinate-systems
///
/// So to make a fullscreen triangle around a box at (-1..1):
///
/// ```norun
/// 3 +
/// |\
/// 2 | \
/// | \
/// 1 +-----+
/// | |\
/// 0 | 0 | \
/// | | \
/// -1 +-----+-----+
/// -1 0 1 2 3
/// ```
const FULLSCREEN_VERTICES: [Vec2; 3] = [Vec2::new(-1., -1.), Vec2::new(-1., 3.), Vec2::new(3., -1.)];
#[spirv(vertex)]