summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-04-27 08:55:36 -0400
committerZack Rusin <[email protected]>2013-04-27 17:28:04 -0400
commitd48054ff222ac75241ca74b8e4080261eae9e8e9 (patch)
tree7259a71ca5f8d03e129653c802139f62dc366131
parente56095dc2e40d6d1e37e123c694a609d16932b4a (diff)
draw: don't crash if GS doesn't emit anything
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 <[email protected]> Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c9
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c9
2 files changed, 18 insertions, 0 deletions
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 7b871c2952d..8d66c885436 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 0873e342a2d..48fb6165bdc 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 );