[Mesa-dev] Fwd: [Piglit] RFC: confusion about vertex attrib location index=0 and CURRENT_VERTEX_ATTRIB

Alejandro Piñeiro apinheiro at igalia.com
Wed Apr 13 13:31:22 UTC 2016

Taking into account the small amount of feedback at piglit list, trying
now on mesa-dev, hoping someone here could shed some light on the matter.

-------- Forwarded Message --------
Subject: 	[Piglit] RFC: confusion about vertex attrib location index=0
Date: 	Tue, 5 Apr 2016 18:46:16 +0200
From: 	Alejandro Piñeiro <apinheiro at igalia.com>
To: 	piglit <piglit at lists.freedesktop.org>


while checking the spec of ARB_vertex_attrib64bit [1] searching for
possible piglit tests, I found the following paragraph:

    void GetVertexAttribLdv(uint index, enum pname, double *params);

    (modify the third paragraph, p. 388) The query CURRENT_VERTEX_ATTRIB
    returns the current value for the generic attribute
    The error INVALID_OPERATION is generated if index
    is zero, as there is no current value for generic attribute zero.

So I was about to add a test checking for INVALID_OPERATION on that
case. But I also wanted to check if there was an existing test for the
other GetVertexAttrib*, as it was not the case I was about to add a test
for all of them.

But I found the spec documentation inconsistent between versions with
respect to what to do in that case. What it is clear is that before 3.1
it was a special value assigned to vertex. So, for example, if we go
directly to mesa code, there is a method that checks if attribute zero
aliases to vertex position [2], that is used to raise INVALID_OPERATION
or not [3]. With that code, it doesn't emit INVALID_OPERATION as soon as
the attribute 0 becomes non-magic (as the code comment mentions).

But, looking at the specs of different versions of mesa, I found the

On 3.1 CURRENT_VERTEX_ATTRIB is not present.

For 3.2, 3.3 and 4.0 core&compatibility, INVALID OPERATION for index=0
is not explicitly mentioned. But a general "The error INVALID_OPERATION
is generated if program has not been linked successfully, or if location
is not a valid location for program". I assume that location 0 for a
vertex attrib is mentioned as not a valid location somewhere, but I
didn't find it.

So now starts the interesting. On specs 4.1 and 4.2, the following
explicit paragraph is included on core profile:
"An INVALID_OPERATION error is generated if index is zero and pname is
CURRENT_VERTEX_ATTRIB , since there is no current value for generic
attribute zero."

*But*, on 4.3, 4.4 and 4.5, that paragraph is only present at the
compatibility profile spec.

So, if we follow literally what the spec says, calling GetVertexAttrib*
with index=0 and CURRENT_VERTEX_ATTRIB should raise a INVALID_OPERATION
 * on 3.2, 3.3, 4.0 core&compatibility, as I assume that location 0 is
wrong, even if not mentioned explicitly
 * on 4.1, 4.2 core&compatibility: as there is a explicit paragraph
about it.
 * on 4.3, 4.4, 4.5 compatibility but not on core: as the paragraph is
only present on the compatibility spec.

Something that right now mesa is not doing. Something strange as the
commit that implements part of that code, mentions explicitly that a CTS
test for glGetVertexAttrib get fixed [4]. And in any case, I find the
spec somewhat inconsistent about this error.

In any case, trying to go for a conclusion, and perhaps following more
what I see currently on mesa code, seems that for 3.2 and beyond
INVALID_OPERATION should not be raised when using index=0 and pname
CURRENT_VERTEX_ATTRIB, so I shouldn't bother to write a piglit test for


[1] https://www.opengl.org/registry/specs/ARB/vertex_attrib_64bit.txt
[3] https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/main/varray.c#n973
Piglit mailing list
Piglit at lists.freedesktop.org

More information about the mesa-dev mailing list