Fix NVN2 compute constants, indirect mesh draws and empty descriptor sets, and cut the texture pool refresh.

NVN2 compute banks get the dispatch's group counts in bytes 0-0xb, for direct and indirect dispatches; the fog pass
after the integration divided by them. Indirect mesh draws read NVN's {count, first} record as {x, y, z}, so y = 0
drew nothing: each now draws from a ring entry holding {count, 1, 1}, copied on the GPU before the draw. An empty set 1
no longer leaves set 0 pushed with 0 bytes. Compute stages with subgroup operations whose width is a whole number of
subgroups require full subgroups.

The texture pool refresh fell from 3.1-3.7 ms to 1.0 ms a frame in Kokiri Forest: slots with the same descriptor,
address generation and entry generation share one lookup (about 14,500 of 15,000 refills a frame), and registering a
texture and view identical to what the slot holds keeps its resolution. Under 20 GiB of VRAM, ASTC textures are
encoded to BC3 by default (Kokiri: 15.9 to 8.2 GiB, same GPU time). The pool log counts refills by cause and what
invalidates them; frame dumps write BC textures as raw blocks and print a storage buffer's backing span; a profile with
NX2NAVI_PROFILE_FRAMES is written when its window ends; the alpha test logs once that it is not applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-06 21:44:21 -05:00
parent 85f401669f
commit c7257fe652
8 changed files with 223 additions and 19 deletions

View File

@@ -286,6 +286,15 @@ static void job_done(void *arg) {
VmaAllocator vma = vk_ctx()->vma;
vmaInvalidateAllocation(vma, j->alloc, 0, VK_WHOLE_SIZE);
write_images(j);
// A BC texture's raw blocks also go to <name>.bin, packed rows of blocks, so a script can decode them: the PNG
// shows the block words through the integer mapping, which loses their bits.
size_t nl = strlen(j->name);
if (nl > 7 && !strcmp(j->name + nl - 7, "_blocks")) {
char path[600];
snprintf(path, sizeof path, "%s/%s.bin", dir, j->name);
FILE *f = fopen(path, "wb");
if (f) fwrite(j->map, 1, j->bytes, f), fclose(f);
}
vmaDestroyBuffer(vma, j->buf, j->alloc);
plat_add64(&inflight, -(int64_t)j->bytes);
free(j);
@@ -582,7 +591,12 @@ static void describe_bindings(Str *b, const VkExec *ex, const VkPipeInfo *info)
memcpy(&pa, ex->cs_push + r->handle * 4 - 0x10, 8), memcpy(&ps, ex->cs_push + r->handle * 4 - 0x10 + 8, 4);
sp(b, " (push pointer %#llx+%#x)", (unsigned long long)pa, ps);
}
if (st == 5) sp(b, " -> %#llx", (unsigned long long)vk_exec_cs_storage_addr(ex, r));
if (st == 5) { // the address and how far its backing span reaches (what a size-0 binding covers)
uint64_t ca = vk_exec_cs_storage_addr(ex, r);
VkMemSpan ms;
sp(b, " -> %#llx", (unsigned long long)ca);
if (ca && vk_mem_resolve(ca, 1, &ms)) sp(b, " (span %#llx)", (unsigned long long)ms.avail);
}
for (int k = 0; k < 16; k++)
if (ex->ssbo[st][k].addr) {
VkDescriptorBufferInfo cb; // "(copy)": a binding that only reads it uses the submit-time copy (vk_usnap.c)