summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-02-13 15:29:22 -0500
committerMarek Olšák <[email protected]>2020-03-04 19:54:42 -0500
commite92a4f817d1f7a5094066e2a47a246fd5ccf94d6 (patch)
tree75136b9e37577a469d885f7283ccbd62f041be03 /src/mesa/state_tracker
parent87085c673d593e6332ca2f3fb6737b77f7087f66 (diff)
mesa: replace some index_size multiplications and divisions with shifts
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4052>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_draw.c4
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c4
2 files changed, 4 insertions, 4 deletions
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;