summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-18 13:05:48 -0700
committerJason Ekstrand <[email protected]>2016-05-23 19:12:34 -0700
commitd5b4ab2c5f700087ac09238e3cf8252aa3d31d54 (patch)
tree2a3d032cec8044e7dc88a7e585b5092ec735e796
parentad42ab473cb327e9f0498bda9d92cccc4279a0e8 (diff)
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" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 6d9e65e9cfa..b651fd202cd 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -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 {