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:
authorGermano <germano.costa@ig.com.br>2017-12-14 19:31:08 +0300
committerGermano <germano.costa@ig.com.br>2017-12-14 19:31:08 +0300
commit6b794565aa0658bafff40491cad05c01d1d65000 (patch)
tree747ecb2f6a784ba832e31a7c39361ed0f16499cc /source/blender/draw/intern/draw_cache_impl_displist.c
parent14ac709455065062134b21cf573fcfc99830da42 (diff)
Fix crash with DispLists without vertices
Wee must return VertBuffers even when its size is zero
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_displist.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_displist.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c
index 87ff52c951c..33c4a938a56 100644
--- a/source/blender/draw/intern/draw_cache_impl_displist.c
+++ b/source/blender/draw/intern/draw_cache_impl_displist.c
@@ -121,9 +121,6 @@ static void displist_indexbufbuilder_set(Gwn_IndexBufBuilder *elb, const DispLis
Gwn_VertBuf *DRW_displist_vertbuf_calc_pos_with_normals(ListBase *lb)
{
const int tri_len = curve_render_surface_tri_len_get(lb);
- if (tri_len == 0) {
- return NULL;
- }
static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
@@ -191,16 +188,11 @@ Gwn_IndexBuf *DRW_displist_indexbuf_calc_triangles_in_order(ListBase *lb)
Gwn_IndexBuf **DRW_displist_indexbuf_calc_triangles_in_order_split_by_material(ListBase *lb, uint gpumat_array_len)
{
- const int tri_len = curve_render_surface_tri_len_get(lb);
- if (tri_len == 0) {
- return NULL;
- }
-
- const int vert_len = curve_render_surface_vert_len_get(lb);
-
Gwn_IndexBuf **shaded_triangles_in_order = MEM_callocN(sizeof(*shaded_triangles_in_order) * gpumat_array_len, __func__);
+ const int tri_len = curve_render_surface_tri_len_get(lb);
- {
+ if (tri_len != 0) {
+ const int vert_len = curve_render_surface_vert_len_get(lb);
int i;
Gwn_IndexBufBuilder *elb = BLI_array_alloca(elb, gpumat_array_len);