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

Arthur Huillet arthur.huillet at free.fr
Wed Mar 4 07:15:04 PST 2015

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 
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

So as far as I can tell my change matches the spec requirements and the 
NVIDIA implementation.


More information about the Piglit mailing list