mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 09:09:56 -04:00
Check that a part's CPU inputs reach the GPU ahead of its own noted writes, and let a frame dump pick shaders and keep raw texels.
This pull request fixed lighting that added up frame after frame under shadow storage on Linux: a GPU write noted while a part was recorded kept that part's CPU inputs (the game's resets of its lighting accumulators) out of the shadow. Its fix marked noted ranges as submitted in vk_memory.c; the base copies that came with the black-world fix already move every CPU-changed byte in before the part runs, so that part is not taken and no SHADOW_PENDING_INPUTS setting is added. Taken from it: - tex_probe.c (--probe-vkmem): a range noted as a future GPU write still gets the CPU's bytes before the GPU reads it. The pull request's other check, that a CPU write made after a GPU result loses to it until the write-back, is left out: with base copies the later CPU write wins, as it does on the console. - vk_dump.c: NX2NAVI_DUMP_SHADERS=<hash>,... copies images only for passes that use those shaders, and NX2NAVI_DUMP_RAW=1 also saves each copied image's texel bytes. - tools/fix_linux_ambient_power.py, as it is: patches one translated shader of a player's own cache so a zero exponent no longer gives NaN. It holds two hashes and no shader data. Pull request #264 by intellq. The Windows files compile; the probe was not run, and nothing was run on Linux here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -348,6 +348,7 @@ static int test_import(pool_t *pool) {
|
||||
vk_mem_resolve(a + 0x1000, 0x20000, &sp);
|
||||
mem_written_pages(a, pool->size, pages, 64);
|
||||
vk_mem_gpu_pending(a + 0x1000, 0x20000);
|
||||
vk_mem_shadow_sync(); // as a submit does: the part's CPU inputs go in before its GPU work
|
||||
copy_wait(sb, 0, sp.buffer, sp.offset, 0x20000);
|
||||
vk_gpu_written(a + 0x1000, 0x20000);
|
||||
GCHECK(!memcmp(m + 0x1000, s, 0x20000), "GPU copy into the imported heap range differs from the source");
|
||||
@@ -362,10 +363,14 @@ static int test_import(pool_t *pool) {
|
||||
GCHECK(n == 4 && pages[0] == a + 0x30000 && pages[3] == a + 0x33000, "CPU writes to 4 pages: %llu reported",
|
||||
(unsigned long long)n);
|
||||
vk_mem_resolve(a + 0x30000, 0x4000, &sp);
|
||||
// A GPU write noted for the part being submitted must not keep the part's CPU inputs out: a buffer the shaders
|
||||
// add to and the CPU resets (the game's lighting accumulators) depends on the reset reaching the GPU first.
|
||||
vk_mem_gpu_pending(a + 0x30000, 0x4000);
|
||||
vk_mem_shadow_sync();
|
||||
copy_wait(sp.buffer, sp.offset, sb, 0, 0x4000);
|
||||
vmaInvalidateAllocation(c->vma, sa, 0, VK_WHOLE_SIZE);
|
||||
GCHECK(!memcmp(s, m + 0x30000, 0x4000), "GPU read of CPU-written heap differs");
|
||||
vk_gpu_written(a + 0x30000, 0x4000);
|
||||
vmaDestroyBuffer(c->vma, sb, sa);
|
||||
|
||||
// generations: written after `since` -> 1, then 0, explicit host write -> 1
|
||||
|
||||
Reference in New Issue
Block a user