diff options
author | Luca Barbieri <[email protected]> | 2010-08-21 13:28:38 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-08-21 20:42:15 +0200 |
commit | 28fa9451e1b3fe251923b0de352e34f84dbd6f4a (patch) | |
tree | de2dce3d6d199c5847bdc1f4860b079a1ecc23a1 /src/gallium/drivers/nvfx/nvfx_fragprog.c | |
parent | b2bad53478b6033038b51982db09094337f1f379 (diff) |
nvfx: add option to dump shaders in TGSI and native code
Diffstat (limited to 'src/gallium/drivers/nvfx/nvfx_fragprog.c')
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_fragprog.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 0a599c62a74..6d2957c82b3 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -2,10 +2,12 @@ #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "util/u_inlines.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" +#include "tgsi/tgsi_dump.h" #include "nvfx_context.h" #include "nvfx_shader.h" @@ -748,6 +750,8 @@ out_err: return FALSE; } +DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_fp, "NVFX_DUMP_FP", FALSE) + static void nvfx_fragprog_translate(struct nvfx_context *nvfx, struct nvfx_fragment_program *fp) @@ -803,6 +807,17 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, fp->insn[fpc->inst_offset + 2] = 0x00000000; fp->insn[fpc->inst_offset + 3] = 0x00000000; + if(debug_get_option_nvfx_dump_fp()) + { + debug_printf("\n"); + tgsi_dump(fp->pipe.tokens, 0); + + debug_printf("\n%s fragment program:\n", nvfx->is_nv4x ? "nv4x" : "nv3x"); + for (unsigned i = 0; i < fp->insn_len; i += 4) + debug_printf("%3u: %08x %08x %08x %08x\n", i >> 2, fp->insn[i], fp->insn[i + 1], fp->insn[i + 2], fp->insn[i + 3]); + debug_printf("\n"); + } + fp->translated = TRUE; out_err: tgsi_parse_free(&parse); |