mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
shader-rt: initial
This commit is contained in:
14
node-graph/graster-nodes/src/fullscreen_vertex.rs
Normal file
14
node-graph/graster-nodes/src/fullscreen_vertex.rs
Normal 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.));
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user