1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use bytemuck::{Pod, Zeroable};

/// Different type of quad to render to depending on pass type
pub enum QuadType {
    /// Offscreen, intermediate passes.
    Offscreen,
    /// Final pass to render target.
    Final,
}

/// Identity MVP for use in intermediate passes.
#[rustfmt::skip]
pub static IDENTITY_MVP: &[f32; 16] = &[
    1.0, 0.0, 0.0, 0.0,
    0.0, 1.0, 0.0, 0.0,
    0.0, 0.0, 1.0, 0.0,
    0.0, 0.0, 0.0, 1.0,
];

/// Default MVP for use when rendering to the render target.
#[rustfmt::skip]
pub static DEFAULT_MVP: &[f32; 16] = &[
    2f32, 0.0, 0.0, 0.0,
    0.0, 2.0, 0.0, 0.0,
    0.0, 0.0, 0.0, 0.0,
    -1.0, -1.0, 0.0, 1.0,
];

/// The vertex inputs to a slang shader
///
/// See [IO interface variables](https://github.com/libretro/slang-shaders?tab=readme-ov-file#io-interface-variables)
#[repr(C)]
#[derive(Debug, Copy, Clone, Default, Zeroable, Pod)]
pub struct VertexInput {
    pub position: [f32; 4], // vec4 position
    pub texcoord: [f32; 2], // vec2 texcoord;
}