#ifdef-Code generated by Static Switch
Posted: Mon Mar 26, 2018 5:20 pm
Hi!
Is there any hope for an implementation of the Static Switch, that would handle the #ifdef / #else -scopes generated like in the image that has been attached to this post? (Please see the image)
Currently the Static Switch is generating code that will only enable the selection of two different data-paths, while they both still get calculated, which can certainly be useful, but not sufficiently so, if you would like to enable/disable certain features of your shader per material, and so avoid extra calculations where they might be useless.
I know that the example in the image is completely imaginary for usefulness, but I tested it in a real world case as well, with proper features being enabled/disabled - and it does the same thing. The generated code calculates *everything* to be ready for either data-path, but only #ifdef:s the final decision between which data to use, which does not optimize the code at all.
Is there any hope for an implementation of the Static Switch, that would handle the #ifdef / #else -scopes generated like in the image that has been attached to this post? (Please see the image)
Currently the Static Switch is generating code that will only enable the selection of two different data-paths, while they both still get calculated, which can certainly be useful, but not sufficiently so, if you would like to enable/disable certain features of your shader per material, and so avoid extra calculations where they might be useless.
I know that the example in the image is completely imaginary for usefulness, but I tested it in a real world case as well, with proper features being enabled/disabled - and it does the same thing. The generated code calculates *everything* to be ready for either data-path, but only #ifdef:s the final decision between which data to use, which does not optimize the code at all.