mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 12:25:56 +00:00
Let TOTK_DUMP_UBO set how many vec4 of each uniform block are printed
The value is now a count (1 still means 16, capped at 4096), so blocks such as the deferred lighting shaders' camera block, whose shadow cascade matrices sit at vec4 42 to 58, can be read from a frame dump. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc5eb0cb15
commit
45f24a72e3
1 file changed
+8
-5
+8
-5
@@ -18,8 +18,8 @@
|
||||
// as x/2+1/2, UNORM and sRGB bytes written as stored. Caps: MAX_PASSES passes copied, PNG_CAP bytes of PNGs.
|
||||
// TOTK_DUMP_TEX=<id>|<w>x<h>[,...]: those texture slots, or 2D textures of that size, are copied where first sampled,
|
||||
// whatever their format.
|
||||
// TOTK_DUMP_UBO=1: each listed pipeline also prints the first 16 vec4 of its user uniform blocks (c3 and up), read from
|
||||
// guest memory when the entry is listed. A block the submission rewrites with UpdateUniformBuffer shows its value from
|
||||
// TOTK_DUMP_UBO=<n>: each listed pipeline also prints the first n vec4 of its user uniform blocks (c3 and up; 1 means 16,
|
||||
// the cap is 4096), read from guest memory when the entry is listed. A block the submission rewrites with UpdateUniformBuffer shows its value from
|
||||
// before the submission (vk_exec_draw.c upd_note).
|
||||
// TOTK_DUMP_SKIP_RUNS=1: a render pass with the same targets as the render pass before it is logged but not copied
|
||||
// (the terrain decals draw one pass each into the G-buffer and would use up both caps).
|
||||
@@ -48,7 +48,7 @@ static uint64_t dump_frame, log_from; // log_from: TOTK_DUMP_LOG, first frame
|
||||
static char dir[400];
|
||||
static FILE *passes_f, *images_f;
|
||||
static int seq, finished, copied; // copied: passes and dispatches of the dump frame whose images were copied
|
||||
static int skip_runs, dump_ubo; // TOTK_DUMP_SKIP_RUNS, TOTK_DUMP_UBO
|
||||
static int skip_runs, dump_ubo; // TOTK_DUMP_SKIP_RUNS, TOTK_DUMP_UBO (vec4 per block, 0 for none)
|
||||
static uint32_t want_tex[16][2]; // TOTK_DUMP_TEX: slot id and 0, or width and height
|
||||
static int nwant_tex;
|
||||
static uint64_t last_targets; // targets_sig of the last render pass; 0 after a dispatch
|
||||
@@ -576,7 +576,7 @@ static void describe_bindings(Str *b, const VkExec *ex, const VkPipeInfo *info)
|
||||
if (u->addr && vk_mem_resolve(u->addr, 1, &ms)) {
|
||||
uint64_t n = u->size && u->size < ms.avail ? u->size : ms.avail;
|
||||
const float *f = (const float *)(uintptr_t)u->addr;
|
||||
for (uint64_t k = 0; k < 16 && (k + 1) * 16 <= n; k++)
|
||||
for (uint64_t k = 0; k < (uint64_t)dump_ubo && (k + 1) * 16 <= n; k++)
|
||||
sp(b, "%s[%llu] %g %g %g %g", k % 4 ? " " : "\n ", (unsigned long long)k, f[4 * k], f[4 * k + 1],
|
||||
f[4 * k + 2], f[4 * k + 3]);
|
||||
} else {
|
||||
@@ -879,7 +879,10 @@ void vk_dump_init(void) {
|
||||
const char *sr = cfg_get("TOTK_DUMP_SKIP_RUNS");
|
||||
skip_runs = sr && *sr && *sr != '0';
|
||||
const char *du = cfg_get("TOTK_DUMP_UBO");
|
||||
dump_ubo = du && *du && *du != '0';
|
||||
dump_ubo = du && *du ? atoi(du) : 0;
|
||||
if (dump_ubo == 1) dump_ubo = 16;
|
||||
if (dump_ubo > 4096) dump_ubo = 4096;
|
||||
if (dump_ubo < 0) dump_ubo = 0;
|
||||
const char *wt = cfg_get("TOTK_DUMP_TEX");
|
||||
for (char *q = (char *)wt; q && *q && nwant_tex < 16; q += *q == ',') {
|
||||
uint32_t *w = want_tex[nwant_tex++];
|
||||
|
||||
Reference in new issue
Block a user