KhronosGroup / OpenGL-API

OpenGL and OpenGL ES API Issue Tracker
34 stars 5 forks source link

GL 4.6 compatibility spec is self contradictory about primitive restart and ArrayElement #81

Open ianromanick opened 3 years ago

ianromanick commented 3 years ago

Section 10.7.4 (Transferring Vertices With ArrayElement) says:

If ArrayElement is called while primitive restart is enabled (see section 10.3.6 and i is equal to the primitive restart index, then no vertex data is dereferenced, and no current vertex state is modified. Instead, it is as if End were called, followed by a call to Begin where mode is the same as the mode used by the previous Begin.

But section 10.3.6 (Primitive Restart) says;

Note that primitive restart is not performed for array elements transferred by any drawing command not taking a type parameter, including ArrayElement and all of the *Draw* commands other than *DrawElements*.

  1. Is glArrayElement subject to primitive restart or not? The two spec quotations say the opposite thing.
  2. Is glDrawRangeElements subject to primitive restart or not? Section 10.3.6 seems to exclude it, but I doubt that was intended.
NicolBolas commented 3 years ago

The etymology of the 10.3.6 paragraph is interesting, as the quirk appears to have arisen between 4.4 and 4.5.

In 4.4, the sentence was specifically about the fixed-index form:

If PRIMITIVE_RESTART_FIXED_INDEX is enabled, primitive restart is not performed for array elements transferred by any drawing command not taking a type parameter, including ArrayElement and all of the *Draw* commands other than *DrawElements*.

This makes sense, as the fixed index is defined in terms of the type provided, and functions that provide no such type could use it.

But in 4.5, it was separated from the previous sentence into its own paragraph and expanded, essentially as you quoted.

It seems that all versions of the fixed-index restart have the "I don't care about DrawRange functions" issue, including the actual extension specification that brought it up. This makes sense, as it was part of ES3 compatibility, and ES doesn't have the range drawing functions.

That being said, the change of paragraph from 4.4 to 4.5 may have been to address the question of what restarting means for array rendering. This is important, because restarting is based on the vertex ID at vertex reading time, and both indexed and array rendering functions have those. In 4.5 core, the paragraph says that array drawing functions don't provoke any restarting, even if the vertex ID happens to equal the fixed or specified index.