3 ms·
Im fairly certain shaders can and do eliminate compile time if statements, you can observer this by seeing which uniforms are defined (for example in WebGL).
by AlphaSite 10y ago
Im fairly certain shaders can and do eliminate compile time if statements, you can observer this by seeing which uniforms are defined (for example in WebGL).
- nice_byte 10y agoYou mean if we write if (some_constant_expression) { //...code... } and some_constant_expression evaluates to false, the entire code block will be stripped from the result? That may be true, but it's not standardized behavior, is it?
- JoeAltmaier 10y agoTrue for many compilers for many years. Its a way to integrate 'conditional compilation' into the normal program flow. It can make the code easier (or harder) to read. Use judiciously.