mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 03:10:09 +01:00
nvfx: add option to dump shaders in TGSI and native code
This commit is contained in:
parent
b2bad53478
commit
28fa9451e1
2 changed files with 30 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "util/u_linkage.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
|
@ -777,6 +778,8 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_vp, "NVFX_DUMP_VP", FALSE)
|
||||
|
||||
static void
|
||||
nvfx_vertprog_translate(struct nvfx_context *nvfx,
|
||||
struct nvfx_vertex_program *vp)
|
||||
|
|
@ -873,6 +876,18 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx,
|
|||
}
|
||||
|
||||
vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST;
|
||||
|
||||
if(debug_get_option_nvfx_dump_vp())
|
||||
{
|
||||
debug_printf("\n");
|
||||
tgsi_dump(vp->pipe.tokens, 0);
|
||||
|
||||
debug_printf("\n%s vertex program:\n", nvfx->is_nv4x ? "nv4x" : "nv3x");
|
||||
for (i = 0; i < vp->nr_insns; i++)
|
||||
debug_printf("%3u: %08x %08x %08x %08x\n", i, vp->insns[i].data[0], vp->insns[i].data[1], vp->insns[i].data[2], vp->insns[i].data[3]);
|
||||
debug_printf("\n");
|
||||
}
|
||||
|
||||
vp->translated = TRUE;
|
||||
out_err:
|
||||
tgsi_parse_free(&parse);
|
||||
|
|
@ -1025,14 +1040,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
|
|||
|
||||
/* Upload vtxprog */
|
||||
if (upload_code) {
|
||||
#if 0
|
||||
for (i = 0; i < vp->nr_insns; i++) {
|
||||
NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[0]);
|
||||
NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[1]);
|
||||
NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[2]);
|
||||
NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[3]);
|
||||
}
|
||||
#endif
|
||||
BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_FROM_ID, 1);
|
||||
OUT_RING (chan, vp->exec->start);
|
||||
for (i = 0; i < vp->nr_insns; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue