From be5e437bb5ffcc9d29d9f665d6a13661700a6055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 28 Feb 2018 02:24:21 +0100 Subject: DRW: Fix broken particle drawing. Was caused by GPU_SELECT_LOAD_IF_PICKSEL_LIST not iterating at all if shgroup->instance_count == 0. --- source/blender/draw/intern/draw_manager_exec.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/blender/draw/intern/draw_manager_exec.c') diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 80c10d18bb0..251370d2050 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -582,8 +582,12 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) } #ifdef USE_GPU_SELECT - /* use the first item because of selection we only ever add one */ -# define GPU_SELECT_LOAD_IF_PICKSEL(_call) \ +# define GPU_SELECT_LOAD_IF_PICKSEL(_select_id) \ + if (G.f & G_PICKSEL) { \ + GPU_select_load_id(_select_id); \ + } ((void)0) + +# define GPU_SELECT_LOAD_IF_PICKSEL_CALL(_call) \ if ((G.f & G_PICKSEL) && (_call)) { \ GPU_select_load_id((_call)->head.select_id); \ } ((void)0) @@ -615,7 +619,8 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) } #else -# define GPU_SELECT_LOAD_IF_PICKSEL(call) +# define GPU_SELECT_LOAD_IF_PICKSEL(select_id) +# define GPU_SELECT_LOAD_IF_PICKSEL_CALL(call) # define GPU_SELECT_LOAD_IF_PICKSEL_LIST_END(start, count) # define GPU_SELECT_LOAD_IF_PICKSEL_LIST(_shgroup, _start, _count) \ _start = 0; \ @@ -629,14 +634,9 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) if (ELEM(shgroup->type, DRW_SHG_INSTANCE, DRW_SHG_INSTANCE_EXTERNAL)) { if (shgroup->type == DRW_SHG_INSTANCE_EXTERNAL) { if (shgroup->instance_geom != NULL) { - unsigned int count, start; + GPU_SELECT_LOAD_IF_PICKSEL(shgroup->override_selectid); draw_geometry_prepare(shgroup, NULL); - /* This will only load override_selectid */ - GPU_SELECT_LOAD_IF_PICKSEL_LIST(shgroup, start, count) - { - draw_geometry_execute(shgroup, shgroup->instance_geom); - } - GPU_SELECT_LOAD_IF_PICKSEL_LIST_END(start, count) + draw_geometry_execute(shgroup, shgroup->instance_geom); } } else { @@ -677,7 +677,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) prev_neg_scale = neg_scale; } - GPU_SELECT_LOAD_IF_PICKSEL(call); + GPU_SELECT_LOAD_IF_PICKSEL_CALL(call); if (call->head.type == DRW_CALL_SINGLE) { draw_geometry_prepare(shgroup, &call->state); -- cgit v1.2.3