Module: Mesa Branch: master Commit: 4171a26193e0d155f2e825b2f6e7d478932ddcf5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4171a26193e0d155f2e825b2f6e7d478932ddcf5
Author: Roland Scheidegger <[email protected]> Date: Wed May 15 20:35:21 2019 +0200 auxiliary/draw: fix crash with zero-stride draw auto transform feedback draws get the number of vertices from the transform feedback object. In draw, we'll figure this out with the number of bytes written divided by the stride. However, it is apparently possible we end up with a stride of 0 there (not entirely sure it could happen with GL). Probably when nothing was actually ever written (so we don't actually have a stride set). Just avoid the division by zero by setting the count to 0. Reviewed-by: Jose Fonseca <[email protected]> --- src/gallium/auxiliary/draw/draw_pt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 50286149cd4..eeebca30ce7 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -440,7 +440,8 @@ resolve_draw_info(const struct pipe_draw_info *raw_info, struct draw_so_target *target = (struct draw_so_target *)info->count_from_stream_output; assert(vertex_buffer != NULL); - info->count = target->internal_offset / vertex_buffer->stride; + info->count = vertex_buffer->stride == 0 ? 0 : + target->internal_offset / vertex_buffer->stride; /* Stream output draw can not be indexed */ debug_assert(!info->index_size); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
