Game Development Community

Cleaning up VB's

by Sean H. · in Torque 3D Professional · 07/29/2010 (7:04 am) · 2 replies

When are hardware vertex buffers deleted/cleaned up in T3D? Does this occur when an object which references the vertex buffer gets deleted, or are they all deleted at one time when the application closes?

I hate creating a thread for such a simple question but I've been asking around the irc channel for awhile and no one seems to have an answer for me.

Any kind of information or guidance would be helpful.

#1
09/03/2010 (5:14 am)
*update*

When are hardware vertex buffers deleted/cleaned up in T3D? Does this occur when an object which references the vertex buffer gets deleted, or are they all deleted at one time when the application closes?

#2
09/03/2010 (5:21 am)
Hi Sean.

It depends on the type of VB, but in general its when the last reference to that VB is released. GFXVertexBufferHandle<> is what normally takes care of the reference counting duties.

In the case of GFXBufferTypeVolatile those are owned by the GFX device and are reused each frame and only released when the device is destroyed.

You also have the special case of the device reset where the internal DirectX objects are released for GFXBufferTypeDynamic VBs and its up to the user to recreate them.