summaryrefslogtreecommitdiffstats
path: root/third_party/rust/naga/src/front/mod.rs
blob: cb543c72a9d661ced8b7ad2eb4514828e7cc5f44 (plain)
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
//! Parsers which load shaders into memory.

#[cfg(feature = "glsl-in")]
pub mod glsl;
#[cfg(feature = "spv-in")]
pub mod spv;
#[cfg(feature = "wgsl-in")]
pub mod wgsl;

use crate::arena::Arena;

pub const GENERATOR: u32 = 0;

impl crate::Module {
    pub fn from_header(header: crate::Header) -> Self {
        crate::Module {
            header,
            types: Arena::new(),
            constants: Arena::new(),
            global_variables: Arena::new(),
            functions: Arena::new(),
            entry_points: crate::FastHashMap::default(),
        }
    }

    pub fn generate_empty() -> Self {
        Self::from_header(crate::Header {
            version: (1, 0, 0),
            generator: GENERATOR,
        })
    }
}