draw: fix division-by-zero for empty geometry shaders
authorMarek Olšák <marek.olsak@amd.com>
Sun, 1 Mar 2015 10:18:42 +0000 (11:18 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 2 Mar 2015 11:46:36 +0000 (12:46 +0100)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89372

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/draw/draw_pt_emit.c

index b215c5f4db440072fd301799f3a76814a7c90b6b..d1eafd8403259e236822bbd6c9c68816bc5f207a 100644 (file)
@@ -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));
 }