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).
[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.”