aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/compiler
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2009-07-23 22:09:11 +0200
committerNicolai Hähnle <[email protected]>2009-07-27 20:32:07 +0200
commit2237d136cd8f964048a4ccdc87e0ffb48af0f73d (patch)
tree5add5acad70f306563360ebfa9c9799b4d9f7f7b /src/mesa/drivers/dri/r300/compiler
parent8bcb6ef786dc41049b56e6efeca0f5788cfefe5a (diff)
r300/compiler: Add rc_print_program
Signed-off-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c24
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index d6cc62ff8bd..fea7f646070 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -194,3 +194,27 @@ void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * progr
c->Program.InputsRead = program->InputsRead;
}
+
+/**
+ * Print program to stderr, default options.
+ */
+void rc_print_program(const struct rc_program *prog)
+{
+ GLuint indent = 0;
+ GLuint linenum = 1;
+ struct rc_instruction *inst;
+
+ fprintf(stderr, "# Radeon Compiler Program\n");
+
+ for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) {
+ fprintf(stderr, "%3d: ", linenum);
+
+ /* Massive hack: We rely on the fact that the printers do not actually
+ * use the gl_program argument (last argument) in debug mode */
+ indent = _mesa_fprint_instruction_opt(
+ stderr, &inst->I,
+ indent, PROG_PRINT_DEBUG, 0);
+
+ linenum++;
+ }
+}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
index 0fcedfcd9dd..9987a3d3bc9 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
@@ -36,6 +36,7 @@
struct radeon_compiler;
struct rc_instruction;
+struct rc_program;
enum {
PROGRAM_BUILTIN = PROGRAM_FILE_MAX /**< not a real register, but a special swizzle constant */
@@ -134,5 +135,6 @@ struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c);
struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after);
void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program);
+void rc_print_program(const struct rc_program *prog);
#endif