librashader_runtime/
quad.rs

1use bytemuck::{Pod, Zeroable};
2
3/// Different type of quad to render to depending on pass type
4pub enum QuadType {
5    /// Offscreen, intermediate passes.
6    Offscreen,
7    /// Final pass to render target.
8    Final,
9}
10
11/// Identity MVP for use in intermediate passes.
12#[rustfmt::skip]
13pub static IDENTITY_MVP: &[f32; 16] = &[
14    1.0, 0.0, 0.0, 0.0,
15    0.0, 1.0, 0.0, 0.0,
16    0.0, 0.0, 1.0, 0.0,
17    0.0, 0.0, 0.0, 1.0,
18];
19
20/// Default MVP for use when rendering to the render target.
21#[rustfmt::skip]
22pub static DEFAULT_MVP: &[f32; 16] = &[
23    2f32, 0.0, 0.0, 0.0,
24    0.0, 2.0, 0.0, 0.0,
25    0.0, 0.0, 0.0, 0.0,
26    -1.0, -1.0, 0.0, 1.0,
27];
28
29/// The vertex inputs to a slang shader
30///
31/// See [IO interface variables](https://github.com/libretro/slang-shaders?tab=readme-ov-file#io-interface-variables)
32#[repr(C)]
33#[derive(Debug, Copy, Clone, Default, Zeroable, Pod)]
34pub struct VertexInput {
35    pub position: [f32; 4], // vec4 position
36    pub texcoord: [f32; 2], // vec2 texcoord;
37}