tc: add debug code for tc_set_vertex_elements_for_call_pending

To make sure the issue fixed by the previous commit isn't reintrodued.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37763>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2025-10-08 12:13:42 +02:00 committed by Marge Bot
parent 9296478a15
commit f7725299c3
3 changed files with 23 additions and 2 deletions

View file

@ -559,6 +559,10 @@ tc_batch_flush(struct threaded_context *tc, bool full_copy)
struct tc_batch *next = &tc->batch_slots[tc->next];
unsigned next_id = (tc->next + 1) % TC_MAX_BATCHES;
#if !defined(NDEBUG)
assert(!next->tc_set_vertex_elements_for_call_pending);
#endif
tc_assert(next->num_total_slots != 0);
tc_add_call_end(next);
@ -2296,6 +2300,12 @@ tc_add_set_vertex_elements_and_buffers_call(struct pipe_context *_pipe,
tc_vertex_elements_and_buffers, count,
extra_slots);
p->count = count;
#if !defined(NDEBUG)
struct tc_batch *next = &tc->batch_slots[tc->next];
next->tc_set_vertex_elements_for_call_pending = true;
#endif
return p->slot;
}
@ -5345,6 +5355,9 @@ tc_batch_execute(void *job, UNUSED void *gdata, int thread_index)
tc_batch_check(batch);
tc_set_driver_thread(batch->tc);
#if !defined(NDEBUG)
assert(!batch->tc_set_vertex_elements_for_call_pending);
#endif
assert(!batch->token);
/* setup renderpass info */

View file

@ -531,6 +531,7 @@ struct tc_batch {
uint64_t slots[TC_SLOTS_PER_BATCH];
struct util_dynarray renderpass_infos;
#if !defined(NDEBUG)
bool tc_set_vertex_elements_for_call_pending;
bool closed;
#endif
};
@ -865,9 +866,16 @@ tc_track_vertex_buffer(struct pipe_context *_pipe, unsigned index,
* buffers.
*/
static inline void
tc_set_vertex_elements_for_call(struct pipe_vertex_buffer *buffers,
tc_set_vertex_elements_for_call(struct pipe_context *_pipe,
struct pipe_vertex_buffer *buffers,
void *state)
{
#if !defined(NDEBUG)
struct threaded_context *tc = threaded_context(_pipe);
struct tc_batch *next = &tc->batch_slots[tc->next];
assert(next->tc_set_vertex_elements_for_call_pending);
next->tc_set_vertex_elements_for_call_pending = false;
#endif
void **ptr = (void**)buffers;
ptr[-1] = state;
}

View file

@ -477,7 +477,7 @@ st_update_array_templ(struct st_context *st,
/* Set vertex buffers and elements. */
if (FILL_TC_SET_VB) {
void *state = cso_get_vertex_elements_for_bind(cso, &velements);
tc_set_vertex_elements_for_call(vbuffer, state);
tc_set_vertex_elements_for_call(st->pipe, vbuffer, state);
} else {
cso_set_vertex_buffers_and_elements(cso, &velements, num_vbuffers,
uses_user_vertex_buffers, vbuffer);