Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Funkymunky

My Vertex Approach

This topic is 5572 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

Right now, here''s how I''m working. I''m building an engine, and I add components as I develop them. For each new component (say, a fire object) I have a separate .h and .cpp file, for the class. For these I have a seperate Flexible Vertex Format and vertex structure. However, Most of these components have the exact same vertex type, just with different names. Is there any speed increase to be had by standardizing my vertex structure and FVF? Will not calling SetVertexShader for each component really make a difference?

Share this post


Link to post
Share on other sites
Advertisement
Use as few FVFs as you can to make your code easier to maintain. Normally each vertex buffer needs a separate FVF, but if they are the same thing you can interchange them. This will just get you confused in the long run. And yes, calling SetVertexShader a bunch of times means more DrawPrimitive or DrawIndexedPrimitive, and that will be slower.

Share this post


Link to post
Share on other sites
If many have the same actual FVF code, but with different (module specific) naming, then why not just store the currently set FVF code somewhere and then wrap your SetVertexShader in a "if (current_fvf != new_object_fvf)..." check ?


Although not doing something unless necessary is always beneficial to performance, AFAIK, there will be much larger bottlenecks in your overall system (VB changes, texture changes etc).

IIRC, however, changing an actual vertex shader (rather than an FVF) when its not necessary can harm performance.


I think D3D traps the trivial case. But obviously won''t sort your scene for you so won''t trap the set shaderA, set shaderB, set shaderA, set shaderB type pattern.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Raloth: no, the number of DrawPrimitive calls won''t be any different.

S1CA: yes it would be more beneficial, IE easier to read and one less call....but does it really matter that much?

Share this post


Link to post
Share on other sites
I meant if he had a separate vertex buffer for each FVF even though they are the same.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!