gallium: remove padding members from pipe_draw_info

these are no longer used, and the tc usage can be moved to the tc struct

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10166>
This commit is contained in:
Mike Blumenkrantz 2021-04-20 11:50:06 -04:00 committed by Marge Bot
parent dae3113c3d
commit 1d8f8cfec9
3 changed files with 13 additions and 36 deletions

View File

@ -66,6 +66,7 @@ enum tc_call_id {
* not needed. */
struct tc_draw_single {
struct pipe_draw_info info;
unsigned index_bias;
unsigned drawid_offset;
};
@ -121,8 +122,6 @@ simplify_draw_info(struct pipe_draw_info *info)
info->index_bounds_valid = false;
info->take_index_buffer_ownership = false;
info->index_bias_varies = false;
info->_pad2 = 0;
info->_pad3 = 0;
/* This shouldn't be set when merging single draws. */
info->increment_draw_id = false;
@ -144,14 +143,12 @@ simplify_draw_info(struct pipe_draw_info *info)
static bool
is_next_call_a_mergeable_draw(struct tc_draw_single *first_info,
struct tc_call *next,
struct tc_draw_single **next_info,
int *index_bias)
struct tc_draw_single **next_info)
{
if (next->call_id != TC_CALL_draw_single)
return false;
*next_info = (struct tc_draw_single*)&next->payload;
*index_bias = (*next_info)->info._pad2;
simplify_draw_info(&(*next_info)->info);
STATIC_ASSERT(offsetof(struct pipe_draw_info, min_index) ==
@ -187,29 +184,26 @@ tc_batch_execute(void *job, UNUSED int thread_index)
struct tc_call *next = first + first->num_call_slots;
struct tc_draw_single *first_info =
(struct tc_draw_single*)&first->payload;
struct tc_draw_single *next_info = NULL;
int first_index_bias = first_info->info._pad2;
int index_bias = 0;
bool index_bias_varies = false;
struct tc_draw_single *next_info;
simplify_draw_info(&first_info->info);
/* If at least 2 consecutive draw calls can be merged... */
if (next != last && next->call_id == TC_CALL_draw_single &&
first_info->drawid_offset == 0 &&
is_next_call_a_mergeable_draw(first_info, next, &next_info, &index_bias)) {
is_next_call_a_mergeable_draw(first_info, next, &next_info)) {
/* Merge up to 256 draw calls. */
struct pipe_draw_start_count_bias multi[256];
unsigned num_draws = 2;
bool index_bias_varies = first_info->index_bias != next_info->index_bias;
/* u_threaded_context stores start/count in min/max_index for single draws. */
multi[0].start = first_info->info.min_index;
multi[0].count = first_info->info.max_index;
multi[0].index_bias = first_index_bias;
multi[0].index_bias = first_info->index_bias;
multi[1].start = next_info->info.min_index;
multi[1].count = next_info->info.max_index;
multi[1].index_bias = index_bias;
index_bias_varies = first_index_bias != index_bias;
multi[1].index_bias = next_info->index_bias;
if (next_info->info.index_size)
pipe_resource_reference(&next_info->info.index.resource, NULL);
@ -217,13 +211,13 @@ tc_batch_execute(void *job, UNUSED int thread_index)
/* Find how many other draws can be merged. */
next = next + next->num_call_slots;
for (; next != last && num_draws < ARRAY_SIZE(multi) &&
is_next_call_a_mergeable_draw(first_info, next, &next_info, &index_bias);
is_next_call_a_mergeable_draw(first_info, next, &next_info);
next += next->num_call_slots, num_draws++) {
/* u_threaded_context stores start/count in min/max_index for single draws. */
multi[num_draws].start = next_info->info.min_index;
multi[num_draws].count = next_info->info.max_index;
multi[num_draws].index_bias = index_bias;
index_bias_varies |= first_index_bias != index_bias;
multi[num_draws].index_bias = next_info->index_bias;
index_bias_varies |= first_info->index_bias != next_info->index_bias;
if (next_info->info.index_size)
pipe_resource_reference(&next_info->info.index.resource, NULL);
@ -235,12 +229,6 @@ tc_batch_execute(void *job, UNUSED int thread_index)
pipe_resource_reference(&first_info->info.index.resource, NULL);
iter = next;
continue;
} else {
/* reset original index_bias from before simplify_draw_info() */
first_info->info._pad2 = first_index_bias;
if (next != last && next->call_id == TC_CALL_draw_single && first_info->drawid == 0 && next_info)
/* in this case, simplify_draw_info() will have zeroed the data here as well */
next_info->info._pad2 = index_bias;
}
}
@ -2412,7 +2400,7 @@ tc_call_draw_single(struct pipe_context *pipe, union tc_payload *payload)
draw.start = info->info.min_index;
draw.count = info->info.max_index;
draw.index_bias = info->info._pad2;
draw.index_bias = info->index_bias;
info->info.index_bounds_valid = false;
info->info.has_user_indices = false;
@ -2534,7 +2522,7 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
/* u_threaded_context stores start/count in min/max_index for single draws. */
p->info.min_index = offset >> util_logbase2(index_size);
p->info.max_index = draws[0].count;
p->info._pad2 = draws[0].index_bias;
p->index_bias = draws[0].index_bias;
} else {
/* Non-indexed call or indexed with a real index buffer. */
struct tc_draw_single *p =
@ -2548,7 +2536,7 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
/* u_threaded_context stores start/count in min/max_index for single draws. */
p->info.min_index = draws[0].start;
p->info.max_index = draws[0].count;
p->info._pad2 = draws[0].index_bias;
p->index_bias = draws[0].index_bias;
}
return;
}

View File

@ -761,9 +761,6 @@ struct pipe_draw_info
unsigned start_instance; /**< first instance id */
unsigned instance_count; /**< number of instances */
int _pad2; /**< padding for memcmp and index_bias reuse */
unsigned _pad3; /**< id of this draw in a multidraw */
/**
* Primitive restart enable/index (only applies to indexed drawing)
*/

View File

@ -1297,8 +1297,6 @@ _mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
info._pad2 = 0;
info._pad3 = 0;
info.start_instance = baseInstance;
info.instance_count = numInstances;
info.view_mask = 0;
@ -1627,8 +1625,6 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
info._pad2 = 0;
info._pad3 = 0;
info.start_instance = 0;
info.instance_count = 1;
info.view_mask = 0;
@ -1743,8 +1739,6 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
info._pad2 = 0;
info._pad3 = 0;
info.start_instance = baseInstance;
info.instance_count = numInstances;
info.view_mask = 0;
@ -2132,8 +2126,6 @@ _mesa_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
info.take_index_buffer_ownership = false;
info.index_bias_varies = !!basevertex;
/* Packed section end. */
info._pad2 = 0;
info._pad3 = 0;
info.start_instance = 0;
info.instance_count = 1;
info.view_mask = 0;