From e92a4f817d1f7a5094066e2a47a246fd5ccf94d6 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 13 Feb 2020 15:29:22 -0500 Subject: mesa: replace some index_size multiplications and divisions with shifts Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Ian Romanick Part-of: --- src/mesa/state_tracker/st_draw.c | 4 ++-- src/mesa/state_tracker/st_draw_feedback.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index b370e552e79..6459b2553c2 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -217,7 +217,7 @@ st_draw_vbo(struct gl_context *ctx, if (!info.index.resource) return; - start = pointer_to_offset(ib->ptr) / info.index_size; + start = pointer_to_offset(ib->ptr) >> ib->index_size_shift; } else { /* indices are in user space memory */ info.has_user_indices = true; @@ -299,7 +299,7 @@ st_indirect_draw_vbo(struct gl_context *ctx, info.index_size = ib->index_size; info.index.resource = st_buffer_object(bufobj)->buffer; - info.start = pointer_to_offset(ib->ptr) / info.index_size; + info.start = pointer_to_offset(ib->ptr) >> ib->index_size_shift; /* Primitive restart is not handled by the VBO module in this case. */ setup_primitive_restart(ctx, &info); diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 14c809c8a09..4e6b67992f3 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -196,7 +196,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, if (bufobj && bufobj->Name) { struct st_buffer_object *stobj = st_buffer_object(bufobj); - start = pointer_to_offset(ib->ptr) / index_size; + start = pointer_to_offset(ib->ptr) >> ib->index_size_shift; mapped_indices = pipe_buffer_map(pipe, stobj->buffer, PIPE_TRANSFER_READ, &ib_transfer); } @@ -204,7 +204,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, mapped_indices = ib->ptr; } - info.index_size = ib->index_size; + info.index_size = index_size; info.min_index = min_index; info.max_index = max_index; info.has_user_indices = true; -- cgit v1.2.3