svga: do primitive trimming in translate_indices()
authorBrian Paul <brianp@vmware.com>
Wed, 13 Nov 2013 18:26:15 +0000 (11:26 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 15 Nov 2013 17:23:48 +0000 (10:23 -0700)
commit79984b9928d4444665ce617a1e4551e53d415bd4
tree0cd60d2e0db97b4a9b0abe47397e1c01bfe77052
parent491d6397fcbe8eabfdd69500b91dbc6efc4dd894
svga: do primitive trimming in translate_indices()

The index translation code expects the number of indexes to be
consistent with the primitive type (ex: a multiple of 3 for
PIPE_PRIM_TRIANGLES).  If it's not, we can write out of bounds
in the destination buffer.

Fixes failed assertions in the pipebuffer debug code found with
Piglit primitive-restart-draw-mode test.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_draw_elements.c