librashader-reflect 0.12.0

RetroArch shaders for all.
Documentation
use crate::error::ShaderReflectError;
use semantics::ShaderSemantics;

/// Reflection via spirv-cross.
#[cfg(feature = "cross")]
pub mod cross;

/// Reflection via naga.
#[cfg(feature = "naga")]
pub mod naga;

/// Shader semantics and reflection information.
pub mod semantics;

/// Reflection helpers for reflecting and compiling shaders as part of a shader preset.
pub mod presets;

mod helper;

/// A trait for compilation outputs that can provide reflection information.
pub trait ReflectShader {
    /// Reflect the shader as the given pass within the shader preset, against the provided
    /// semantic map.
    fn reflect(
        &mut self,
        pass_number: usize,
        semantics: &ShaderSemantics,
    ) -> Result<ShaderReflection, ShaderReflectError>;

    /// Validate the shader without doing reflection against a set of semantics.
    fn validate(&mut self) -> Result<(), ShaderReflectError>;
}

pub use semantics::ShaderReflection;

#[inline(always)]
/// Give a size aligned to 16 byte boundary
const fn align_uniform_size(size: u32) -> u32 {
    (size + 0xf) & !0xf
}