if (tg->attrib[attr].instance_divisor) {
index = instance_id / tg->attrib[attr].instance_divisor;
+ /* XXX we need to clamp the index here too, but to a
+ * per-array max value, not the draw->pt.max_index value
+ * that's being given to us via translate->set_buffer().
+ */
}
else {
index = elt;
+ /* clamp to avoid going out of bounds */
+ index = MIN2(index, tg->attrib[attr].max_index);
}
- /* clamp to void going out of bounds */
- index = MIN2(index, tg->attrib[attr].max_index);
-
src = tg->attrib[attr].input_ptr +
tg->attrib[attr].input_stride * index;
x86_mov_reg_imm(p->func, tmp_ECX, variant->instance_divisor);
x86_div(p->func, tmp_ECX); /* EAX = EDX:EAX / ECX */
}
+
+ /* XXX we need to clamp the index here too, but to a
+ * per-array max value, not the draw->pt.max_index value
+ * that's being given to us via translate->set_buffer().
+ */
} else {
x86_mov(p->func, tmp_EAX, elt);
- }
- /* Clamp to max_index
- */
- x86_cmp(p->func, tmp_EAX, buf_max_index);
- x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
+ /* Clamp to max_index
+ */
+ x86_cmp(p->func, tmp_EAX, buf_max_index);
+ x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
+ }
x86_imul(p->func, tmp_EAX, buf_stride);
x64_rexw(p->func);
x86_cmp(p->func, p->count_EBP, p->tmp_EAX);
-
/* In the linear case, keep the buffer pointer instead of the
* index number.
*/