Created attachment 42941 [details] [review] Fix for bug. Summary ------- In GLSL < 1.30, operators % and %= are reserved, but the compiler accepts them anyway. Attached is a fix for the bug. Open Question ------------- Should this bug be fixed? Fixing it may break applications that rely on this "feature". Detail ------ For operator %, see section 5.9 of the GLSL ES 1.00, GLSL 1.10, and GLSL 1.20 spec. For operator %=, see section 5.8 of the GLSL ES 1.00, GLSL 1.10, and GLSL 1.20 spec. Piglit Tests ------------ spec/glsl-1.00/compiler/arithmetic-operators/modulus-00.frag spec/glsl-1.10/compiler/arithmetic-operators/modulus-00.frag spec/glsl-1.20/compiler/arithmetic-operators/modulus-00.frag spec/glsl-1.00/compiler/assignment-operators/modulus-assign-00.frag spec/glsl-1.10/compiler/assignment-operators/modulus-assign-00.frag spec/glsl-1.20/compiler/assignment-operators/modulus-assign-00.frag
We should definitely fix this. We don't want to encourage apps to assume that out-of-spec code will work. I think the version check should be done in modulus_result_type. This matches the way other 1.30 operators (e.g., the bit-wise operators) are handled.
Marking FIXED. Ian, I followed your advice and placed the code in modulus_result_type(). Fixed by the following commit: commit 82f994f3860ca05ff5550f32844b0f523d40b9ef Author: Chad Versace <chad.versace@intel.com> Date: Fri Feb 4 12:18:56 2011 -0800 glsl: Set operators '%' and '%=' to be reserved when GLSL < 1.30
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.