Frame dumps keep each shader's guest program, and a test switch runs an edited SPIR-V in place of a compute shader.

NX2NAVI_DUMP writes sh_<hash>.code next to sh_<hash>.spv: the guest program the shader was translated from, as its
stored inputs hold it, for a disassembler (a compute program as it is, a graphics stage after its 128-byte header).
NX2NAVI_SPV_OVERRIDE=<dir> runs <dir>/<hash>.spv in place of the compute shader whose SPIR-V has that hash, an edited
copy with the same interface, to look at a shader's intermediate values in a frame dump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 04:07:50 -05:00
parent 8f5e2fe76e
commit 092379def8
5 changed files with 43 additions and 3 deletions

View File

@@ -1875,6 +1875,17 @@ const uint32_t *gfx_shader_spirv(const GfxShader *s, uint64_t *words) {
return s->spirv;
}
// The guest program a shader was translated from, as its stored inputs hold it (the whole program: NVN2 code from its
// first byte), written to path for a disassembler (NX2NAVI_DUMP's sh_<hash>.code). 0: no stored inputs for it.
int gfx_shader_write_code(const GfxShader *s, const char *path) {
Inputs in;
paths();
if (!s || !cache_dir[0] || !in_load(s->iid, &in)) return 0;
int ok = write_file(path, in.code, (size_t)in.length);
free(in.buf);
return ok;
}
int gfx_shader_stage(const GfxShader *s) { return s->stage; }
int gfx_shader_resources(const GfxShader *s, int kind, const GfxShaderRes **res) {