Jump to content
  • Advertisement

Archived

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

rk

Efficient usage of vertex buffers

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

I am not totally sure of what is considered "correct" usage of Vertex Buffers. A book that I''m reading instructs to lock and unlock Vertex Buffers on every iteration of the game loop. However, my intuition (not real knowledge) tells me that things could be done in a way more elegant and efficient manner. My question is: how do you use Vertex Buffers? How about Index Buffers? rk

Share this post


Link to post
Share on other sites
Advertisement
This one''s SUCH a loaded question...but an important one. According to tests done on vertex buffers by NVidia, they claim a huge frame rate increase/decrease depending on the flags used during Vertex Buffer creation..

In the "olden" days of DX7/8.0 I *believe* there was a maximum vertex buffer size (around 64k I believe)...but in 8.1 I''ve seen postings claiming you can have a much larger buffer size..(ie. max. vram size???)

AND

A lot of the Vertex Buffer construction/destruction depends on what you''re doing with it...

If you''re creating a dynamic buffer (ie. containing vertices which change each game loop), then yes, you''ll have to create and destroy these each loop. It''s recommended to use the D3DUSAGE_WRITEONLY flag here during VB creation..

If you''re creating a static buffer (ie. vertices which won''t change throughout the game), then this is best done in an initialization area of your game..(obviously making sure NOT to destroy these until final game cleanup)..

(1) Be sure to check the sdk docs...they contain a large collection of pages describing the best creation/locking flags based on what you''re trying to accomplish..

(2) Check NVidia''s site, as their engineers have done quite a bit of research into this area...

(3) Do a quick search of these newsgroups...this topic has been battered around more often than Madonna''s thighs...(eewwwww!)

Now there was a small "gotcha" somewhere (IIRC), where you had to create ALL of the D3DPOOL_MANAGED vb''s FIRST THEN create the D3DPOOL_DEFAULT ones afterwards (something about how the video drivers stack the vb information in memory. It''s done much more efficiently if you organize it this way first)...

hth,

Share this post


Link to post
Share on other sites
quote:
Original post by beginner_directx
what do you mean by ' static buffer ' and ' dynamic buffer '


These quotes are taken directly from wazoo69's posting:

quote:
If you're creating a dynamic buffer (ie. containing vertices which change each game loop)...


...and...

quote:
If you're creating a static buffer (ie. vertices which won't change throughout the game)...



Explains it quite well, huh?


rk

Edited by - rk on December 25, 2001 3:54:19 PM

Share this post


Link to post
Share on other sites
static mean no change, you don''t lock the VB.

A dynamic buffer change each frame loop. In order to make lod or culling.

A static buffer is better because it''s uploaded on the GPU and never move (in theorie), a dynamic buffer come back to system mem in order to be read/written (it cost bandwidth even w/ an AGP x 8).

A commun idea is to make a static VB and a dynamic IB. So you decide which vertex to draw but use less bandwidth because IB are smaller).

PS: bad english this time, sorry.

Why English rules?? C pas très malin tout ça!

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.

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!