[Mesa-dev] [PATCH] draw: don't crash if GS doesn't emit anything
Chris Forbes
chrisf at ijw.co.nz
Mon Apr 29 16:49:05 PDT 2013
It's only silly if the GS *never* emits any verts...
On Sun, Apr 28, 2013 at 12:57 AM, Zack Rusin <zackr at vmware.com> wrote:
> Technically it's legal for geometry shader to not emit any
> vertices. It's silly, but perfectly legal, so lets make draw
> stop crashing if it happens.
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> ---
> src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 9 +++++++++
> .../auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 9 +++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
> index 7b871c2..8d66c88 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
> @@ -299,6 +299,15 @@ static void fetch_pipeline_generic( struct draw_pt_middle_end *middle,
> }
> }
> }
> + if (prim_info->count == 0) {
> + debug_printf("GS/IA didn't emit any vertices!\n");
> +
> + FREE(vert_info->verts);
> + if (free_prim_info) {
> + FREE(prim_info->primitive_lengths);
> + }
> + return;
> + }
>
>
> /* Stream output needs to be done before clipping.
> diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> index 0873e34..48fb616 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> @@ -397,6 +397,15 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle,
> }
> }
> }
> + if (prim_info->count == 0) {
> + debug_printf("GS/IA didn't emit any vertices!\n");
> +
> + FREE(vert_info->verts);
> + if (free_prim_info) {
> + FREE(prim_info->primitive_lengths);
> + }
> + return;
> + }
>
> /* stream output needs to be done before clipping */
> draw_pt_so_emit( fpme->so_emit, vert_info, prim_info );
> --
> 1.7.10.4
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list