summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_pt.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-07-23 01:16:55 -0400
committerZack Rusin <[email protected]>2013-07-25 02:02:36 -0400
commit0e9ec8697353d7a35ea0a2edc63c0c7395f7129e (patch)
tree7a5f04590b5a99ec6e351289b1ce9a92569275dc /src/gallium/auxiliary/draw/draw_pt.c
parent0ac316470813b4f2e825ff4befbbf2135cccce94 (diff)
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 <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index ccde371ffcd..fcc24057db0 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -542,11 +542,12 @@ draw_vbo(struct draw_context *draw,
*/
for (instance = 0; instance < info->instance_count; instance++) {
- draw->instance_id = instance + info->start_instance;
+ unsigned instance_idx = instance + info->start_instance;
draw->start_instance = info->start_instance;
+ draw->instance_id = instance;
/* check for overflow */
- if (draw->instance_id < instance ||
- draw->instance_id < info->start_instance) {
+ if (instance_idx < instance ||
+ instance_idx < draw->start_instance) {
/* if we overflown just set the instance id to the max */
draw->instance_id = 0xffffffff;
}