summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_draw.c')
-rw-r--r--src/mesa/state_tracker/st_draw.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index a21160c956d..6d6fc858de4 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -824,16 +824,17 @@ handle_fallback_primitive_restart(struct pipe_context *pipe,
start * ibuffer->index_size, /* start */
count * ibuffer->index_size, /* length */
PIPE_TRANSFER_READ, &transfer);
+ if (!ptr)
+ return;
+
+ ptr = (uint8_t*)ptr + (ibuffer->offset - start * ibuffer->index_size);
}
else {
ptr = ib->ptr;
+ if (!ptr)
+ return;
}
- if (!ptr)
- return;
-
- ptr = ADD_POINTERS(ptr, ibuffer->offset);
-
sub_prims = find_sub_primitives(ptr, ibuffer->index_size,
0, count, orig_info->restart_index,
&num_sub_prims);