[Bf-blender-cvs] [c09913e9ddc] blender2.8: GPUBatch: Add GPU_batch_clear to clear batches without freeing

Clément Foucault noreply at git.blender.org
Fri Dec 14 16:36:14 CET 2018


Commit: c09913e9ddc2d93894549923a90ee471c3a368db
Author: Clément Foucault
Date:   Fri Dec 14 00:07:59 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc09913e9ddc2d93894549923a90ee471c3a368db

GPUBatch: Add GPU_batch_clear to clear batches without freeing

===================================================================

M	source/blender/gpu/GPU_batch.h
M	source/blender/gpu/intern/gpu_batch.c

===================================================================

diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index 5f87523829a..d47df08afb6 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -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 *);
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index 2cbeeb26924..d70752e9b2f 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -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);
 }



More information about the Bf-blender-cvs mailing list