Map Ocarina's global memory accesses through pointer tables and summed bases to storage buffers.

The translator dropped 36113 global accesses per Kokiri boot (loads read 0, stores and atomics deleted); 837 remain.
AmpereLowering computes a predicated LEA's carry sum unconditionally, so a base like c[0][0x110] no longer reaches the
address as a phi; the edge AA's tile list is written and its blend weights follow the edges. Patch 0022 extends
GlobalToStorage: a constant-buffer base inside a sum of terms, and buffers reached through a pointer the program loads
from another storage buffer at a constant offset (the pointer tables Ocarina's vertex, pixel, mesh and compute shaders
read, also through register spills and phis). Such a buffer is listed with its outer buffer and offset, and the runtime
binds it at the address read from guest memory when the stage is bound (vk_exec_draw.c ptr_addr). The fog injection's
64x36x96 volumes now hold in-scattering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-06 14:02:22 -05:00
parent eed3e6b786
commit 9b4cca39ca
8 changed files with 470 additions and 23 deletions

View File

@@ -716,6 +716,7 @@ static void add_res(GfxShader *s, int kind, const char *o, const char *e) {
r->cbuf_slot = (int8_t)json_int(o, e, "cb_slot", -1);
r->handle = (uint16_t)json_int(o, e, "cb_offset", 0);
r->flags = (uint8_t)json_int(o, e, "flags", 0);
r->ptr = (uint16_t)(json_int(o, e, "ptr", -1) + 1);
}
return;
}