Skip to content

Commit

Permalink
Add support for ifndef directive
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlansneff committed Aug 25, 2020
1 parent 409cff5 commit 1355128
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/bevy_render/src/shader/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ fn preprocess_internal(
});
None
}
("ifndef", Some(definition)) => {
stack.push(match runtime_defines.get(definition) {
Some(None) => true,
None if macros(definition).is_none() => true,
Some(Some(_)) | None => false,
});
None
}
("else", None) => {
if let Some(if_true) = stack.last_mut() {
*if_true = !*if_true;
Expand Down

0 comments on commit 1355128

Please sign in to comment.