Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - bevy_render2: Add support for #else for shader defs #3206

Closed
wants to merge 3 commits into from

Conversation

superdump
Copy link
Contributor

Objective

  • Add support for #else for shader defs

Solution

  • When entering a scope with #ifdef or #ifndef, if the parent scope is truthy, and the shader definition is also truthy, then the a new scope is pushed onto the scope stack that is also truthy, else falsy. When encountering a subsequent else clause within a scope, if the parent is truthy and the current scope is truthy, then it should become falsy. If the parent scope is truthy and the current scope is falsy then it should become truthy. If the parent scope is falsy, then the current scope should remain falsy as the parent scope takes precedent.
  • I added a simple test for an else case.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Nov 27, 2021
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible S-Needs-Review and removed S-Needs-Triage This issue needs to be labelled labels Nov 27, 2021
@cart
Copy link
Member

cart commented Dec 2, 2021

looks good to me!

@cart
Copy link
Member

cart commented Dec 2, 2021

bors r+

bors bot pushed a commit that referenced this pull request Dec 2, 2021
# Objective

- Add support for `#else` for shader defs

## Solution

- When entering a scope with `#ifdef` or `#ifndef`, if the parent scope is truthy, and the shader definition is also truthy, then the a new scope is pushed onto the scope stack that is also truthy, else falsy. When encountering a subsequent else clause within a scope, if the parent is truthy and the current scope is truthy, then it should become falsy. If the parent scope is truthy and the current scope is falsy then it should become truthy. If the parent scope is falsy, then the current scope should remain falsy as the parent scope takes precedent.
- I added a simple test for an else case.
@bors bors bot changed the title bevy_render2: Add support for #else for shader defs [Merged by Bors] - bevy_render2: Add support for #else for shader defs Dec 2, 2021
@bors bors bot closed this Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants