Summary: | [GLSL] fail to redeclare an array using initializer | ||
---|---|---|---|
Product: | Mesa | Reporter: | Gordon Jin <gordon.jin> |
Component: | glsl-compiler | Assignee: | Ian Romanick <idr> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | medium | ||
Version: | 7.10 | ||
Hardware: | All | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | new piglit test case |
Description
Gordon Jin
2011-02-16 23:33:27 UTC
Created attachment 43475 [details]
new piglit test case
The IR generated for this shader is clearly bogus. Note the lack of any assignment to the array 'a'. (function main (signature void (parameters ) ( (declare () (array float 2) a@0x10589f0) (if (expression bool all_equal (array_ref (var_ref a@0x10589f0) (constant int (1)) ) (constant float (1.000000)) ) ( (assign (xyzw) (var_ref gl_FragColor@0xf120c0) (constant vec4 (0.000000 1.000000 0.000000 1.000000)) ) ) ( (assign (xyzw) (var_ref gl_FragColor@0xf120c0) (constant vec4 (1.000000 0.000000 0.000000 1.000000)) ) )) )) ) ast_declarator_list::hir generates a new variable, creates the initializer code, then checks to see of it is a redeclaration. If it is a redeclaration, the initializer code (which is initializing the new variable), gets thrown away. This seems fairly straightforward to fix, but it will require some restructuring of the code. Fixed on master by the following patch series. I'm leaving the bug open until the fixes are cherry picked to the stable branches. commit 09a4ba0fc31fa8fc193dfb7b4fd78e32722b8312 Author: Ian Romanick <ian.d.romanick@intel.com> Date: Fri Mar 4 16:15:20 2011 -0800 glsl: Process redeclarations before initializers If an array redeclaration includes an initializer, the initializer would previously be dropped on the floor. Instead, directly apply the initializer to the correct ir_variable instance and append the generated instructions. Fixes bugzilla #34374 and piglit tests glsl-{vs,fs}-array-redeclaration. NOTE: This is a candidate for stable release branches. 0292ffb8 and 8e6cb9fe are also necessary. commit 0292ffb85c03e9fa15b9395e3875109dd8979292 Author: Ian Romanick <ian.d.romanick@intel.com> Date: Fri Mar 4 15:29:33 2011 -0800 glsl: Refactor AST-to-HIR code handling variable initializers commit 8e6cb9fe51a2237e51b47198eb7d46b14ad288b5 Author: Ian Romanick <ian.d.romanick@intel.com> Date: Fri Mar 4 15:28:40 2011 -0800 glsl: Refactor AST-to-HIR code handling variable redeclarations Fixed in 7.10 (856a661d2fa1936d81c3c2b50f2ee0e796008527). verified on 7.10 branch |
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.