Mesa (main): r300: only print shader statistics when compilation succeeds

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 24 21:41:11 UTC 2022


Module: Mesa
Branch: main
Commit: e7978412c3f83642d8d0cdf6610b0ac6f7b86308
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7978412c3f83642d8d0cdf6610b0ac6f7b86308

Author: Pavel Ondračka <pavel.ondracka at gmail.com>
Date:   Fri Feb 18 08:48:23 2022 +0100

r300: only print shader statistics when compilation succeeds

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 at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15077>

---

 src/gallium/drivers/r300/compiler/radeon_compiler.c | 11 ++++++-----
 src/gallium/drivers/r300/compiler/radeon_compiler.h |  4 +++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c b/src/gallium/drivers/r300/compiler/radeon_compiler.c
index e85da7a2d1c..a312db8580a 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.c
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c
@@ -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)
diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h
index 55dfafffcc3..fa2fbd47d0e 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.h
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h
@@ -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);
 



More information about the mesa-commit mailing list