[Bf-blender-cvs] [b4afd7350d] temp-blender2.8-stable: Gawain : Added Batch_init()

Clément Foucault noreply at git.blender.org
Fri Feb 10 22:53:41 CET 2017


Commit: b4afd7350d9ff54026a8fe51bdaff6d98530a112
Author: Clément Foucault
Date:   Fri Feb 10 22:43:25 2017 +0100
Branches: temp-blender2.8-stable
https://developer.blender.org/rBb4afd7350d9ff54026a8fe51bdaff6d98530a112

Gawain : Added Batch_init()

to init a batch without allocating memory

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

M	source/blender/gpu/gawain/batch.c
M	source/blender/gpu/gawain/batch.h

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

diff --git a/source/blender/gpu/gawain/batch.c b/source/blender/gpu/gawain/batch.c
index a60865d41d..7e3f183c38 100644
--- a/source/blender/gpu/gawain/batch.c
+++ b/source/blender/gpu/gawain/batch.c
@@ -19,20 +19,25 @@ extern bool gpuMatricesDirty(void); // how best to use this here?
 
 Batch* Batch_create(PrimitiveType prim_type, VertexBuffer* verts, ElementList* elem)
 	{
+	Batch* batch = calloc(1, sizeof(Batch));
+
+	Batch_init(batch, prim_type, verts, elem);
+
+	return batch;
+	}
+
+void Batch_init(Batch* batch, PrimitiveType prim_type, VertexBuffer* verts, ElementList* elem)
+	{
 #if TRUST_NO_ONE
 	assert(verts != NULL);
 	assert(prim_type == PRIM_POINTS || prim_type == PRIM_LINES || prim_type == PRIM_TRIANGLES);
 	// we will allow other primitive types in a future update
 #endif
 
-	Batch* batch = calloc(1, sizeof(Batch));
-
 	batch->verts = verts;
 	batch->elem = elem;
 	batch->prim_type = prim_type;
 	batch->phase = READY_TO_DRAW;
-
-	return batch;
 	}
 
 void Batch_discard(Batch* batch)
diff --git a/source/blender/gpu/gawain/batch.h b/source/blender/gpu/gawain/batch.h
index 932ee18270..1e57376c4e 100644
--- a/source/blender/gpu/gawain/batch.h
+++ b/source/blender/gpu/gawain/batch.h
@@ -38,6 +38,7 @@ typedef struct Batch{
 } Batch;
 
 Batch* Batch_create(PrimitiveType, VertexBuffer*, ElementList*);
+void Batch_init(Batch* batch, PrimitiveType prim_type, VertexBuffer* verts, ElementList* elem);
 
 void Batch_discard(Batch*); // verts & elem are not discarded
 void Batch_discard_all(Batch*); // including verts & elem




More information about the Bf-blender-cvs mailing list