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 6 of 6

Thread: geometry-shader .. just, how slow?

  1. #1
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    68

    geometry-shader .. just, how slow?

    Hi all,
    My first 3d was terrain-data. Pretty easy, all things considered. To cope with the excessive data I tried to involve the geometry-shader. The framerate dropped to 20-30 % by just using the pass-through shader. Is that standard or should I expect far better performance .. perhaps in particular favourable circumstances? The shader sparks my imagination, but not at that performance-price!
    Cheers

  2. #2
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,146
    Maybe this thread is a good start.
    I had a very bad experience with GS. What do you actually want to achieve?

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    I only use GS in 2 cases.

    1) rendering various icons for points like diamond/square/plus/cross but I notice the speed hit and am thinking of changing it to do the work in the vertex shader using instancing

    2) the other is to save render passes on tins (terrain) geometry where I want to overlay grids and contour lines. My main win hear is in avoiding z-buffer fighting and I am about as fast with using GS as the extra draw passes.

    I am not convinced using GS to discard geometry is actually quicker than using the cpu to rebuild the index buffer particularly with storage buffers

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,201
    I haven't extensively used a GS in OpenGL, but in D3D having the stage active with just a pass-through shader gives maybe a 5% to 10% hit.

    I'm personally satisfied that it's a non-feature for what most people seem to want to use it for, which is point-to-quad expansion in a particle system, or other similar primitive expansion/decimation scheme.

    The main things I've used the GS for include:


    • Shadow volume extrusion (although I haven't compared this with a pure CPU solution as I was late to the party with shadow volumes).
    • Generating per-triangle normals on the fly (my vertex format was already bloated, and these normals were only used in one specific rendering pass).
    • Generating extra sets of texcoords for detail texturing (where triangle orientation matters).
    • Collapsing an expensive once-per-vertex operation to a cheaper once-per-triangle operation.


    In other words I don't see much value in it for adding or removing vertices/triangles (aside from shadow volumes where it seems that it can save you a lot of work on the CPU, and is friendlier for static vertex buffers), but it's quite useful for anything that needs to operate on (and have knowledge of) an entire primitive, and even then you need to be careful that the saving you get is greater than what you lose from just having the GS stage active.

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,213
    Geometry shader can yield some pretty impressive speedups in some circumstances. For instance:

    * Instance culling using geometry shaders (rastergrid)
    * GPU based dynamic geometry LOD

    (adapted to use modern transform feedback techniques which avoid readbacks/synchronization/etc. of course). But still I would echo the above comments: bench it w/ and w/o a geometry shader to make sure it's really faster than the alternative.

  6. #6
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    68
    Thanks for the input. The performance-penalty was not a fig of my imagination then. Alexandar, it's not so much a particular task, but rather a potential for problem-solving in general. As a newb I'm not at all tied to conventional ways of solving anything.

Posting Permissions

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