From 81840a9e9c61b5ebb119544ebd25cd68f88bd079 Mon Sep 17 00:00:00 2001 From: chyyran Date: Tue, 17 Sep 2024 18:25:42 -0400 Subject: [PATCH] reflect: insert alias semantics for shader name through pragma --- librashader-reflect/src/reflect/presets.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/librashader-reflect/src/reflect/presets.rs b/librashader-reflect/src/reflect/presets.rs index 644d8cb..1cbee0a 100644 --- a/librashader-reflect/src/reflect/presets.rs +++ b/librashader-reflect/src/reflect/presets.rs @@ -105,9 +105,11 @@ where }) .collect::)>, E>>()?; - for details in &passes { - insert_pass_semantics(&mut uniform_semantics, &mut texture_semantics, &details.0) + for (config, source, _) in &passes { + insert_pass_semantics(&mut uniform_semantics, &mut texture_semantics, config.alias.as_ref(), config.id as usize); + insert_pass_semantics(&mut uniform_semantics, &mut texture_semantics, source.name.as_ref(), config.id as usize); } + insert_lut_semantics(textures, &mut uniform_semantics, &mut texture_semantics); let semantics = ShaderSemantics { @@ -122,9 +124,10 @@ where fn insert_pass_semantics( uniform_semantics: &mut FastHashMap, texture_semantics: &mut FastHashMap>, - config: &ShaderPassConfig, + alias: Option<&ShortString>, + index: usize, ) { - let Some(alias) = &config.alias else { + let Some(alias) = alias else { return; }; @@ -133,8 +136,6 @@ fn insert_pass_semantics( return; } - let index = config.id as usize; - // PassOutput texture_semantics.insert( alias.clone(),