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

Extact "mattered" macro list from shader source #2094

Open
Sway007 opened this issue May 11, 2024 · 0 comments
Open

Extact "mattered" macro list from shader source #2094

Sway007 opened this issue May 11, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request shader Shader related functions

Comments

@Sway007
Copy link
Member

Sway007 commented May 11, 2024

Why

Extracting all "mattered" macros from the shader source code helps avoid unnecessary compilation of shader variants.


The definition for "mattered" macro in version 1.3 is simple: macros defined after #if, #ifdef, #ifndef, and defined operator.

The macros defined by the above standards are not actually "mattered" macros. For example, the following conditional macro expansion is a variable declaration, but it may not be referenced by the entry main function, so it should not be defined as a "mattered" macro.

\#ifdef SOME_DEFINED_MACRO
    float useless_variable;
\#endif

Future optimization

TODO: Use a seperate compiler to analyze and extract the real list of all "mattered" macros after Shader.create but before shader variant compilation.

@Sway007 Sway007 self-assigned this May 11, 2024
@Sway007 Sway007 added enhancement New feature or request shader Shader related functions labels May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request shader Shader related functions
Projects
None yet
Development

No branches or pull requests

1 participant