<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - 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"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90397#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - 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"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90397">bug 90397</a>
from <span class="vcard"><a class="email" href="mailto:siglesias@igalia.com" title="Samuel Iglesias <siglesias@igalia.com>"> <span class="fn">Samuel Iglesias</span></a>
</span></b>
<pre>Created <span class=""><a href="attachment.cgi?id=115737" name="attach_115737" title="patch to GetProgramResourceIndex() to fix arrays of UBOs behavior">attachment 115737</a> <a href="attachment.cgi?id=115737&action=edit" title="patch to GetProgramResourceIndex() to fix arrays of UBOs behavior">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=90397&attachment=115737'>[review]</a>
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,
resource-query.c.
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
shader.
resource-query test checks again that those names corresponds to active
resources by comparing the former index against the one returned by
glGetProgramResourceIndex(name).
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.</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>