summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2010-09-26 22:16:19 -0700
committerTom Stellard <[email protected]>2010-09-27 23:17:11 -0700
commita716952184a7dcd3d95ea6b0d7c130aa801f1cb6 (patch)
treea31c4ad44479846a686d3ca39413bc51827367e1
parent798355d429f3cd6e76bb1d01549c203e443348b6 (diff)
r300/compiler: Print immediate values after "dead constants" pass
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_code.c14
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_code.h1
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c3
3 files changed, 18 insertions, 0 deletions
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 <stdlib.h>
+#include <stdio.h>
#include <string.h>
#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);
}