[Mesa-stable] [Mesa-dev] [PATCH V2] glsl: Allow overlapping locations for vertex input attributes

Eric Anholt eric at anholt.net
Mon Apr 21 08:47:30 PDT 2014


Ian Romanick <idr at freedesktop.org> writes:

> On 03/24/2014 04:33 PM, Anuj Phogat wrote:
>> Currently overlapping locations of input variables are not allowed for all
>> the shader types in OpenGL and OpenGL ES.
>> 
>>>From OpenGL ES 3.0 spec, page 56:
>>    "Binding more than one attribute name to the same location is referred
>>     to as aliasing, and is not permitted in OpenGL ES Shading Language
>>     3.00 vertex shaders. LinkProgram will fail when this condition exists.
>>     However, aliasing is possible in OpenGL ES Shading Language 1.00 vertex
>>     shaders."
>> 
>> Taking in to account what different versions of OpenGL and OpenGL ES specs
>> say about aliasing:
>>    - It is allowed only on vertex shader input attributes in OpenGL (2.0 and
>>      above) and OpenGL ES 2.0.
>>    - It is explictly disallowed in OpenGL ES 3.0.
>> 
>> Fixes Khronos CTS failing test:
>> explicit_attrib_location_vertex_input_aliased.test
>> See more details about this at below mentioned khronos bug.
>> 
>> V2: Fix the case where location exceeds the maximum allowed attribute
>> location.
>
> I made a couple comments below.
>
> I also have a bigger worry about this.  What does the i965 backend (or
> other backends) do with a shader like:
>
>     layout(location=0) vec4 a;
>     layout(location=0) ivec2 b;

Depending on your VertexAttrib call type, it creates floats or ints in
the vertex attribute register space.  Then you'll read that float or int
data as both vecs and ints in your shader.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-stable/attachments/20140421/1f8434b6/attachment.sig>


More information about the mesa-stable mailing list