The OpenGL spec. says:
The variable
gl_PrimitiveID
is filled with the number of primitives processed by the drawing command which generated the input vertices. The first primitive generated by a drawing command is numbered zero, and the primitive ID counter is incremented after every individual point, line, or triangle primitive is processed. Restarting a primitive topology using the primitive restart index has no effect on the primitive ID counter.
Unfortunately, I do not quite understand that.
If I make a draw call with GL_PATCHES
with number of vertices = 32, do all 32 vertices have gl_PrimitiveID
= 0 in the Tesselation Control shader?
Tessellation Control shaders still output a Patch, and a Patch is a single primitive.
Is it correct to assume that when this patch is tessellated as triangles in the Tessellation Evaluation shader, every nth vertex will have its gl_PrimitiveID
= n/3?
If not, please explain what their values will be.