mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 01:49:59 -04:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user