Shader_Minifier
Shader_Minifier copied to clipboard
Add #define logic
Hello,
The minifier doesn't consider #define/#undef and doesn't optimize #if blocks
Example input:
#define MUT_0
#undef MUT_1
float f(){
float r = 1.;
#ifdef MUT_0
r = mut0(r);
#endif
#ifdef MUT_1
r = mut1(r);
#endif
return r;
}
1.3.1 gives:
#define MUT_0
#undef MUT_1
float M(){float M=1.;
#ifdef MUT_0
M=mut0(M);
#endif
#ifdef MUT_1
M=mut1(M);
#endif
return M;}
So it would make sense to preserve #if blocks only if there are no corresponding #define/#undef statements and process them if they are present
Thanks for the idea, that would be nice to have, indeed.
@laurentlb Thank you! Also would it be possible to specify defines as arguments (to skip having #defines in code)? Like so -d SOME_DEF -d DEF_WITH_VALUE=1
Yeah, that would make sense.