A Vertex Buffer can be released...?
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
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.
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.
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.
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
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
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.
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]
edit: Nicer google URL.
[Edited by - Namethatnobodyelsetook on July 14, 2005 10:06:49 AM]
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...?
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...?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement