mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-23 05:25:56 +00:00
Mirror buffer-bound pools in device-local memory on discrete GPUs
Imported pools put vertices, indices, constants and storage buffers in system memory, so discrete GPUs read them over PCIe on every draw. A pool now gets a device-local mirror on its first use as a vertex, index, uniform, storage or indirect buffer; bindings, buffer copies, fills and uniform updates use it at the same offsets. The first access of a submission syncs the pages written since (write-watch snapshots shared with the texture checks, plus nvnMemoryPoolFlushMappedRange ranges) in a prologue command buffer before the part; what the GPU writes into a mirror goes back to guest memory at the end of the submission. TOTK_MEMORY=import|mirror|verify overrides the device class; verify compares sampled mirror pages with guest memory at the fence. The vkexec probe gains a mirror part. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c8a7b889d2
commit
1fe552ae0a
14 files changed
+775
-82
No files matched your search
@@ -688,6 +688,7 @@ int vk_exec_record(VkCommandBuffer cb, const uint64_t *handles, int n, uint64_t
|
||||
vk_exec_frame.submits++;
|
||||
split_draws = part_start = 0;
|
||||
x_here = 1;
|
||||
if (n) vk_mem_mirror_begin();
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (!handles[i]) rt_fatal("vk: command handle %d of a submission is null", i);
|
||||
walk(ex, nvn_op_first(handles[i]), 0);
|
||||
@@ -695,6 +696,7 @@ int vk_exec_record(VkCommandBuffer cb, const uint64_t *handles, int n, uint64_t
|
||||
vk_exec_pass_end(ex);
|
||||
x_here = 0;
|
||||
if (ex->recorded) vk_exec_barrier(ex); // later submissions see this one's writes
|
||||
if (n) ex->recorded += vk_mem_mirror_end(ex->cb, fence); // VRAM mirror bytes the GPU wrote go back to guest memory
|
||||
if (ex->nviews) {
|
||||
ViewList *l = malloc(sizeof *l + sizeof(VkImageView) * (size_t)ex->nviews);
|
||||
if (!l) rt_fatal("vk: out of memory");
|
||||
|
||||
Reference in new issue
Block a user