Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance difference between geometry shader and vertex shader

Currently am rendering a model of around 1 million vertices. And inside vertex shader i am doing some complex computation for each vertex. Now i would like to increase the resolution of the model. I have two queries regarding this:

  1. Is it advisable to use geometry shader for increasing resolution to very large factors like 64 times?
  2. If i introduce a geometry shader i might need to move my computation from vertex shader to geometry shader. Whether doing an operation in verterx shader is same as doing it in geometry shader, in terms of performance.
like image 788
rps Avatar asked Nov 02 '12 05:11

rps


Video Answer


1 Answers

Is it advisable to use geometry shader for increasing resolution to very large factors like 64 times.

Absolutely not. While GS's can amplify geometry and perform tessellation, that's not really what they're for. Their main purposes are for handling transform feedback data (particularly hardware that can handle multi-stream output) and layered rendering.

If i introduce a geometry shader i might need to move my computation from vertex shader to geometry shader. Whether doing an operation in verterx shader is same as doing it in geometry shader, in terms of performance.

Do as little work in the GS as is reasonable. The GS happens after the post-T&L cache, and you want to get as much out of that as possible. So do as much of your real transformation work as is reasonable in the vertex shader.

like image 60
Nicol Bolas Avatar answered Oct 13 '22 09:10

Nicol Bolas