[Mesa-dev] Shader Interface Matching

Tapani Pälli tapani.palli at intel.com
Wed Dec 2 23:15:00 PST 2015



On 12/03/2015 09:03 AM, Timothy Arceri wrote:
> On Thu, 2015-12-03 at 08:46 +0200, Tapani Pälli wrote:
>>
>> On 12/03/2015 05:58 AM, Timothy Arceri wrote:
>>> Hi All,
>>>
>>> I recently pushed a couple of piglit tests [1] and [2] that test
>>> for
>>> matching of blocks and structs based on location rather than name
>>> when
>>> an explicit location is given.
>>>
>>> The test pass on Nvidia but fail in current Mesa.
>>>
>>> However I just came across this in section 7.4.1 (Shader Interface
>>> Matching) the OpenGL 4.5 spec:
>>>
>>>      "- An output block is considered to match an input block in
>>>         the subsequent shader if the two blocks have the same block
>>>         name, and the members of the block match exactly in name,
>>>         type, qualification, and declaration order.
>>>       - An output variable is considered to match an input variable
>>>         in the subsequentshader if:
>>>         -- the two variables match in name, type, and qualification;
>>> or
>>>         -- the two variables are declared with the same location and
>>>            component layout qualifiers and match in type and
>>>            qualification."
>>>
>>> But then later it says:
>>>
>>> "The inputs and outputs on an interface between programs need not
>>> match
>>> ex-actly when input and output location qualifiers (sections
>>> 4.4.1(“Input Layout Qual-ifiers”) and 4.4.2(“Output Layout
>>> Qualifiers”)
>>> of the OpenGL Shading LanguageSpecification) are used. When using
>>> location qualifiers, any input with an inputlocation qualifier will
>>> be
>>> well-defined as long as the other program writes to amatching
>>> output,
>>> as described above. The names of variables need not match when
>>> matching
>>> by location."
>>>
>>> So my question is why bother to inforce name matching on blocks
>>> when
>>> not using SSO? Should I folow the spec or do what Nvidia does?
>>
>> I was reading through these sections when looking at the tests. My
>> understanding is that Mesa is too strict currently since matching by
>> location is defined as above, this change came in 4.3 spec.
>
> Mesa also has a bigger problem in that it parses the location from
> structs and interface blocks but doesn't actually use it.

Right, I think it's there only for uniforms. Uniforms will get 
sequential locations for structure items. Now I can't find test for this 
but I remember writing the code for it.

>>   I don't see
>> it being limited to SSO scope. How I understand is that this
>> paragraph
>> belongs to generic scope of "Shader Interface Matching" section.
>
> But doesn't the end of the first line "between programs" mean its only
> talking about SSO. At the top when it talks about names being required
> to match for blocks and block members it talks about the interface
> between shaders rather than programs.

True, I missed this bit. I guess it would be good to make a search in 
Khronos bugzilla if there is any discussion about this topic. I don't 
see much reason to require name to match if location, type and other 
required qualifiers match but it does seem to be required :/


>>
>>
>>> Tim
>>>
>>>
>>> [1]
>>> http://cgit.freedesktop.org/piglit/commit/?id=f1e416b8e65ad95c6ce9e
>>> 04a80d83e7f9e1e9239
>>> [2]
>>> http://cgit.freedesktop.org/piglit/commit/?id=2b2bb62ce03ffa065e9b5
>>> 91cd
>>> 05e12c623ed4759
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list