[Bf-blender-cvs] [b97864203e] blender2.8: Gawain : Added Batch_init()
Clément Foucault
noreply at git.blender.org
Sat Feb 11 00:47:30 CET 2017
Commit: b97864203ecd4df2b7b5d297c2e0203705c8f431
Author: Clément Foucault
Date: Fri Feb 10 22:43:25 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBb97864203ecd4df2b7b5d297c2e0203705c8f431
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 99c1330117..3ddc6c7f63 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 8b5c48cca7..a328d64966 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