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

add boolean expression parser to disable programs #2324

Merged
merged 2 commits into from
May 27, 2024

Conversation

fayer3
Copy link
Contributor

@fayer3 fayer3 commented May 14, 2024

fixes #1026

adds a boolean expression parser. it might not be the best implementation, but it works from my testing.

the parser uses 2 Stacks, one for operations andone for the parsed values.
expressinos are read front to back, and evaluated back to front.
brackets and && chains are evaluated once they close/end

Copy link
Member

@douira douira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the negation handling is a little funky and I have a few minor nitpicks but it looks good to me overall! Thanks for the work.

@IMS212
Copy link
Member

IMS212 commented May 15, 2024

There's a important question here; what's stopping JCPP from automatically doing all of this?

@fayer3
Copy link
Contributor Author

fayer3 commented May 15, 2024

jcpp only replaces the options
afaik it only evaluates boolen expressions in #ifs

@fayer3
Copy link
Contributor Author

fayer3 commented May 15, 2024

you could maybe do some regex to convert

program.X.enabled=A && B || C

to

#if !(defined A && defined B || defined C)
program.X.enabled=false
#endif

that should then work with jcpp

@IMS212
Copy link
Member

IMS212 commented May 27, 2024

Thanks!

@IMS212 IMS212 merged commit 4f92841 into IrisShaders:1.20.3 May 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shaders.properties program toggles are not supported
3 participants