librashader_reflect/reflect/
mod.rs

1use crate::error::ShaderReflectError;
2use semantics::ShaderSemantics;
3
4/// Reflection via spirv-cross.
5pub mod cross;
6
7/// Shader semantics and reflection information.
8pub mod semantics;
9
10/// Reflection helpers for reflecting and compiling shaders as part of a shader preset.
11pub mod presets;
12
13mod helper;
14
15/// Reflection via naga.
16#[cfg(feature = "naga")]
17pub mod naga;
18
19/// A trait for compilation outputs that can provide reflection information.
20pub trait ReflectShader {
21    /// Reflect the shader as the given pass within the shader preset, against the provided
22    /// semantic map.
23    fn reflect(
24        &mut self,
25        pass_number: usize,
26        semantics: &ShaderSemantics,
27    ) -> Result<ShaderReflection, ShaderReflectError>;
28
29    /// Validate the shader without doing reflection against a set of semantics.
30    fn validate(&mut self) -> Result<(), ShaderReflectError>;
31}
32
33pub use semantics::ShaderReflection;
34
35#[inline(always)]
36/// Give a size aligned to 16 byte boundary
37const fn align_uniform_size(size: u32) -> u32 {
38    (size + 0xf) & !0xf
39}