diff options
author | Marek Olšák <[email protected]> | 2020-02-20 16:20:25 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-06 01:06:14 +0000 |
commit | 313e98fb8111c21fc89d2422d50dc12daec4efc6 (patch) | |
tree | 30f61be59ece632dc67929c371147f03fa75c7ba /src/mesa/main/glthread.c | |
parent | 19151e2605c95498f9dbc85fa85e10e851df374d (diff) |
glthread: reduce pointer dereferences in glthread_unmarshal_batch
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
Diffstat (limited to 'src/mesa/main/glthread.c')
-rw-r--r-- | src/mesa/main/glthread.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index 3b605183483..eae468e211c 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -44,19 +44,21 @@ glthread_unmarshal_batch(void *job, int thread_index) { struct glthread_batch *batch = (struct glthread_batch*)job; struct gl_context *ctx = batch->ctx; - size_t pos = 0; + int pos = 0; + int used = batch->used; + uint8_t *buffer = batch->buffer; _glapi_set_dispatch(ctx->CurrentServerDispatch); - while (pos < batch->used) { + while (pos < used) { const struct marshal_cmd_base *cmd = - (const struct marshal_cmd_base *)&batch->buffer[pos]; + (const struct marshal_cmd_base *)&buffer[pos]; _mesa_unmarshal_dispatch[cmd->cmd_id](ctx, cmd); pos += cmd->cmd_size; } - assert(pos == batch->used); + assert(pos == used); batch->used = 0; } |