nir/validate: Print when the validation failed
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -2664,7 +2664,7 @@ nir_variable *nir_variable_clone(const nir_variable *c, nir_shader *shader);
|
||||
nir_shader *nir_shader_serialize_deserialize(void *mem_ctx, nir_shader *s);
|
||||
|
||||
#ifndef NDEBUG
|
||||
void nir_validate_shader(nir_shader *shader);
|
||||
void nir_validate_shader(nir_shader *shader, const char *when);
|
||||
void nir_metadata_set_validation_flag(nir_shader *shader);
|
||||
void nir_metadata_check_validation_flag(nir_shader *shader);
|
||||
|
||||
@@ -2698,7 +2698,7 @@ should_print_nir(void)
|
||||
return should_print;
|
||||
}
|
||||
#else
|
||||
static inline void nir_validate_shader(nir_shader *shader) { (void) shader; }
|
||||
static inline void nir_validate_shader(nir_shader *shader, const char *when) { (void) shader; (void)when; }
|
||||
static inline void nir_metadata_set_validation_flag(nir_shader *shader) { (void) shader; }
|
||||
static inline void nir_metadata_check_validation_flag(nir_shader *shader) { (void) shader; }
|
||||
static inline bool should_clone_nir(void) { return false; }
|
||||
@@ -2706,9 +2706,9 @@ static inline bool should_serialize_deserialize_nir(void) { return false; }
|
||||
static inline bool should_print_nir(void) { return false; }
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#define _PASS(nir, do_pass) do { \
|
||||
#define _PASS(pass, nir, do_pass) do { \
|
||||
do_pass \
|
||||
nir_validate_shader(nir); \
|
||||
nir_validate_shader(nir, "after " #pass); \
|
||||
if (should_clone_nir()) { \
|
||||
nir_shader *clone = nir_shader_clone(ralloc_parent(nir), nir); \
|
||||
ralloc_free(nir); \
|
||||
@@ -2720,7 +2720,7 @@ static inline bool should_print_nir(void) { return false; }
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define NIR_PASS(progress, nir, pass, ...) _PASS(nir, \
|
||||
#define NIR_PASS(progress, nir, pass, ...) _PASS(pass, nir, \
|
||||
nir_metadata_set_validation_flag(nir); \
|
||||
if (should_print_nir()) \
|
||||
printf("%s\n", #pass); \
|
||||
@@ -2732,7 +2732,7 @@ static inline bool should_print_nir(void) { return false; }
|
||||
} \
|
||||
)
|
||||
|
||||
#define NIR_PASS_V(nir, pass, ...) _PASS(nir, \
|
||||
#define NIR_PASS_V(nir, pass, ...) _PASS(pass, nir, \
|
||||
if (should_print_nir()) \
|
||||
printf("%s\n", #pass); \
|
||||
pass(nir, ##__VA_ARGS__); \
|
||||
|
Reference in New Issue
Block a user