r300: only print shader statistics when compilation succeeds
authorPavel Ondračka <pavel.ondracka@gmail.com>
Fri, 18 Feb 2022 07:48:23 +0000 (08:48 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 24 Feb 2022 21:31:03 +0000 (21:31 +0000)
This allows to disregard the huge shaders that won't run anyway
and hopefully make catching shader regressions that result in a
compile failure easier.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15077>

src/gallium/drivers/r300/compiler/radeon_compiler.c
src/gallium/drivers/r300/compiler/radeon_compiler.h

index e85da7a..a312db8 100644 (file)
@@ -382,14 +382,14 @@ static const char *shader_name[RC_NUM_PROGRAM_TYPES] = {
        "Fragment Program"
 };
 
-void rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pass *list)
+bool rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pass *list)
 {
        for (unsigned i = 0; list[i].name; i++) {
                if (list[i].predicate) {
                        list[i].run(c, list[i].user);
 
                        if (c->Error)
-                               return;
+                               return false;
 
                        if ((c->Debug & RC_DBG_LOG) && list[i].dump) {
                                fprintf(stderr, "%s: after '%s'\n", shader_name[c->type], list[i].name);
@@ -397,6 +397,7 @@ void rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pa
                        }
                }
        }
+       return true;
 }
 
 /* Executes a list of compiler passes given in the parameter 'list'. */
@@ -407,9 +408,9 @@ void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *lis
                rc_print_program(&c->Program);
        }
 
-       rc_run_compiler_passes(c, list);
-
-       print_stats(c);
+       if(rc_run_compiler_passes(c, list)) {
+               print_stats(c);
+       }
 }
 
 void rc_validate_final_shader(struct radeon_compiler *c, void *user)
index 55dfaff..fa2fbd4 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef RADEON_COMPILER_H
 #define RADEON_COMPILER_H
 
+#include <stdbool.h>
+
 #include "memory_pool.h"
 #include "radeon_code.h"
 #include "radeon_program.h"
@@ -159,7 +161,7 @@ struct rc_program_stats {
 void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s);
 
 /* Executes a list of compiler passes given in the parameter 'list'. */
-void rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pass *list);
+bool rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pass *list);
 void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list);
 void rc_validate_final_shader(struct radeon_compiler *c, void *user);