[Mesa-dev] [Bug 90397] ARB_program_interface_query: glGetProgramResourceiv() returns wrong value for GL_REFERENCED_BY_*_SHADER prop for GL_UNIFORM for members of an interface block with an instance name

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed May 13 03:41:47 PDT 2015


--- Comment #4 from Samuel Iglesias <siglesias at igalia.com> ---
Created attachment 115737
  --> https://bugs.freedesktop.org/attachment.cgi?id=115737&action=edit
patch to GetProgramResourceIndex() to fix arrays of UBOs behavior

I found another issue when modifying
arb_program_interface_query-getprogramresourceiv to test an uniform inside an
array of UBOs.

I modified a shader which is defined inside common.h. Because of that, I
updated other tests' code to work with that change. In particular,

Shader code:

    #version 150

    uniform fs_uniform_block {
        vec4 fs_color;
        float fs_array[4];

    uniform fs_array_uniform_block {
        vec4 fs_color;
        float fs_array[4];
    } ubo[4];

    in vec4 fs_input1;
    out vec4 fs_output0;
    out vec4 fs_output1;

    void main() {
       fs_output0 = fs_color * fs_input1 * fs_array[2] *
                ubo[0].fs_array[2] * ubo[2].fs_array[2];
       fs_output1 = fs_color * fs_input1 * fs_array[3] *
                ubo[1].fs_array[3] * ubo[3].fs_array[3];

I found that glGetProgramResourceName() is returning the name
"fs_array_uniform_block[0]", "fs_array_uniform_block[1]",
"fs_array_uniform_block[2]", and "fs_array_uniform_block[3]" when asked with
the corresponding block index as those blocks are active resources in the

resource-query test checks again that those names corresponds to active
resources by comparing the former index against the one returned by

Unfortunately, Mesa is returning GL_INVALID_INDEX to
fs_array_uniform_block[{1,2,3}] (other than zero),  while NVIDIA passes the
test for that case.

Reading GL_ARB_program_interface_query, I found the following:

   "Note that if an
    interface enumerates a single active resource list entry for an array
    variable (e.g., "a[0]"), a <name> identifying any array element other than
    the first (e.g., "a[1]") is not considered to match."

I understand that this is referring to uniform/buffer variables but not
uniform/shader-storage blocks, but I might be wrong.

I would like to have your opinion regarding if it is valid or not spec-wise.
What do you think?

P.S: Attached to this, it's the patch that fixes this case.

You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150513/6d6706c9/attachment.html>

More information about the mesa-dev mailing list