mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 19:30:12 +01:00
glthread: use a constant expression instead of cmd_size in custom functions
cmd_size is constant in these cases Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18199>
This commit is contained in:
parent
b09a88fb72
commit
83ce647c15
2 changed files with 19 additions and 7 deletions
|
|
@ -292,7 +292,9 @@ _mesa_unmarshal_DrawArrays(struct gl_context *ctx,
|
|||
CALL_DrawArraysInstancedBaseInstance(ctx->CurrentServerDispatch,
|
||||
(mode, first, count, instance_count,
|
||||
baseinstance));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
return cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -609,7 +611,9 @@ _mesa_unmarshal_DrawElementsInstancedARB(struct gl_context *ctx,
|
|||
(mode, count, type, indices,
|
||||
instance_count, basevertex,
|
||||
baseinstance));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
return cmd_size;
|
||||
}
|
||||
|
||||
struct marshal_cmd_DrawRangeElementsBaseVertex
|
||||
|
|
@ -640,7 +644,9 @@ _mesa_unmarshal_DrawRangeElementsBaseVertex(struct gl_context *ctx,
|
|||
CALL_DrawRangeElementsBaseVertex(ctx->CurrentServerDispatch,
|
||||
(mode, min_index, max_index, count,
|
||||
type, indices, basevertex));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
return cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ _mesa_unmarshal_CallList(struct gl_context *ctx, const struct marshal_cmd_CallLi
|
|||
{
|
||||
const GLuint list = cmd->list;
|
||||
uint64_t *ptr = (uint64_t *) cmd;
|
||||
ptr += cmd->cmd_base.cmd_size;
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
ptr += cmd_size;
|
||||
|
||||
if (ptr < last) {
|
||||
const struct marshal_cmd_base *next =
|
||||
|
|
@ -50,13 +53,16 @@ _mesa_unmarshal_CallList(struct gl_context *ctx, const struct marshal_cmd_CallLi
|
|||
|
||||
int count = 2;
|
||||
|
||||
ptr += next->cmd_size;
|
||||
assert(cmd_size == next_callist->cmd_base.cmd_size);
|
||||
ptr += cmd_size;
|
||||
|
||||
while (ptr < last && count < max_list_count) {
|
||||
next = (const struct marshal_cmd_base *)ptr;
|
||||
if (next->cmd_id == DISPATCH_CMD_CallList) {
|
||||
next_callist = (struct marshal_cmd_CallList *) next;
|
||||
lists[count++] = next_callist->list;
|
||||
ptr += next->cmd_size;
|
||||
assert(cmd_size == next_callist->cmd_base.cmd_size);
|
||||
ptr += cmd_size;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
@ -69,7 +75,7 @@ _mesa_unmarshal_CallList(struct gl_context *ctx, const struct marshal_cmd_CallLi
|
|||
}
|
||||
|
||||
CALL_CallList(ctx->CurrentServerDispatch, (list));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
return cmd_size;
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue