gallium/u_threaded: don't call simplify_draw_info redundantly

It's always called for the first and second draw in a row, and if they
can't be merged, the second draw becomes the first draw in the next call,
and simplify_draw_info is called again on that. Thus, it's called twice
on any draw that isn't merged. To prevent that, call it when we add
the draws.

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:
Marek Olšák 2022-08-13 10:04:22 -04:00 committed by Marge Bot
parent 3cb96b18f6
commit 5db7dc599a

View file

@ -3271,8 +3271,6 @@ is_next_call_a_mergeable_draw(struct tc_draw_single *first,
if (next->base.call_id != TC_CALL_draw_single)
return false;
simplify_draw_info(&next->info);
STATIC_ASSERT(offsetof(struct pipe_draw_info, min_index) ==
sizeof(struct pipe_draw_info) - 8);
STATIC_ASSERT(offsetof(struct pipe_draw_info, max_index) ==
@ -3294,8 +3292,6 @@ tc_call_draw_single(struct pipe_context *pipe, void *call, uint64_t *last_ptr)
/* If at least 2 consecutive draw calls can be merged... */
if (next != last &&
next->base.call_id == TC_CALL_draw_single) {
simplify_draw_info(&first->info);
if (is_next_call_a_mergeable_draw(first, next)) {
/* The maximum number of merged draws is given by the batch size. */
struct pipe_draw_start_count_bias multi[TC_SLOTS_PER_BATCH / call_size(tc_draw_single)];
@ -3487,6 +3483,7 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
p->info.min_index = offset >> util_logbase2(index_size);
p->info.max_index = draws[0].count;
p->index_bias = draws[0].index_bias;
simplify_draw_info(&p->info);
} else {
/* Non-indexed call or indexed with a real index buffer. */
struct tc_draw_single *p = drawid_offset > 0 ?
@ -3506,6 +3503,7 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
p->info.min_index = draws[0].start;
p->info.max_index = draws[0].count;
p->index_bias = draws[0].index_bias;
simplify_draw_info(&p->info);
}
/* This must be after tc_add_call, which can flush the batch. */