glsl: Slight change to the code generated by if-flattening
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 1 Aug 2011 20:55:46 +0000 (13:55 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 15 Aug 2011 18:44:26 +0000 (11:44 -0700)
commit4a026d6ba50034c326eb6cfd0b555f57d83ab609
tree2f3d490115a5ce1efbed52d0214d0b99c3e7a5d2
parent13df36ecb6c24ea36534fa0dfea917aca8233710
glsl: Slight change to the code generated by if-flattening

Now the condition (for the then-clause) and the inverse condition (for
the else-clause) get written to separate temporary variables.  In the
presence of complex conditions, this shouldn't result in more code
being generated.  If the original if-statement was

    if (a && b && c && d && e) {
        ...
    } else {
        ...
    }

The lowered code will be

   if_to_cond_assign_then = a && b && c && d && e;
   ...
   if_to_cond_assign_else = !if_to_cond_assign_then;
   ...

Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/lower_if_to_cond_assign.cpp