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:
authorCampbell Barton <ideasman42@gmail.com>2017-08-16 12:50:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-08-16 12:51:46 +0300
commit846c11c8cfc2409fd8ed9b4d531124cf12c2ec28 (patch)
tree21b2cad109ec71771ad47cd60a3c90212b7c1800 /source/blender/editors
parent18ce2bfac63046acb484857498caf0af7178c094 (diff)
Gawain: remove GWN_batch_discard_all
Use ownership flags instead.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_draw.c4
-rw-r--r--source/blender/editors/manipulator_library/manipulator_draw_utils.c4
-rw-r--r--source/blender/editors/space_view3d/drawobject.c21
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c6
4 files changed, 19 insertions, 16 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 89400bd24a3..d9175c03e43 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -771,12 +771,12 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3])
GWN_vertbuf_attr_fill(vbo, pos_id, waveform);
/* TODO store the Gwn_Batch inside the scope */
- Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO);
Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR);
GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f);
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
index 26f9ebbe54e..0fb36bca183 100644
--- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c
+++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
@@ -95,7 +95,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
GWN_vertbuf_attr_fill(vbo, nor_id, info->normals);
}
- batch = GWN_batch_create(GWN_PRIM_TRIS, vbo, el);
+ batch = GWN_batch_create_ex(GWN_PRIM_TRIS, vbo, el, GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
GWN_batch_uniform_4fv(batch, "color", color);
@@ -115,7 +115,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
#endif
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
void wm_manipulator_vec_draw(
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index b0d5406e517..8bddcd43d16 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5140,13 +5140,13 @@ static void drawDispListVerts(Gwn_PrimType prim_type, const void *data, unsigned
GWN_vertbuf_attr_fill(vbo, pos_id, data);
- Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
if (wire_col) {
GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f);
}
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
/* convert dispList with elem indices to batch, only support triangles and quads
@@ -5202,7 +5202,8 @@ static void drawDispListElem(
}
}
- Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb));
+ Gwn_Batch *batch = GWN_batch_create_ex(
+ GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb), GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX);
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING);
if (wire_col) {
GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f);
@@ -5210,7 +5211,7 @@ static void drawDispListElem(
GWN_batch_uniform_4f(batch, "color", 0.8f, 0.8f, 0.8f, 1.0f);
GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f);
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
/**
@@ -5653,7 +5654,7 @@ static void draw_vertex_array(Gwn_PrimType prim_type, const float *vert, const f
if (color) GWN_vertbuf_attr_fill_stride(vbo, col_id, stride, color);
}
- Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO);
if (nor && color) {
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR);
GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f);
@@ -5671,7 +5672,7 @@ static void draw_vertex_array(Gwn_PrimType prim_type, const float *vert, const f
if (col) GWN_batch_uniform_4fv(batch, "color", col);
}
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
static void draw_particle_arrays_new(int draw_as, int ob_dt, int select,
@@ -6677,10 +6678,10 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
GWN_vertbuf_attr_fill_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col);
}
- Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_LINE_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO);
Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR);
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
if (pathcol) { MEM_freeN(pathcol); pathcol = NULL; }
@@ -6748,10 +6749,10 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
GWN_vertbuf_attr_fill(vbo, col_id, cd);
- Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO);
Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR);
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
pd += pd ? 3 * point->totkey : 0;
cd += (timed ? 4 : 3) * point->totkey;
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 55c439924cd..d75822cabe1 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1541,13 +1541,15 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no
normalize_v2(normal);
}
+/**
+ */
static void stitch_draw_vbo(Gwn_VertBuf *vbo, Gwn_PrimType prim_type, const float col[4])
{
- Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO);
Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR);
GWN_batch_uniform_4fv(batch, "color", col);
GWN_batch_draw(batch);
- GWN_batch_discard_all(batch);
+ GWN_batch_discard(batch);
}
/* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */