Skip to content

Commit

Permalink
non-scope defs are effective (#67)
Browse files Browse the repository at this point in the history
fixes bevyengine/bevy#10533

shader defs used only in literal substitutions (`#MY_DEF` or
`#{MY_DEF}`) were not counted towards the module's effective defs, so
were not validated when looking for an existing cached version of the
module.

add them to effective defs.
  • Loading branch information
robtfm authored Nov 16, 2023
1 parent 36a28a2 commit 7e05963
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/compose/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ impl Preprocessor {
return Err(ComposerErrorInner::DefineInModule(offset));
}
} else {
for cap in self
.def_regex
.captures_iter(&line)
.chain(self.def_regex_delimited.captures_iter(&line))
{
effective_defs.insert(cap.get(1).unwrap().as_str().to_owned());
}

substitute_identifiers(&line, offset, &declared_imports, &mut used_imports, true)
.unwrap();
}
Expand Down

0 comments on commit 7e05963

Please sign in to comment.