From 0e9ec8697353d7a35ea0a2edc63c0c7395f7129e Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 23 Jul 2013 01:16:55 -0400 Subject: draw: cleanup and fix instance id computation The instance id system value always starts at 0, even if the specified start instance is larger than 0. Instead of implicitly setting instance id to instance id plus start instance and then having to subtract instance id when computing the buffer offsets lets just set instance id to the proper instance id. This fixes instance id computation and cleansup buffer offset computation. Signed-off-by: Zack Rusin Reviewed-by: Roland Scheidegger Reviewed-by: Brian Paul Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/translate/translate_generic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/translate/translate_generic.c') diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 96e35b0eb41..fdab0f34a1a 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -625,8 +625,7 @@ static ALWAYS_INLINE void PIPE_CDECL generic_run_one( struct translate_generic * if (tg->attrib[attr].instance_divisor) { index = start_instance; - index += (instance_id - start_instance) / - 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(). -- cgit v1.2.3