mesa: 596684eb93067f5281ce7c32123a7f009c8a98c6 (master) piglit glsl-const-builtin-inversesqrt now fails on swrast, softpipe, and llvmpipe but previously passed. $ shader_runner glsl-const-builtin-inversesqrt.shader_test Failed to compile FS: 0:7(38): error: initializer of const variable `undef1' must be a constant expression 0:8(39): error: initializer of const variable `undef2' must be a constant expression PIGLIT: {'result': 'fail' }
e7c1f058d18f62aa4871aec623f994d7b68cb8c1 is the first bad commit commit e7c1f058d18f62aa4871aec623f994d7b68cb8c1 Author: Chad Versace <chad.versace@intel.com> Date: Tue Feb 1 10:14:28 2011 -0800 glsl: Avoid division-by-zero during constant-folding Avoid division-by-zero when constant-folding the following expression types: ir_unop_rsq ir_binop_div ir_binop_mod Fixes bugs: https://bugs.freedesktop.org//show_bug.cgi?id=33306 https://bugs.freedesktop.org//show_bug.cgi?id=33508 Fixes Piglit tests: glslparsertest/glsl2/div-by-zero-01.frag glslparsertest/glsl2/div-by-zero-02.frag glslparsertest/glsl2/div-by-zero-03.frag glslparsertest/glsl2/modulus-zero-01.frag glslparsertest/glsl2/modulus-zero-02.frag NOTE: This is a candidate for the 7.9 and 7.10 branches. :040000 040000 b58b41754aff93d01fbf81c552b40e59801ea67c 226e21904666b0f43eac705ca1ffdaafd693fbb6 M src bisect run success
We had discussed this commit on the mailing list (see http://marc.info/?l=mesa3d-dev&m=129668262525334&w=2), and I thought Chad was going to fix. That doesn't seem to have happened yet.
This passes on my side with i965 and swrast: const float undef2 = inversesqrt(-1.0);
Attached are two patches that I wish to commit. One fixes this bug, the other is closely related. Please review them. I wish to know if: 1) They cause any other regressions. 2) They produce the constant-folding behavior we desire.
Created attachment 43355 [details] [review] Path 1/2: Reverts bad commit
Created attachment 43356 [details] [review] Patch 2/2: Fix bug
Marking RESOLVED/FIXED. Fixed by: commit 62c8c773334c1b0cdd484997a4ccec8945713f8c Author: Chad Versace <chad.versace@intel.com> Date: Mon Feb 14 13:22:39 2011 -0800 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.
It passes on my side with the fixed commit.
mesa: 120d71a45cfda1edfa8cd6b1732e209eb98b53d8 (master) Verified fixed.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.