diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-10 02:43:50 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-13 15:20:24 +0300 |
commit | e0f5f95e66999765df05ddf0e4b5452a34875cf6 (patch) | |
tree | af9617035d7523c853a5aa8350246ac4ae1aefca /source/blender/gpu/intern/gpu_batch.cc | |
parent | 157f2a20e6bd539604a0d5ff48a4b7741eb1952b (diff) |
DRW: InstanceData: Remove hacks of batch freeing callback
We instead use a handle reference counter on the GPUVertBufs used by
the instancing batches. This make sure that if an update happens on the
GPUVertBuf used to contruct the batch, they will never have the same
memory address than the previously allocated ones (since they are still
pending deletion thanks to the refcounter).
This avoid the linear search to update the GPUBatch in the case a
batch is deleted (which was even a bad option since they could be only
cleared)
Diffstat (limited to 'source/blender/gpu/intern/gpu_batch.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.cc | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index e24b0122c79..fa2c8d728cb 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -120,7 +120,6 @@ void GPU_batch_init_ex( batch->phase = GPU_BATCH_READY_TO_DRAW; batch->is_dynamic_vao_count = false; batch->owns_flag = owns_flag; - batch->free_callback = NULL; } /* This will share the VBOs with the new batch. */ @@ -159,22 +158,10 @@ void GPU_batch_clear(GPUBatch *batch) void GPU_batch_discard(GPUBatch *batch) { - if (batch->free_callback) { - batch->free_callback(batch, batch->callback_data); - } - GPU_batch_clear(batch); MEM_freeN(batch); } -void GPU_batch_callback_free_set(GPUBatch *batch, - void (*callback)(GPUBatch *, void *), - void *user_data) -{ - batch->free_callback = callback; - batch->callback_data = user_data; -} - void GPU_batch_instbuf_set(GPUBatch *batch, GPUVertBuf *inst, bool own_vbo) { #if TRUST_NO_ONE |