Jump to content
  • Advertisement
Sign in to follow this  
karnalta

Vertex Buffer question

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

Hello all, I am learning Direct3D 10 since few weeks and so far all my test application have been like "draw a cube with texture and lights". But I am starting to ask myself some questions about vertex buffer management. I hope it's the right place to ask them ? 1.) In every sample I see Vertex buffer are always set to the device while being initialised. Is there a performance issue if you set it to the device at each frame (IASetVertexBuffers) ? 2.) I am asking the first question because I see there is 16 slot to bind vertex buffer to the device, but how I do if I want to render 25 differents objects on the screen ? I am suppose to set and unset buffer to/from the device every frame to draw object or I am suppose to never have more than 16 buffer and merge vertex of several object into the same buffer ? If someone could explain me a bit more about how vertex buffer are managed when I want to draw several differents objects to the screen I would appreciate it a lot ;) I have been searching around the web a lot but all simple sample I found are always about rendering a single object or several instance of the same object. Thank in advance.

Share this post


Link to post
Share on other sites
Advertisement
1) You can set them per frame. Chances are in the examples that they don't need to so they just do it once.

2) You don't need to use all of the vertex buffer slots. If you wanted to you could use 1 slot and change it 25 times. The advantage of using multiple stream inputs like that is to minimise switching. You could for example use the first 15 slots for the 15 most common vertex buffers and only change the last one per frame.

Also, you should try and optimise for using as few vertex buffers as possible anyway.

Share this post


Link to post
Share on other sites
Thank you Dave.

When you say we should always keep a minimal number of vertex buffer, is it a usual technique to merge multiple object's vertices into the same vertex buffer and draw them with different index buffer to optimize performance ?

This technique seem to be hard to manage, if performance aren't reduced I think it's a lot easier to set and unset different buffers while rendering.

Share this post


Link to post
Share on other sites
There are optimal sizes for vertex buffer and if you want an optimised system you can pack together like you said. If i were you i wouldn't worry about this at all for now and be quite liberal with your vertex buffer changes until you have evidence it is slow.

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.

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!