2022-10-31 20:29:25 -04:00
|
|
|
use crate::error::{ShaderReflectError};
|
2022-10-27 20:39:39 -04:00
|
|
|
use crate::reflect::semantics::{
|
2022-11-07 00:25:11 -05:00
|
|
|
SemanticMap, TextureImage, TextureSemantics, TextureSizeMeta, VariableMeta,
|
2022-10-27 20:39:39 -04:00
|
|
|
VariableSemantics,
|
|
|
|
};
|
2022-10-25 22:13:39 -04:00
|
|
|
use rustc_hash::FxHashMap;
|
2022-10-23 23:22:26 -04:00
|
|
|
|
2022-11-07 00:25:11 -05:00
|
|
|
pub mod cross;
|
2022-10-23 02:36:41 -04:00
|
|
|
mod naga;
|
2022-10-25 22:13:39 -04:00
|
|
|
mod rspirv;
|
2022-10-27 02:22:44 -04:00
|
|
|
pub mod semantics;
|
2022-10-23 23:22:26 -04:00
|
|
|
|
|
|
|
pub trait ReflectShader {
|
2022-11-07 00:25:11 -05:00
|
|
|
fn reflect(&mut self, pass_number: u32, semantics: &ReflectSemantics) -> Result<ShaderReflection, ShaderReflectError>;
|
2022-10-23 23:22:26 -04:00
|
|
|
}
|
2022-10-25 22:13:39 -04:00
|
|
|
|
2022-10-26 01:19:04 -04:00
|
|
|
#[derive(Debug)]
|
2022-10-25 22:13:39 -04:00
|
|
|
pub enum UniformSemantic {
|
|
|
|
Variable(SemanticMap<VariableSemantics>),
|
2022-10-27 02:22:44 -04:00
|
|
|
Texture(SemanticMap<TextureSemantics>),
|
2022-10-25 22:13:39 -04:00
|
|
|
}
|
|
|
|
|
2022-10-26 01:19:04 -04:00
|
|
|
#[derive(Debug)]
|
2022-11-07 00:25:11 -05:00
|
|
|
pub struct ReflectSemantics {
|
2022-10-25 22:13:39 -04:00
|
|
|
pub uniform_semantics: FxHashMap<String, UniformSemantic>,
|
2022-10-26 01:19:04 -04:00
|
|
|
pub non_uniform_semantics: FxHashMap<String, SemanticMap<TextureSemantics>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct ReflectMeta {
|
|
|
|
pub parameter_meta: FxHashMap<u32, VariableMeta>,
|
|
|
|
pub variable_meta: FxHashMap<VariableSemantics, VariableMeta>,
|
2022-10-27 02:22:44 -04:00
|
|
|
pub texture_meta: FxHashMap<SemanticMap<TextureSemantics>, TextureImage>,
|
|
|
|
pub texture_size_meta: FxHashMap<SemanticMap<TextureSemantics>, TextureSizeMeta>,
|
2022-10-25 22:13:39 -04:00
|
|
|
}
|
|
|
|
|
2022-11-07 00:25:11 -05:00
|
|
|
pub use semantics::ShaderReflection;
|