summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_validate.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-10-18 15:18:30 -0500
committerJason Ekstrand <[email protected]>2018-10-26 11:45:29 -0500
commit28bb6abd1da83b26a9764598e39f80399b505b94 (patch)
tree848a7d456b8504dfb325abf8ed8b04de320762d0 /src/compiler/nir/nir_validate.c
parent292ebdbf985f09e9af3dec28af784247510e0904 (diff)
nir/validate: Print when the validation failed
Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_validate.c')
-rw-r--r--src/compiler/nir/nir_validate.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index cf7ef91f08c..62893cad87e 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -1140,11 +1140,17 @@ destroy_validate_state(validate_state *state)
}
static void
-dump_errors(validate_state *state)
+dump_errors(validate_state *state, const char *when)
{
struct hash_table *errors = state->errors;
- fprintf(stderr, "%d errors:\n", _mesa_hash_table_num_entries(errors));
+ if (when) {
+ fprintf(stderr, "NIR validation failed %s\n", when);
+ fprintf(stderr, "%d errors:\n", _mesa_hash_table_num_entries(errors));
+ } else {
+ fprintf(stderr, "NIR validation failed with %d errors:\n",
+ _mesa_hash_table_num_entries(errors));
+ }
nir_print_shader_annotated(state->shader, stderr, errors);
@@ -1160,7 +1166,7 @@ dump_errors(validate_state *state)
}
void
-nir_validate_shader(nir_shader *shader)
+nir_validate_shader(nir_shader *shader, const char *when)
{
static int should_validate = -1;
if (should_validate < 0)
@@ -1223,7 +1229,7 @@ nir_validate_shader(nir_shader *shader)
}
if (_mesa_hash_table_num_entries(state.errors) > 0)
- dump_errors(&state);
+ dump_errors(&state, when);
destroy_validate_state(&state);
}