Jump to content
  • Advertisement
Sign in to follow this  
Alex Red

A Vertex Buffer can be released...?

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

Guys... I am setting up a VB manager... here what really is not so clear to me... When finished using a Vertex Buffer... there is a way to release it and free memory in the VCard...? The IUnknown::Release method...? I could create a single big VB in which place more models... could I then release each of that models separately to free memory in the VB...Or should I create a VB for each model, and then release each VB ( if there is any way )...? Or just VB allocation/deallocation is managed automatically...? tnx for any Info... [R]ed

Share this post


Link to post
Share on other sites
Advertisement
You can call Release on the vertex buffer to release the complete content and free the memory. You cannot however release only a part of the buffer (imagine releasing a part in the middle, suddenly you have two parts).

Usually (at least i do so) you create a VB for one model (as in moving object) at the start of the game and release it when the game quits.

I'm using a list of vertexbuffers which is kept by my wrapper. I ask the wrapper for a vertexbuffer on creation, and when i want to destroy it, the wrapper calls release on it. The wrapper also releases the vertex buffer objects, if the app quits; to avoid memory leaks.

Share this post


Link to post
Share on other sites
You should keep all your models in one vertex buffer. This minimizes vertex buffer switches (which are slow). Of course, you should keep dynamic models in a separate, dynamic vertex buffer.

Share this post


Link to post
Share on other sites
Tnx Guys... tnx for advices...
real problems here is about the number of models I coudl have to manage the same time... the game could have more than 6000 models and some hundreds managed at same time...and many with more that 10000 vertices... but ok... I will have to find a way to manage them, may be using Release on low memory Video Cards...

tnx

Share this post


Link to post
Share on other sites
6,000 models at 10k vertices each!? Ouch. You'll defiantly have to batch as many calls as possible, and load only the models you need.

Share this post


Link to post
Share on other sites
Assuming a standard 32 byte vertex, that's 1.8GB of vertex data. Even with multiple models per VB, you can't fit that into any card. On a Win32 system, Windows reserves 2GB of address space, giving apps an upper limit of 2GB of memory usage. 1.8GB for vertices alone isn't realistic.

edit: Nicer google URL.

[Edited by - Namethatnobodyelsetook on July 14, 2005 10:06:49 AM]

Share this post


Link to post
Share on other sites
Well... the game already got a Disk caching about models... it loads them as they r present in an area of the Game ( 3D world of course ), of course, at same time just few hundreds models will be then present in memory at same time, and then loaded in VCard Memory...
so, load and releases should be not so frequent... but may be very fragmented about models...

is the switching btw VBs ( I mean draw from different VB having different models ) so performance costing...?

Share this post


Link to post
Share on other sites
Not as much as everyone makes it out to be. Do some testing and measure the costs yourself. 2.2 milliseconds isn't enough of a reason to smash all of your models into one buffer, IMHO. It's much easier to manage with them seperated.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jiia
2.2 milliseconds isn't enough of a reason to smash all of your models into one buffer, IMHO.

Aiming for 60Hz, that's 16.66 ms per frame. 2.2ms is 13% of your time budget. Sure, if you're running fast enough already there's nothing to worry about, but saying 13% of your budget isn't a big deal is misleading.

Not that it will take 2.2ms to change buffers. I'm not sure where your 2.2ms came from. I'm just pointing out that if it did take that long, then it really can be a big deal.

Share this post


Link to post
Share on other sites
yep... agree... 2.2mSec would be too much... if I had to switch about 20 models...should be about 45 mSec...!!!

howevere... I'll check out it...

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!