Number of invocation of vertex shader

Hi, I would like to if there is any way for me to get the number of invocation of vertex shader after rendering a model.

For example in D3D11, I can have this struct. Inside the struct, there is an attribute VSInvocations.

  UINT64 IAVertices;
  UINT64 IAPrimitives;
  UINT64 VSInvocations;
  UINT64 GSInvocations;
  UINT64 GSPrimitives;
  UINT64 CInvocations;
  UINT64 CPrimitives;
  UINT64 PSInvocations;
  UINT64 HSInvocations;
  UINT64 DSInvocations;
  UINT64 CSInvocations;

Are there anything similar in OpenGL?


a Query (look up glBeginQuery) with the target of GL_PRIMITIVES_GENERATED might be what you are looking for.

Or an atomic counter - for this approach, check this Lighthouse3D article. With an atomic counter you can track the actual number of invocations, which excludes already processed and cached vertices. Pretty neat for profiling.

Good point, while the query is likely to be faster, the actual shader invocations can only be counted with a atomic counter (but those numbers will only differ for indexed rendering).

Good point, sir! :slight_smile:

Thanks all for your answer!

[QUOTE=menzel;1254727]but those numbers will only differ for indexed rendering).[/QUOTE] That might not be accurate:
“While a vertex or tessellation evaluation shader will be executed at least once for each unique vertex specified by the application (vertex shaders) or generated by the tessellation primitive generator (tessellation evaluation shaders), it may be executed more than once for implementation-dependent reasons. Additionally, if the same vertex is specified multiple times in a collection of primitives (e.g., repeating an index in DrawElements), the vertex shader might be run only once.”