gallium/u_vbuf: Protect against overflow with large instance divisors.
authorEric Anholt <eric@anholt.net>
Tue, 20 Mar 2018 17:42:12 +0000 (10:42 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 27 Mar 2018 00:33:37 +0000 (17:33 -0700)
commit0356db022da819176d9d0eacab63d4c2c852f876
treee0ff9bd91ab5bd52f5dc565263cc9424b3b2708f
parentd491ad1d364afa60eef5cf7b45f69f7007ab3dfd
gallium/u_vbuf: Protect against overflow with large instance divisors.

GTF-GLES3.gtf.GL3Tests.instanced_arrays.instanced_arrays_divisor uses -1
as a divisor, so we would overflow to count=0 and upload no data,
triggering the assert below.  We want to upload 1 element in this case,
fixing the test on VC5.

v2: Use some more obvious logic, and explain why we don't use the normal
    round_up().

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/util/u_vbuf.c