Original Post
I am currently revising my vertex and index buffer management system and am trying to determine if one aspect may not be required. First however I need to explain as to how I manage the buffers: 1. The user request the system to create a vertex and/or index buffer. This buffer is a software buffer that is used for writing and reading purposes and is sized for typically one mesh. 2. The system automatically creates on need, or the user manually requests, hardware side buffers that match the software buffers, however these buffers are typically much bigger than the system buffers, so that multiple objects of the same FVF or user format can be placed in the one buffer. The type of buffer usage determines as to how the system renders the buffers: 2a. Static Persistant: These buffers contain information that will not change over the lifetime of the buffer. (use example: static terrain/ map data). The buffers are accordingly optimised for such type of usage. Data is only written once to these buffers on a per mesh basis (typically done at load/initialisation time). Any further request for rendering will only use these hardware buffers' data. 2b. Dynamic Persistant: These buffers require permament allocation of a segment of a hardware buffer. However they may require frequent writing (use example: morphing character meshes if software morphing is used). The system may upload the software buffer to the hardware buffer if required due to data change. Again the system only renders from this buffer. 2c. Volatile: These buffers don't need permanent space and are only required on a per frame basis. Each frame that a Volatile type mesh is rendered the system has to upload the software buffer to a dynamic hardware buffer (discard optimisation used ofcourse) then the system renders from the hardware buffer. All buffer writes are automatically written in batches only requiring one lock of the hardware buffer per frame. Usage example:
vbm->CreateUserVertexBuffer(blah blah);
vbm->CreateUserIndexBuffer(blah blah);
//fill buffers
//optional manual create hardware buffers (else system autocreate)
vbm->CreateHardwareVertexBuffer(blah blah); //optional
vbm->CreateHardwareIndexBuffer(blah blah); //optional
mesh->Attach(uvb1, uib1);
renderobject->Attach(mesh);
renderer->Enqueue(renderobject);
renderer->Render();
Anyway, my concern is with the dynamic persistant mode. Should I just remove it and only have the volatile and static persistant modes? I am asking because any writes to this buffer cannot make use of the discard nor nooverwrite flags. Also apart from that, is there any problem with my management approach that you can see?