From 87a90a3b387ed549ea7e7bdaaf25f4e9118a5b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Thu, 27 Feb 2025 21:44:13 +0100 Subject: [PATCH] r300: fix temps counting for shader-db stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RC_FILE_INPUT is pretty much just a RC_FILE_TEMPORARY with an initial value in it. So we regalloc it the same way we do normal temps, however for unknown reasons (probably to have a bit more readable shader dumps) we still keep the RC_FILE_INPUT type even though its the same as temporary. This is handled correctly when emitting the machine code, however, it was not taken into account in shader stats. Signed-off-by: Pavel Ondračka Part-of: --- src/gallium/drivers/r300/compiler/radeon_compiler.c | 3 ++- src/gallium/drivers/r300/compiler/radeon_compiler.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c b/src/gallium/drivers/r300/compiler/radeon_compiler.c index c1bcedd3889..992d400f199 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler.c +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c @@ -378,7 +378,7 @@ reg_count_callback(void *userdata, struct rc_instruction *inst, rc_register_file unsigned int index, unsigned int mask) { struct rc_program_stats *s = userdata; - if (file == RC_FILE_TEMPORARY) + if (file == RC_FILE_TEMPORARY || (s->type == RC_FRAGMENT_PROGRAM && file == RC_FILE_INPUT)) (int)index > s->num_temp_regs ? s->num_temp_regs = index : 0; if (file == RC_FILE_INLINE) s->num_inline_literals++; @@ -391,6 +391,7 @@ rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s) { struct rc_instruction *tmp; memset(s, 0, sizeof(*s)); + s->type = c->type; unsigned ip = 0; int last_begintex = -1; diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h index f02b9551801..30683ed6871 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler.h +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h @@ -130,6 +130,7 @@ struct radeon_compiler_pass { }; struct rc_program_stats { + enum rc_program_type type; unsigned num_cycles; unsigned num_consts; unsigned num_insts;