diff options
author | Nicolai Haehnle <[email protected]> | 2008-06-14 03:34:09 +0200 |
---|---|---|
committer | Nicolai Haehnle <[email protected]> | 2008-06-14 04:15:20 +0200 |
commit | 2882e5162525138316db9a1ab539a17498d06da1 (patch) | |
tree | 91e1eeeca3c080254f468b17804ad858e5930b01 /src | |
parent | e34dc8227c1fa8bc9ffcd311de701053a633a7ec (diff) |
r300: Add radeonCompilerDump for debugging
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_program.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_program.h | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 4c6289298e7..814ccd3eacc 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -301,6 +301,11 @@ void r300TranslateFragmentShader(r300ContextPtr r300, &compiler.compiler.Clauses[0], 1, transformations); + if (RADEON_DEBUG & DEBUG_PIXEL) { + _mesa_printf("Compiler state after transformations:\n"); + radeonCompilerDump(&compiler.compiler); + } + if (!r300FragmentProgramEmit(&compiler)) fp->error = GL_TRUE; diff --git a/src/mesa/drivers/dri/r300/radeon_program.c b/src/mesa/drivers/dri/r300/radeon_program.c index 41cedbe61dc..c8f40e81893 100644 --- a/src/mesa/drivers/dri/r300/radeon_program.c +++ b/src/mesa/drivers/dri/r300/radeon_program.c @@ -27,6 +27,7 @@ #include "radeon_program.h" +#include "shader/prog_print.h" /** * Initialize a compiler structure with a single mixed clause @@ -79,6 +80,37 @@ int radeonCompilerAllocateTemporary(struct radeon_compiler *compiler) } +static const char* clausename(int type) +{ + switch(type) { + case CLAUSE_MIXED: return "CLAUSE_MIXED"; + case CLAUSE_ALU: return "CLAUSE_ALU"; + case CLAUSE_TEX: return "CLAUSE_TEX"; + default: return "CLAUSE_UNKNOWN"; + } +} + + +/** + * Dump the current compiler state to the console for debugging. + */ +void radeonCompilerDump(struct radeon_compiler *compiler) +{ + int i; + for(i = 0; i < compiler->NumClauses; ++i) { + struct radeon_clause *clause = &compiler->Clauses[i]; + int j; + + _mesa_printf("%2i: %s\n", i+1, clausename(clause->Type)); + + for(j = 0; j < clause->NumInstructions; ++j) { + _mesa_printf("%4i: ", j+1); + _mesa_print_instruction(&clause->Instructions[j]); + } + } +} + + /** * \p position index of the new clause; later clauses are moved * \p type of the new clause; one of CLAUSE_XXX diff --git a/src/mesa/drivers/dri/r300/radeon_program.h b/src/mesa/drivers/dri/r300/radeon_program.h index 3cde4d4f6fc..25e70505b16 100644 --- a/src/mesa/drivers/dri/r300/radeon_program.h +++ b/src/mesa/drivers/dri/r300/radeon_program.h @@ -104,6 +104,7 @@ void radeonCompilerInit( struct gl_program *source); void radeonCompilerCleanup(struct radeon_compiler *compiler); int radeonCompilerAllocateTemporary(struct radeon_compiler *compiler); +void radeonCompilerDump(struct radeon_compiler *compiler); struct radeon_clause *radeonCompilerInsertClause( struct radeon_compiler *compiler, |