glsl: Reinstate constant-folding for division by zero
authorChad Versace <chad.versace@intel.com>
Mon, 14 Feb 2011 21:22:39 +0000 (13:22 -0800)
committerChad Versace <chad.versace@intel.com>
Tue, 15 Feb 2011 23:46:12 +0000 (15:46 -0800)
commit62c8c773334c1b0cdd484997a4ccec8945713f8c
tree68b0571305f048a81baae296f26ecbbf65d0c20f
parentf2e9981e43b26ca101b774ea6af1f00617098246
glsl: Reinstate constant-folding for division by zero

Fixes regression: https://bugs.freedesktop.org/show_bug.cgi?id=34160

Commit e7c1f058d18f62aa4871aec623f994d7b68cb8c1 disabled constant-folding
when division-by-zero occured. This was a mistake, because the spec does
allow division by zero. (From section 5.9 of the GLSL 1.20 spec: Dividing
by zero does not cause an exception but does result in an unspecified
value.)

For floating-point division, the original pre-e7c1f05 behavior is
reinstated.

For integer division, constant-fold 1/0 to 0.
src/glsl/ir_constant_expression.cpp