2022-11-11 17:44:41 +11:00
|
|
|
use crate::error::ShaderReflectError;
|
2022-12-01 17:50:16 +11:00
|
|
|
use semantics::ShaderSemantics;
|
2022-10-24 14:22:26 +11:00
|
|
|
|
2022-12-01 17:50:16 +11:00
|
|
|
/// Reflection via spirv-cross.
|
2022-11-07 16:25:11 +11:00
|
|
|
pub mod cross;
|
2022-11-22 08:21:50 +11:00
|
|
|
|
2022-12-01 17:50:16 +11:00
|
|
|
/// Shader semantics and reflection information.
|
2022-11-22 08:21:50 +11:00
|
|
|
pub mod semantics;
|
|
|
|
|
2023-01-19 13:58:13 +11:00
|
|
|
/// Reflection helpers for reflecting and compiling shaders as part of a shader preset.
|
|
|
|
pub mod presets;
|
|
|
|
|
2023-01-16 10:36:38 +11:00
|
|
|
mod helper;
|
|
|
|
|
2024-02-11 10:54:57 +11:00
|
|
|
#[cfg(feature = "naga")]
|
2023-12-13 11:02:49 +11:00
|
|
|
pub mod naga;
|
2022-10-24 14:22:26 +11:00
|
|
|
|
2022-12-01 17:50:16 +11:00
|
|
|
/// A trait for compilation outputs that can provide reflection information.
|
2022-10-24 14:22:26 +11:00
|
|
|
pub trait ReflectShader {
|
2022-12-01 17:50:16 +11:00
|
|
|
/// Reflect the shader as the given pass within the shader preset, against the provided
|
|
|
|
/// semantic map.
|
2022-11-11 17:44:41 +11:00
|
|
|
fn reflect(
|
|
|
|
&mut self,
|
2022-11-20 10:48:54 +11:00
|
|
|
pass_number: usize,
|
2022-12-01 17:50:16 +11:00
|
|
|
semantics: &ShaderSemantics,
|
2022-11-11 17:44:41 +11:00
|
|
|
) -> Result<ShaderReflection, ShaderReflectError>;
|
2022-10-24 14:22:26 +11:00
|
|
|
}
|
2022-10-26 13:13:39 +11:00
|
|
|
|
2022-11-11 17:44:41 +11:00
|
|
|
pub use semantics::ShaderReflection;
|
2022-11-27 15:57:01 +11:00
|
|
|
|
|
|
|
#[inline(always)]
|
|
|
|
/// Give a size aligned to 16 byte boundary
|
|
|
|
const fn align_uniform_size(size: u32) -> u32 {
|
|
|
|
(size + 0xf) & !0xf
|
2022-11-30 17:38:05 +11:00
|
|
|
}
|