gallium/util: return correct number of bound vertex buffers
authorPatrick Rudolph <siro@das-labor.org>
Thu, 10 Dec 2015 18:50:38 +0000 (19:50 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 10 Dec 2015 18:55:53 +0000 (13:55 -0500)
commit79bff488bc23b8615cc37069b6c5914c56be835f
treed51927f976c526267c76d49b30511084379fe8ef
parentba67739b662eaf68f7a1117005e20079b2653044
gallium/util: return correct number of bound vertex buffers

In case a state tracker unbinds every slot by a seperate
pipe->set_vertex_buffers() call, starting from slot zero, the number
of bound buffers would not reach zero at all.
The current algorithm does not account for pre-existing holes in the
buffer list.

Unbinding all buffers at once or starting at the top-most slot results
in correct behaviour.

Calculating the correct number of bound buffers fixes a NULL pointer
dereference in nvc0_validate_vertex_buffers_shared().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93004
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
src/gallium/auxiliary/util/u_helpers.c