mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-21 14:29:58 -04:00
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:
@@ -838,8 +838,11 @@ static class AmpereLowering
|
||||
ulong iscadd(int dst, int bb) => 0x5c18000000000000UL | ((ulong)shift << 39) | ((ulong)bb << 20) | ((ulong)a << 8) | (uint)dst | (negB ? 1UL << 48 : 0);
|
||||
if (carry == 7) { EmitG(iscadd(d, b)); return; }
|
||||
if (negB) throw Fail("LEA carry out with negated b");
|
||||
Mov(SX, b);
|
||||
EmitG(iscadd(SC, SX));
|
||||
// The sum goes to scratch unconditionally; only the destination and the carry are guarded. A guarded
|
||||
// copy of b made a constant-buffer base (c[0][0x110] in Ocarina's edge-AA tile list, prog 98) a phi
|
||||
// of it and the scratch register's old value, and GlobalToStorage could not find the buffer.
|
||||
Mov(SX, b, false);
|
||||
Emit(Unguarded(iscadd(SC, SX)));
|
||||
if (d != RZ) Mov(d, SC);
|
||||
IsetpLtU((int)carry, SC, SX); // carry = sum < b
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user