Bug 34691 - [GLSL] matrix array member assignment with a complex subscript fails
Summary: [GLSL] matrix array member assignment with a complex subscript fails
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: All Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
Depends on:
Reported: 2011-02-24 19:50 UTC by Gordon Jin
Modified: 2014-12-30 08:35 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

new piglit test case (330 bytes, text/plain)
2011-02-24 19:51 UTC, Gordon Jin
IR dump of the test case (7.96 KB, text/plain)
2011-07-07 15:26 UTC, Ian Romanick

Description Gordon Jin 2011-02-24 19:50:04 UTC
This is a further step to bug#32069. That bug has been fixed by Eric. But changing the matrix variable to a matrix _array_ variable still fails.

This fails on Piketon (i965) with mesa master:
    mat2 a[2];
    a[0][0][0] = 0;
    a[int(a[0][0][0])][0][1] = 1;

Changing a[int(a[0][0][0])] into a[int(0)] passes.

It passes with swrast.
Comment 1 Gordon Jin 2011-02-24 19:51:00 UTC
Created attachment 43776 [details]
new piglit test case
Comment 2 Ian Romanick 2011-07-07 15:26:11 UTC
Created attachment 48869 [details]
IR dump of the test case

Here's the output of MESA_GLSL=dump of a similar test.  The initial IR in the dump looks correct.  However, in the linked IR, the assignment to a[i][0][1] just disappears.  It seems that one of the optimizations passes is eating it.
Comment 3 Ian Romanick 2011-07-11 14:44:37 UTC
The problem appears to be in lower_variable_index_to_cond_assign.  I don't see how that code could possibly work with arrays of arrays or arrays of matrices.
Comment 4 Gordon Jin 2011-10-24 19:17:48 UTC
Ian, can you commit my piglit test case, so I could watch when this would turn to pass in nightly testing?
Comment 5 Timothy Arceri 2014-07-11 09:08:28 UTC
It doesn't look like this piglit test was commited to piglit. But it does seem to pass now in current Mesa.
Comment 6 Gordon Jin 2014-07-14 08:42:12 UTC
Ian, could you please commit my piglit test case?
Comment 7 Timothy Arceri 2014-07-29 22:22:38 UTC
You should probably send this to the piglit mailing list with a good commit message, such as what its testing, a link to this bug and the results of this test on various drivers. That way anyone with commit access can easily commit it once reviewed.
Comment 8 Ian Romanick 2014-12-17 20:21:15 UTC
(In reply to Gordon Jin from comment #4)
> Ian, can you commit my piglit test case, so I could watch when this would
> turn to pass in nightly testing?


commit ce4488332b228117c173796e914e8d1f0059fcac
Author: Gordon Jin <gordon.jin@intel.com>
Date:   Thu Feb 24 19:51:00 2011 +0000

    glsl-1.20: Access component of array-of-matrix
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34691
Comment 9 lu hua 2014-12-30 08:35:15 UTC
# bin/shader_runner /GFX/Test/Piglit/piglit/tests/spec/glsl-1.20/execution/fs-deref-array-of-matrix-element.shader_test -auto
PIGLIT: {"result": "pass" }

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.