mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nir: Lock around validation fail shader dumping
This prevents getting mixed-up results if a multi-threaded app has two validation errors in different threads. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
b8e077daee
commit
7dbd934e26
1 changed files with 10 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
#include "nir.h"
|
||||
#include "c11/threads.h"
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
|
|
@ -1180,11 +1181,18 @@ destroy_validate_state(validate_state *state)
|
|||
_mesa_hash_table_destroy(state->errors, NULL);
|
||||
}
|
||||
|
||||
mtx_t fail_dump_mutex = _MTX_INITIALIZER_NP;
|
||||
|
||||
static void
|
||||
dump_errors(validate_state *state, const char *when)
|
||||
{
|
||||
struct hash_table *errors = state->errors;
|
||||
|
||||
/* Lock around dumping so that we get clean dumps in a multi-threaded
|
||||
* scenario
|
||||
*/
|
||||
mtx_lock(&fail_dump_mutex);
|
||||
|
||||
if (when) {
|
||||
fprintf(stderr, "NIR validation failed %s\n", when);
|
||||
fprintf(stderr, "%d errors:\n", _mesa_hash_table_num_entries(errors));
|
||||
|
|
@ -1203,6 +1211,8 @@ dump_errors(validate_state *state, const char *when)
|
|||
}
|
||||
}
|
||||
|
||||
mtx_unlock(&fail_dump_mutex);
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue