Skip to content

Commit

Permalink
reflect: insert alias semantics for shader name through pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Sep 17, 2024
1 parent 87e0405 commit 81840a9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions librashader-reflect/src/reflect/presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ where
})
.collect::<Result<Vec<(ShaderPassConfig, ShaderSource, CompilerBackend<_>)>, 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 {
Expand All @@ -122,9 +124,10 @@ where
fn insert_pass_semantics(
uniform_semantics: &mut FastHashMap<ShortString, UniformSemantic>,
texture_semantics: &mut FastHashMap<ShortString, Semantic<TextureSemantics>>,
config: &ShaderPassConfig,
alias: Option<&ShortString>,
index: usize,
) {
let Some(alias) = &config.alias else {
let Some(alias) = alias else {
return;
};

Expand All @@ -133,8 +136,6 @@ fn insert_pass_semantics(
return;
}

let index = config.id as usize;

// PassOutput
texture_semantics.insert(
alias.clone(),
Expand Down

0 comments on commit 81840a9

Please sign in to comment.