Jump to content
  • Advertisement
Sign in to follow this  
lomateron

vertex shader useless when using geometry shader?

This topic is 1019 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

if I have a technique that uses the geometry shader, is there any reason to use the vertex shader to do something( except for passing input assembler data to the geometry shader )?

Is it faster to do the heavy part of an algorithm in the vertex shader and use the geometry shader only to generate the extra mesh?

Edited by lomateron

Share this post


Link to post
Share on other sites
Advertisement
It depends, but in general I would say the more computation you can offload to the vertex shader the better. For example, if you're just transforming vertices, depending on your primitive topology, the geometry shader may end up doing more operations. But as always in optimisation, benchmarking is key...

Share this post


Link to post
Share on other sites

Exactly, there's a position/parameter cache, however its "key" is the vertex index. If you use index-buffers, the same vertex won't be shaded twice, if shaded recently, and you save a bit.

 

If you don't use indices, then, I think, it doesn't matter where you put your computation - VS or GS.

Share this post


Link to post
Share on other sites

If you don't use indices, then, I think, it doesn't matter where you put your computation - VS or GS.

Depends on the primitive type. Non-indexed triangle strips still have vertex re-use smile.png

Share this post


Link to post
Share on other sites

It all depends on how your geometry shader is setup. As mentioned before, there can be no assumptions made as to the output of the geometry shader, but a vertex shader will alway output a single vertex ( varying outputs are implied ). Doing less work is always a plus, so if there is computation that can be offloaded to the vertex shader ( in the event that the geometry shader is moderately complex ), then why not do it. Also, since you cannot bypass the vertex shader, might as well just have it do some useful work if that possible.

Share this post


Link to post
Share on other sites

Why not run an experiment and see which one is faster?  I am sure there are situations where each option will be faster, and lots of situations where it is a wash.  If you try it out in your own engine both ways, then you can get a feel for how much of a difference it really makes, and learn more about how to profile how effective your changes are.

 

Then you can tell people what you found, and back it up with hard numbers :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!