mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 23:59:59 -04:00
Send atomics through the device address table to guest memory too, so the trees no longer flicker or stretch into columns.
The culling passes count each frame's visible foliage with atomics through the device address table into small records (an indirect draw's count, then 1, 1). Stores through the table already reached both the VRAM mirror and its guest copy, but atomics reached the mirror only, so guest memory held the CPU's template of zeros. The CPU writes other words of the same pages every frame, and the sync of such a page copied those zeros over the counts: in Hyrule Field the trees flickered, went missing or stretched into columns reaching the sky. NX2NAVI_MEMORY=verify found 5 to 10 such pages a minute, all in ten pools of 20 and 44 KiB. Translator patch 0036 repeats every table atomic on the twin (a compare-exchange with the same operands), leaving its result unused so the driver need not wait on guest memory. A buffer fill into a mirror now fills its guest copy at once (vk_mem_guest_twin), so a counter the GPU resets that way counts on from the same value in both; that mismatch is why table atomics stayed out of the twin before. The memory check's mismatch lines now also give the pool's last written binding, its last use, the CPU's write stamp for the page and the first bytes of both copies. With the change the trees stayed steady at the spot where they flickered, all 37,848 shaders translated without a failure, and the GPU time per frame stayed at about 9 ms (75 fps uncapped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -253,6 +253,7 @@ void vk_mem_dirty_submit(void); // vk_sync_submit, under its l
|
||||
extern int vk_mirror_on;
|
||||
void vk_mem_use(VkMemSpan *sp);
|
||||
void vk_mem_pick(VkMemSpan *sp);
|
||||
VkBuffer vk_mem_guest_twin(const VkMemSpan *sp); // a VRAM mirror span: the pool's imported buffer (guest memory), same offset; else none
|
||||
#define VK_MEM_USE(sp) do { if (vk_mirror_on && (sp).pool) vk_mem_use(&(sp)); } while (0)
|
||||
#define VK_MEM_PICK(sp) do { if (vk_mirror_on && (sp).pool) vk_mem_pick(&(sp)); } while (0)
|
||||
void vk_mem_gpu_wrote(const VkMemSpan *sp, uint64_t size);
|
||||
|
||||
Reference in New Issue
Block a user