trace: Allow to control nir dumping via an environment variable.
As requested by Mike Blumenkrantz. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
This commit is contained in:
@@ -68,6 +68,7 @@ static FILE *stream = NULL;
|
||||
static mtx_t call_mutex = _MTX_INITIALIZER_NP;
|
||||
static long unsigned call_no = 0;
|
||||
static bool dumping = false;
|
||||
static long nir_count = 0;
|
||||
|
||||
static bool trigger_active = true;
|
||||
static char *trigger_filename = NULL;
|
||||
@@ -252,6 +253,8 @@ trace_dump_trace_begin(void)
|
||||
if (!filename)
|
||||
return false;
|
||||
|
||||
nir_count = debug_get_num_option("GALLIUM_TRACE_NIR", 32);
|
||||
|
||||
if (!stream) {
|
||||
|
||||
if (strcmp(filename, "stderr") == 0) {
|
||||
@@ -654,6 +657,17 @@ void trace_dump_nir(void *nir)
|
||||
if (!dumping)
|
||||
return;
|
||||
|
||||
if (nir_count < 0) {
|
||||
fputs("<string>...</string>", stream);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((nir_count--) == 0) {
|
||||
fputs("<string>Set GALLIUM_TRACE_NIR to a sufficiently big number "
|
||||
"to enable NIR shader dumping.</string>", stream);
|
||||
return;
|
||||
}
|
||||
|
||||
// NIR doesn't have a print to string function. Use CDATA and hope for the
|
||||
// best.
|
||||
if (stream) {
|
||||
|
||||
Reference in New Issue
Block a user