From a716952184a7dcd3d95ea6b0d7c130aa801f1cb6 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sun, 26 Sep 2010 22:16:19 -0700 Subject: r300/compiler: Print immediate values after "dead constants" pass --- src/mesa/drivers/dri/r300/compiler/radeon_code.c | 14 ++++++++++++++ src/mesa/drivers/dri/r300/compiler/radeon_code.h | 1 + .../drivers/dri/r300/compiler/radeon_remove_constants.c | 3 +++ 3 files changed, 18 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.c b/src/mesa/drivers/dri/r300/compiler/radeon_code.c index 0eab18c344d..6842fb873bc 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.c @@ -28,6 +28,7 @@ #include "radeon_code.h" #include +#include #include #include "radeon_program.h" @@ -171,3 +172,16 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da return rc_constants_add(c, &constant); } + +void rc_constants_print(struct rc_constant_list * c) +{ + unsigned int i; + for(i = 0; i < c->Count; i++) { + if (c->Constants[i].Type == RC_CONSTANT_IMMEDIATE) { + float * values = c->Constants[i].u.Immediate; + fprintf(stderr, "CONST[%u] = " + "{ %10.4f %10.4f %10.4f %10.4f }\n", + i, values[0],values[1], values[2], values[3]); + } + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 2dd9c5e4bd3..cfb6df2cd79 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -90,6 +90,7 @@ unsigned rc_constants_add(struct rc_constant_list * c, struct rc_constant * cons unsigned rc_constants_add_state(struct rc_constant_list * c, unsigned state1, unsigned state2); unsigned rc_constants_add_immediate_vec4(struct rc_constant_list * c, const float * data); unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float data, unsigned * swizzle); +void rc_constants_print(struct rc_constant_list * c); /** * Compare functions. diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c index d111319d3d9..2e0e4ef898c 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -146,4 +146,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) free(const_used); free(inv_remap_table); + + if (c->Debug) + rc_constants_print(&c->Program.Constants); } -- cgit v1.2.3