[Mesa-dev] [Bug 104553] mat4: m[i][j] incorrect result with row_major UBO & SSBO

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun May 5 19:14:22 UTC 2019


https://bugs.freedesktop.org/show_bug.cgi?id=104553

--- Comment #13 from florian.will at googlemail.com ---
Created attachment 144167
  --> https://bugs.freedesktop.org/attachment.cgi?id=144167&action=edit
Simpler piglit test demonstrating the issue

Thanks for taking a look, Alejandro! And I'm sorry this took longer than I had
hoped. Anyway, I updated my mesa to latest master git-6823873246 (purely
numeric commit hash, wow) and those tests are still failing for me. My patch
still fixes them, but I'm also still not sure about the general validity of the
patch.

I feel like all the tests so far have been disappointing because they were a
bit difficult to understand, or because that UBO test generator is kind of
complicated. So I wanted to find a short and simple to understand test case.

Since what seems to be going on is that [i][j] access is changed to something
similar to [0][i+j] access, I wrote a piglit test based on an existing piglit
test that basically does this on a row_major matrix "m" in a compute shader,
and then stores the resulting color in a shader image:

    m[0][3] = 0.1f;
    m[1][2] = 0.2f;
    m[2][1] = 0.3f;

    m[1][3] = 0.4f;
    m[3][1] = 0.5f;

    vec4 color = vec4(m[0][3], m[1][2], m[2][1], m[1][3]);

It also has a memory barrier and barrier before setting the color. As I
understand it (I'm not very OpenGL experienced though, so correct me if I'm
wrong), this should set the color to (0.1, 0.2, 0.3, 0.4) reliably.

What seems to happen though when I use a row_major matrix, is that the [1][2]
write access overwrites [0][3], and then [2][1] overwrites both, so all 3
values end up as the same value, 0.3.

Same for the [3][1] write access, it overwrites [1][3], so that value ends up
as 0.5. So at the end, the color is incorrectly set to (0.3, 0.3, 0.3, 0.5):
Probe color at (0,0)
  Expected: 25 51 76 102
  Observed: 77 77 77 128

The test case works as expected if I change the row_major matrix to be
column_major.

I'm attaching this new and simpler piglit test. I'm not sure if I should change
the status to "NEW" again or keep it at "NEEDINFO".

Maybe someone who is not an OpenGL newbie could have a look at my test and see
if it's valid, and see if it fails in the same way for you.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190505/0e4c0881/attachment-0001.html>


More information about the mesa-dev mailing list