shader-rt: initial

This commit is contained in:
firestar99
2025-08-14 15:35:21 +02:00
parent 7dc86b36ca
commit 6a0c07ab3e
10 changed files with 260 additions and 7 deletions

View File

@@ -0,0 +1,14 @@
use glam::{Vec2, Vec4};
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
const FULLSCREEN_VERTICES: [Vec2; 3] = [Vec2::new(-1., -1.), Vec2::new(-1., 3.), Vec2::new(3., -1.)];
#[spirv(vertex)]
pub fn fullscreen_vertex(#[spirv(vertex_index)] vertex_index: u32, #[spirv(position)] gl_position: &mut Vec4) {
// broken on edition 2024 branch
// let vertex = unsafe { *FULLSCREEN_VERTICES.index_unchecked(vertex_index as usize) };
let vertex = FULLSCREEN_VERTICES[vertex_index as usize];
*gl_position = Vec4::from((vertex, 0., 1.));
}

View File

@@ -4,6 +4,7 @@ pub mod adjust;
pub mod adjustments;
pub mod blending_nodes;
pub mod cubic_spline;
pub mod fullscreen_vertex;
#[cfg(feature = "std")]
pub mod curve;