Can I see shader preprocessor output?
I am using #defines, which I pass runtime to my shader sources based on program state, to optimize my huge shaders to be less complex. I would like to write the optimized shader to a file so that next time I run my program, I do not have to pass the #defines again, but I can straight compile the optimized shaders during program startup because now I know what kind of shaders by program needs.
Is there a way to get the result from shader preprocessor? I can of course store the #define values to a file and based on that compile the shaders during program startup but that would not be as elegant.
Preprocess the shader source using a C preprocessor.
For example, GCC have an option for preprocess only the source, and save the intermediate result in another file, using the option for defining preprocessor symbols, you will get the wanted result.