[Mesa-dev] [PATCH] draw: fix division-by-zero for empty geometry shaders

Marek Olšák maraeo at gmail.com
Sun Mar 1 07:23:09 PST 2015


From: Marek Olšák <marek.olsak at amd.com>

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89372
---
 src/gallium/auxiliary/draw/draw_pt_emit.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index b215c5f..d1eafd8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -113,8 +113,11 @@ draw_pt_emit_prepare(struct pt_emit *emit,
       emit->translate = translate_cache_find(emit->cache, &hw_key);
    }
 
-   *max_vertices = (draw->render->max_vertex_buffer_bytes /
-                    (vinfo->size * 4));
+   if (!vinfo->size)
+      *max_vertices = 0;
+   else
+      *max_vertices = (draw->render->max_vertex_buffer_bytes /
+                       (vinfo->size * 4));
 }
 
 
-- 
2.1.0



More information about the mesa-dev mailing list