Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Number of invocation of vertex shader

  1. #1
    Newbie Newbie
    Join Date
    Sep 2013
    Posts
    2

    Question 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.
    Code :
    typedef struct D3D11_QUERY_DATA_PIPELINE_STATISTICS {
      UINT64 IAVertices;
      UINT64 IAPrimitives;
      UINT64 VSInvocations;
      UINT64 GSInvocations;
      UINT64 GSPrimitives;
      UINT64 CInvocations;
      UINT64 CPrimitives;
      UINT64 PSInvocations;
      UINT64 HSInvocations;
      UINT64 DSInvocations;
      UINT64 CSInvocations;
    } D3D11_QUERY_DATA_PIPELINE_STATISTICS;

    Are there anything similar in OpenGL?

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    325
    Hello,

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

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    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.

  4. #4
    Member Regular Contributor
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    325
    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).

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    Quote Originally Posted by menzel
    but those numbers will only differ for indexed rendering
    Good point, sir!

  6. #6
    Newbie Newbie
    Join Date
    Sep 2013
    Posts
    2
    Thanks all for your answer!

  7. #7
    Junior Member Regular Contributor tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    224
    Quote Originally Posted by menzel View Post
    but those numbers will only differ for indexed rendering).
    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."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •