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

Updated handling of defines specified by a shader definition #6253

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Apr 15, 2024

Change #6250 introduced shader handling a map of includes and defines. The defines map was directly passed to the preprocessor, which used it internally when handling #ifdef type of code.
As our preprocessor does not handle generic defines, for example #define LOD_LEVEL 4 which can then be used anywhere in the following code, the implementation has changed to allow this.

This PR converts all defines specified in the define map to source code, and this is attached to the shader source code directly. This allows us to pass on processing of those defines to the actual platforms that compiles the shader.

@mvaligursky
Copy link
Contributor Author

The problem this does not solve is the fact that WGSL does not support #defined directives. And so it does not help with that. We will need a different solution in the future there.

@mvaligursky mvaligursky self-assigned this Apr 15, 2024
@mvaligursky mvaligursky added area: graphics Graphics related issue enhancement labels Apr 15, 2024
@mvaligursky mvaligursky merged commit 2a136a0 into main Apr 15, 2024
7 checks passed
@mvaligursky mvaligursky deleted the mv-shader-defines-handling branch April 15, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants