mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 14:05:57 +00:00
Merge a shader's storage-buffer writes back into guest memory word by word
In mirror mode the replay copied every range a shader wrote from the VRAM mirror back to guest memory at the end of the submission. TotK's particle emitters write a new particle's whole record into a free slot of a buffer the simulation shaders update, so the copy put the mirror's stale words over fresh spawns: the waterfall splashes and mist showed about once a second and the falling rain drifted. Now each written range gets a snapshot in the prologue of the part that first writes it, after the CPU-to-mirror copies, and at the end of the submission shaders/wb_merge.comp writes only the 32-bit words that differ from the snapshot. Words the GPU left alone keep what the CPU wrote. About 0.1 MiB and three or four dispatches a frame in rain. TOTK_WB_MERGE=0 restores the copies. The merge's push descriptors go through rec_push so they keep their place in the recorder's call order.
This commit is contained in:
1 parent
c38e0ca13d
commit
e2fdb5b226
6 files changed
+342
-10
No files matched your search
@@ -807,7 +807,7 @@ static int bind_range(VkExec *ex, uint64_t addr, uint64_t size, uint64_t align,
|
||||
if (sp.offset % align == 0) {
|
||||
VK_MEM_USE(sp);
|
||||
*out = (VkDescriptorBufferInfo){sp.buffer, sp.offset, n};
|
||||
if (written) vk_mem_gpu_wrote(&sp, n), vk_usnap_drop(addr, n);
|
||||
if (written) vk_mem_gpu_wrote_shader(&sp, n), vk_usnap_drop(addr, n);
|
||||
count_use(sp.cls, use, n);
|
||||
VK_MEM_BOUND(sp);
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user