GPUBatch: Add GPU_batch_clear to clear batches without freeing
This commit is contained in:
parent
0ee0f0ebf6
commit
c09913e9dd
|
@ -107,6 +107,7 @@ GPUBatch *GPU_batch_duplicate(GPUBatch *batch_src);
|
|||
#define GPU_batch_init(batch, prim, verts, elem) \
|
||||
GPU_batch_init_ex(batch, prim, verts, elem, 0)
|
||||
|
||||
void GPU_batch_clear(GPUBatch *); /* Same as discard but does not free. */
|
||||
void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */
|
||||
|
||||
void GPU_batch_vao_cache_clear(GPUBatch *);
|
||||
|
|
|
@ -125,7 +125,7 @@ GPUBatch *GPU_batch_duplicate(GPUBatch *batch_src)
|
|||
return batch;
|
||||
}
|
||||
|
||||
void GPU_batch_discard(GPUBatch *batch)
|
||||
void GPU_batch_clear(GPUBatch *batch)
|
||||
{
|
||||
if (batch->owns_flag & GPU_BATCH_OWNS_INDEX) {
|
||||
GPU_indexbuf_discard(batch->elem);
|
||||
|
@ -148,6 +148,11 @@ void GPU_batch_discard(GPUBatch *batch)
|
|||
if (batch->free_callback) {
|
||||
batch->free_callback(batch, batch->callback_data);
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_batch_discard(GPUBatch *batch)
|
||||
{
|
||||
GPU_batch_clear(batch);
|
||||
MEM_freeN(batch);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue