r300: fix temps counting for shader-db stats

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 <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33817>
This commit is contained in:
Pavel Ondračka
2025-02-27 21:44:13 +01:00
committed by Marge Bot
parent 15e0e53b4d
commit 87a90a3b38
2 changed files with 3 additions and 1 deletions
@@ -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;
@@ -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;