<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement SSBOs in GLSL front-end and i965"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89597#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement SSBOs in GLSL front-end and i965"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89597">bug 89597</a>
              from <span class="vcard"><a class="email" href="mailto:itoral@igalia.com" title="Iago Toral <itoral@igalia.com>"> <span class="fn">Iago Toral</span></a>
</span></b>
        <pre>(In reply to Iago Toral from <a href="show_bug.cgi?id=89597#c9">comment #9</a>)
<span class="quote">> (In reply to Iago Toral from <a href="show_bug.cgi?id=89597#c8">comment #8</a>)
> > Kristian, I have a question concerting writes to row_major matrices:

> Actually, the problem is more general than row_major matrices, for example
> this:

> struct TB {
>     float a, b, c, d;
> };

> layout(std140, binding=2) buffer Fragments {
>    TB s[3];
>    int index;
> };

> uniform mat4 MVP;

> void main()
> {
>    s[index].d = -1.0;
> }

> Generally, we have the problem when using dynamic indices into row_major
> matrices or arrays of types that are not a vec4 (if the type is a vec4 it
> works because the offset of a vec4 is always 16-byte aligned, so we can
> ignore the offset and just set the writemask based on the vec4 channels
> being written).</span >

It seems that I can fix this example (and others like this) by ignoring the
index into the array (for the purpose of computing the writemask, not when
computing the offset where we will write of course) and simply take the
constant offset of the element being accessed ('d') within the type (that would
be the constant value 12 in this specific. Since arrays are aligned to 16-byte
boundaries this works fine for the purpose of computing the writemask.

Row-major matrices are still an issue though, so my question from <a href="show_bug.cgi?id=89597#c8">comment #8</a>
still applies.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>