i965/draw: Properly handle rounding when dividing by InstanceDivisor

The old code always divided rounded down and then subtracted 1.  What we
wanted was to divide rounded up and then subtract 1 which is equivalent to
subtracting 1 and then dividing rounded down.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand 2016-05-18 13:05:48 -07:00
parent ad42ab473c
commit d5b4ab2c5f
1 changed files with 2 additions and 2 deletions

View File

@ -474,8 +474,8 @@ brw_prepare_vertices(struct brw_context *brw)
if (glarray->InstanceDivisor) {
if (brw->num_instances) {
start = offset + glarray->StrideB * brw->baseinstance;
range = (glarray->StrideB * ((brw->num_instances /
glarray->InstanceDivisor) - 1) +
range = (glarray->StrideB * ((brw->num_instances - 1) /
glarray->InstanceDivisor) +
glarray->_ElementSize);
}
} else {