<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - program interface queries not returning right data for UBO / GL_BLOCK_INDEX"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94116">94116</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>program interface queries not returning right data for UBO / GL_BLOCK_INDEX
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Mesa core
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>imirkin@alum.mit.edu
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=121715" name="attach_121715" title="Test results for dEQP-GLES31.functional.program_interface_query.uniform.block_index.*">attachment 121715</a> <a href="attachment.cgi?id=121715&action=edit" title="Test results for dEQP-GLES31.functional.program_interface_query.uniform.block_index.*">[details]</a></span>
Test results for
dEQP-GLES31.functional.program_interface_query.uniform.block_index.*

Not 100% sure that my diagnosis is correct, but it seems that there's some
disagreement between the GL_BLOCK_INDEX being returned by
glGetProgramResourceiv and the resource index accepted by
glGetProgramResourceName.

Note the output of these dEQP tests:

MESA_GLES_VERSION_OVERRIDE=3.1 ./deqp-gles31 --deqp-visibility=hidden
--deqp-case='dEQP-GLES31.functional.program_interface_query.uniform.block_index.*'
dEQP Core git-0c2b7cdc3a0455e0486f88574021d3ccd22f28a8 (0x0c2b7cdc) starting..
  target implementation = 'X11 EGL/GLX'

Test case
'dEQP-GLES31.functional.program_interface_query.uniform.block_index.default_block'..
Compute shader compile time = 2.354000 ms
Link time = 0.581000 ms
Test case duration in microseconds = 6153 us
  Pass (Pass)

Test case
'dEQP-GLES31.functional.program_interface_query.uniform.block_index.named_block'..
Compute shader compile time = 0.319000 ms
Link time = 0.522000 ms
Mesa: User error: GL_INVALID_VALUE in glGetProgramResourceName(index 1)
Test case duration in microseconds = 2495 us
  Fail (query block name: glGetError() returned GL_INVALID_VALUE at
es31fProgramInterfaceQueryTestCase.cpp:609)

Test case
'dEQP-GLES31.functional.program_interface_query.uniform.block_index.unnamed_block'..
Compute shader compile time = 0.291000 ms
Link time = 0.526000 ms
Mesa: User error: GL_INVALID_VALUE in glGetProgramResourceName(index 1)
Test case duration in microseconds = 2408 us
  Fail (query block name: glGetError() returned GL_INVALID_VALUE at
es31fProgramInterfaceQueryTestCase.cpp:609)

Test case
'dEQP-GLES31.functional.program_interface_query.uniform.block_index.block_array'..
Compute shader compile time = 0.398000 ms
Link time = 1.887000 ms
Test case duration in microseconds = 3985 us
  Fail (resource block index invalid)

DONE!

Now the difference between the default_block one and the others is that the
others have a layout(binding=0). For default block, it returns GL_BLOCK_INDEX:
-1, and it's all happy about that. I would sort of have assumed that for the
others, the block index should be 0, but I'm not 100% sure. When it goes to use
this block index as an argument to glGetProgramResouceName it errors out for
the first 2, and for the last one it gets:

  <Text>Block name with index 1 is &quot;TargetInterface[1]&quot;</Text>
  <Text>        Error, expected TargetInterface[0]</Text>

So I suspect there's an off-by-one somewhere. Attaching the test result output
from dEQP which includes the shaders.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>