0
\$\begingroup\$

Advice says to either limit use or not to use it at all.


Friday Facts #251 - A Fistful of Frames | Factorio:

We tried it, and it worked great. We got some speedup due CPU needing to prepare less data, but when doing research how different APIs work with geometry shaders, we found out that Metal (and therefore MoltenVK) on macOS doesn’t support geometry shaders at all. After more digging, we found an article called Why Geometry Shaders Are Slow. So we tested using the geometry shader on a range of PCs in the office, and found that while it was faster on PCs with new graphics cards, the older machines took a noticeable performance hit. Due to the lack of support on macOS and the possible slowdown on slower machines, we decided to drop the idea.


Geometry Shader Debugger · Issue #2110 · baldurk/renderdoc · GitHub:

Geometry shaders are inefficient especially when expansion is used like that and that's the case that GPU vendors explicitly recommend against.

I just wanted to let you know that geometry shaders have been virtually abandoned, since with them still being in the API not everyone is aware of that.


GPU Programming Guide - GeForce 8 and 9 Series (Chapter 4):

But in general, the potential for wasted work and performance penalties for using a GS makes it an often unused feature of Shader model 4.


OpenGL - geometry shaders


Can someone give me a list of geometry shader usages? : gamedev

Geometry shaders can be used for Level-of-Detail subdivision of geometry, and people did expect to be able to use them for that. But AFAIK it turned out that their performance in that scenario is horrible, which is why we now have tesselation shaders for that purpose.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ The choice of what tool to use always depends on what you want to do with it. So: what are you considering using a geometry shader for, that's not adequately covered by the recommendations you've linked? \$\endgroup\$
    – DMGregory
    Dec 10 '20 at 17:46
  • \$\begingroup\$ @DMGregory I used it to expand points into quads for a tile mesh. It worked great, and gave a 15x boost in performance, until I realized that generating the UVs required generating a static texture that the GS could read. This makes spritesheet-based animation/non-static tiles much harder to do at run-time. \$\endgroup\$
    – Casey
    Dec 10 '20 at 19:17
  • \$\begingroup\$ Want to ask, "How can I render animated tiles efficiently" or something along those lines? That will likely give you much more constructive information for solving your problem than "do/don't use a geometry shader". \$\endgroup\$
    – DMGregory
    Dec 10 '20 at 19:29
  • \$\begingroup\$ @DMGregory Definitely. But this question is specifically geared towards: "Why is everyone telling me not to use the GS? When exactly what I'm trying to achieve is specifically mentioned as a good use of it?" \$\endgroup\$
    – Casey
    Dec 10 '20 at 19:40
  • \$\begingroup\$ Because "The choice of what tool to use always depends on what you want to do with it". It could be that the workloads those folks are thinking about are different from your workload. It could be a good solution to your problem while being a bad solution to their problems. Or it could be that it doesn't perform that well in your use case either. Do you have profiling that tells you it's doing what you need on your target platforms? If so, trust the profiler over hearsay from Internet randos like us any day. \$\endgroup\$
    – DMGregory
    Dec 10 '20 at 20:03
0
\$\begingroup\$

DirectX
Geometry shaders haven't been abandoned conceptually, but in the D3D12* pipeline Microsoft is replacing them with mesh shaders:

The main goal of the Mesh shader is to increase the flexibility and performance of the geometry pipeline. Mesh shaders subsume most aspects of Vertex and Geometry shaders into one shader stage by processing batches of vertices and primitives before the rasterizer. They are additionally capable of amplifying and culling geometry.

OpenGL
Geometry shaders haven't been abandoned, at khronos.org geometry shaders are still listed as core in version 4.6*.

*The most recent version at the time of posting.

Note: my original answer mistakenly focused on OpenGL - I decided to leave that information incase it proves useful for users searching for geometry shaders without specifying the API.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.