Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-10 02:43:50 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-13 15:20:24 +0300
commite0f5f95e66999765df05ddf0e4b5452a34875cf6 (patch)
treeaf9617035d7523c853a5aa8350246ac4ae1aefca /source/blender/gpu
parent157f2a20e6bd539604a0d5ff48a4b7741eb1952b (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')
-rw-r--r--source/blender/gpu/GPU_batch.h7
-rw-r--r--source/blender/gpu/intern/gpu_batch.cc13
2 files changed, 0 insertions, 20 deletions
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index 7d18fe739d4..e2bf6a87a0f 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -89,11 +89,6 @@ typedef struct GPUBatch {
uint32_t *vao_ids;
} dynamic_vaos;
};
-
- /* XXX This is the only solution if we want to have some data structure using
- * batches as key to identify nodes. We must destroy these nodes with this callback. */
- void (*free_callback)(struct GPUBatch *, void *);
- void *callback_data;
} GPUBatch;
enum {
@@ -118,8 +113,6 @@ void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */
void GPU_batch_vao_cache_clear(GPUBatch *);
-void GPU_batch_callback_free_set(GPUBatch *, void (*callback)(GPUBatch *, void *), void *);
-
void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo); /* Instancing */
void GPU_batch_elembuf_set(GPUBatch *batch, GPUIndexBuf *elem, bool own_ibo);
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