Closed LtSten closed 2 years ago
We discussed this in the 2022-01-19 meeting and agree the spec should be fixed here. The sentence in the 2nd paragraph on page 369 of the OpenGL 4.6 core spec should say:
The vertex ID of the ith element transferred is the sum of basevertex and the value stored in the currently bound element array buffer at offset indices + i * size-of-type.
Assigned to @oddhack to make this spec fix on the next round of updates.
This appears equally applicable to ES 3.2 so planning to include the fix there as well, unless I missed something.
This appears equally applicable to ES 3.2 so planning to include the fix there as well, unless I missed something.
Sounds good, thanks.
This should be fixed in the spec update of May 5, 2022.
Considering §10.4 of the Core 4.6 spec, with regards to DrawElementsOneInstance, we have
As defined in §10.3.10 (which subsequently defers to §10.3.9), offsets are expressed in basic machine units; we note this is consistent with the passing of
cmd->firstIndex * size-of-type
asindices
to DrawElementsInstancedBaseVertexBaseInstance in the definition of DrawElementsIndirect.Returning to DrawElementsOneInstance, the correct offset to apply to the element array buffer is therefore not
indices + i
butindices + i * size-of-type
, since the former fails (in practice) iftype
is notUNSIGNED_BYTE
. This appears to be a slip introduced in the spec for 4.3, prior to whichindices[i]
was meaningful (if subtly questionable since it is formallyvoid*
, nottype*
):