upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/d3d12_vulkan.md
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-27 06:05:33 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-27 06:05:33 -0500
commitba32cd6acf9e6f5dfa2128ef53e05dec2cf34a38 (patch)
tree1c11ec419865d0053029e2acb2a019303cdeb413 /docs/d3d12_vulkan.md
parentb4a6c3673aae1121559da4a5eba0c3b7ada70045 (diff)
d3d12: a console resource heap the page mirror holds is read in place: no copy, its pages filtered as they are filled
When every page of a console CBV/SRV/UAV heap lies in the page mirror (a reservation xmem placed in its range), add_heap_in_place gives it no copy and no page tracker of its own. 25,865 of the corpus's 26,503 shaders keep 32 bits of a descriptor-table pointer, so the heap's pages are bound a second time into the arena below 4 GiB (TitleMirror::alias, same bind batches and wait as the mirror's), at a range of whole arena blocks with no arena memory behind it (arena_reserve_unbacked); the null slots after the heap are that range's rest, unbound, reading zero. Table pointers go there as before (console_heap_ranges). The mirror fills the pages' home through filter_heap_page (TitleMirror::filter_range): the title's page is only read; a slot whose bytes changed since it was last filtered, or that a change touched (the records' change list, applied at the mirror's refresh before the written pages are filled, filtered straight into the home), is fixed as a copied slot was, into the home: a V# whose base lies in the arena, the mirror or a buffer of ours stays as the title wrote it (reachable_as_written, no record); another V# is resolved as before (an interim until every title allocation is in the mirror) or written with no base and no records and waits; a T# is bound as before [TSHARP-INDEX: its bindless index in the entry]; other words are null. A GPU write-back is never taken from these pages: the mirror has none, and no window is made for them. A heap the mirror does not hold (a device without the mirror, memory outside its range) is copied as before. New log line per in-place heap: pages filtered and slots changed per submission and per frame, the ms, and the V# halves read as the title wrote them. arena_gpu_read reads the arena with the GPU after the mirror's last bind (tests). Test: d3d12_heap_in_place_test (Wine, iGPU): a heap in physical pages of an XMemVirtualAlloc reservation; the GPU reads, below 4 GiB, a V# into nobody's memory and a data word null and V#s into the arena and the mirror as written, while the title's bytes stay as written byte for byte; a rewrite through the title's own view reaches the GPU at the next refresh, filtered, and the title keeps what it wrote; the null slots read zero. It fails on the copy path. Linux ctest 123/123. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/d3d12_vulkan.md')
-rw-r--r--docs/d3d12_vulkan.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 377358b50..d20e22ac1 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -2190,6 +2190,22 @@ The game can use D3D12 descriptors in three ways, and the layer must handle all
2190 (`sync_slot_changes`), and the submission's own changes before the rewritten slots, so an answer is never older 2190 (`sync_slot_changes`), and the submission's own changes before the rewritten slots, so an answer is never older
2191 than a change that concerns it. In one world run 70% of the 2,100 rewritten V# halves a submission resolved to 2191 than a change that concerns it. In one world run 70% of the 2,100 rewritten V# halves a submission resolved to
2192 nothing at about 9 µs each. 2192 nothing at about 9 µs each.
2193 **A console resource heap read in place.** When the page mirror holds every page of the heap (a reservation xmem
2194 placed in the mirror's range), there is no copy and no page tracker of the heap's own. 25,865 of 26,503 shaders
2195 keep 32 bits of a descriptor-table pointer, so the heap's pages are bound a second time into the arena below
2196 4 GiB (`TitleMirror::alias`, in the same bind batches as their mirror binds, so the one wait orders a reader of
2197 either address), at a range of whole arena blocks with no arena memory behind it; the null slots after the heap are
2198 that range's rest, unbound, which reads zero. Table pointers go there as before (`console_heap_ranges`). The
2199 mirror fills the pages' home through a filter (`TitleMirror::filter_range`, `filter_heap_page`): the title's bytes
2200 are only read, and the home, the mirror's own GPU memory, gets each slot that changed since it was last filtered,
2201 or that a change of the address space touched: a V# whose base lies in the arena, in the mirror or in a buffer of
2202 ours as the title wrote it (`reachable_as_written`), another V# resolved as before (an interim, until every title
2203 allocation is in the mirror) or with no base and no records, a T# bound as before (its bindless index in the entry
2204 comes later), other words null. The changes are applied to the homes at the mirror's refresh, before the pages
2205 written since are filled. A heap the mirror does not hold (a device without the mirror, memory outside its range)
2206 is copied as before. `d3d12_heap_in_place_test` checks that the GPU reads the filtered slots below 4 GiB while the
2207 title's bytes never change, that a rewrite reaches the GPU at the next refresh, and that the null slots read zero;
2208 `title_mirror_hooks_test` checks the two hooks without a GPU and `vk_heap_alias_test` the second binding on a device.
2193 Console resource heap copies and shader-visible CBV/SRV/UAV heaps with at least 65,536 slots request 2209 Console resource heap copies and shader-visible CBV/SRV/UAV heaps with at least 65,536 slots request
2194 64 MiB of zeroed padding after their last descriptor. `LEONIDA_HEAP_GUARD_MB` sets the padding in MiB 2210 64 MiB of zeroed padding after their last descriptor. `LEONIDA_HEAP_GUARD_MB` sets the padding in MiB
2195 (0 disables it). When arena space is tight, allocation can fall back to the heap alone. Only indices 2211 (0 disables it). When arena space is tight, allocation can fall back to the heap alone. Only indices