[Piglit] [PATCH] shader_runner: fix uniform array name lookups

Ilia Mirkin imirkin at alum.mit.edu
Wed Mar 4 07:28:10 PST 2015

On Wed, Mar 4, 2015 at 10:15 AM, Arthur Huillet <arthur.huillet at free.fr> wrote:
> On 2015-03-04 15:58, Ilia Mirkin wrote:
>> On Wed, Mar 4, 2015 at 4:53 AM, Arthur Huillet <arthur.huillet at free.fr>
>> wrote:
>>> From: Arthur Huillet <ahuillet at nvidia.com>
>>> Don't look up uniform names for non-zero array elements, as this is
>>> illegal per GL4.5.
>>> From the discussion of GetProgramResourceIndex in the GL4.5 spec:
>>>        If name exactly matches the name string of one of the active
>>> resources for
>>>     programInterface, the index of the matched resource is returned.
>>> Additionally, if
>>>     name would exactly match the name string of an active resource if
>>> "[0]" were
>>>     appended to name, the index of the matched resource is returned.
>>> Otherwise, name
>>>     is considered not to be the name of an active resource, and
>>>     returned. 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.
>> Hm, and the spec goes on to define GetUniformIndices in terms of
>> GetProgramResourceIndex...
>> What does this say about a[3].b[75].c[2] ? Do they all have to be 0
>> and you have to retrieve all 3 strides? If so, your implementation
>> isn't quite doing that.
> Sorry, I should have mentioned that this only applies to bottom-level
> arrays, per the following in glspec45.compatibility.pdf:
> "For an active variable declared as an array of basic types (e.g. not an
> array
> of stuctures or an array of arrays), a single entry will be generated, with
> its
> name string formed by concatenating the name of the array and the string
> "[0]"."
> So as far as I can tell my change matches the spec requirements and the
> NVIDIA implementation.

Ah I see. That compat spec snippet is a *lot* clearer. Dare I ask what
happens when you do have an array of arrays, e.g. float a[5][5]. I
believe Timothy Arceri is slowly working on that in mesa, so let's try
not to break that in the process.

More information about the Piglit mailing list