diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-27 06:39:35 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-27 06:39:35 -0500 |
| commit | b0712ff2ce72796d0db2d833ec3d5d0a542e2142 (patch) | |
| tree | 2553007a564e692af4aff036e43c98a1b4b31c06 /docs/d3d12_vulkan.md | |
| parent | 23c33411962b84ecae28f4e82bd62fc6fba79444 (diff) | |
| parent | 3c9820f8daae7e478cdca7f7e1d395e60d7c4ddf (diff) | |
Merge test/round2 into heaps-in-place: per-piece sums and the T# index word for heaps read in place
title_mirror.h: a filtered page's sums per 256-byte piece are of the title's bytes (title compared with title); the
filter runs after that compare, only when a piece changed or the home is fresh, and writes the home. write_back skips
a filtered home, so page_mirror_write_back takes TitleMirror::write_back as is. A home leaving its filter is copied
whole once.
The T# index word (tsharp_index_word) is written by finish_in_place into the home's dword 6 once the T# is bound; the
filter leaves 0 (the fallback) there meanwhile, so the title's own dword 6 is never read as an index. Copy-path heaps
keep fix_console_slot's write. d3d12_heap_in_place_test checks a T# slot reads the tag and index while the title's
bytes keep their dword 6; title_mirror_hooks_test checks write-back skips filtered homes and the filter is not called
again for unchanged title bytes. set_tsharp_index_words_for_test for the test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/d3d12_vulkan.md')
| -rw-r--r-- | docs/d3d12_vulkan.md | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index cd325bded..bd7acdb11 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -2202,8 +2202,12 @@ The game can use D3D12 descriptors in three ways, and the layer must handle all | |||
| 2202 | any reader names title memory) or in a buffer of ours as the title wrote it (`reachable_as_written`), other words | 2202 | any reader names title memory) or in a buffer of ours as the title wrote it (`reachable_as_written`), other words |
| 2203 | null. The filter runs inside the mirror's fills, under its lock, so it takes no other lock of ours: a V# the mirror | 2203 | null. The filter runs inside the mirror's fills, under its lock, so it takes no other lock of ours: a V# the mirror |
| 2204 | does not hold (an interim, until every title allocation is in the mirror) reads null until the heap's refresh | 2204 | does not hold (an interim, until every title allocation is in the mirror) reads null until the heap's refresh |
| 2205 | resolves it as a copied slot was, and a T# is bound there too (its bindless index in the entry comes later), each | 2205 | resolves it as a copied slot was, and a T# is bound there too, its home dword 6 then taking the bindless index word |
| 2206 | result written into the home unless the title rewrote the slot meanwhile (`finish_in_place`). Lock order: | 2206 | (`tsharp_index_word`, docs/design.md "Bindless index in the T#"; 0, the fallback, from the filter until then and |
| 2207 | while the T# waits; the title's dword 6 stays in its bytes), each result written into the home unless the title | ||
| 2208 | rewrote the slot meanwhile (`finish_in_place`). The upload's sums per 256-byte piece are of the title's bytes for | ||
| 2209 | such a page, so the mirror calls the filter only when a piece of the title's page changed, and `write_back` skips | ||
| 2210 | it. Lock order: | ||
| 2207 | `console_heap_mutex`, then the mirror's, then the change list's. The changes are applied to the homes at the | 2211 | `console_heap_mutex`, then the mirror's, then the change list's. The changes are applied to the homes at the |
| 2208 | mirror's refresh, before the pages written since are filled. No GPU write is ever copied back from these pages | 2212 | mirror's refresh, before the pages written since are filled. No GPU write is ever copied back from these pages |
| 2209 | (`TitleMirror::filtered_at`). A heap the mirror does not hold (a device without the mirror, memory outside its | 2213 | (`TitleMirror::filtered_at`). A heap the mirror does not hold (a device without the mirror, memory outside its |
| @@ -2235,7 +2239,9 @@ The layer's descriptor model: | |||
| 2235 | which is the assumption to verify. If it uses an opaque format, the layer must translate at bind time. | 2239 | which is the assumption to verify. If it uses an opaque format, the layer must translate at bind time. |
| 2236 | - At execution, for each bound table (or the whole bound heap when direct indexing is enabled), the layer walks | 2240 | - At execution, for each bound table (or the whole bound heap when direct indexing is enabled), the layer walks |
| 2237 | the declared descriptor range with the heap's stride, parses each T#/S#, and ensures a bindless entry exists: | 2241 | the declared descriptor range with the heap's stride, parses each T#/S#, and ensures a bindless entry exists: |
| 2238 | - image T# → `VkImageView` (format, view type, mip range, array layers) → bindless image index; | 2242 | - image T# → `VkImageView` (format, view type, mip range, array layers) → bindless image index, which the layer |
| 2243 | writes into dword 6 of the T# where shaders read it (the console heap copy's slot, or the layer's own heap), with | ||
| 2244 | the arrays it is bound in (`docs/design.md`, "Bindless index in the T#"); the hash table keeps the key as written; | ||
| 2239 | - sampler S# → `VkSampler` (filter, address modes, LOD, compare, anisotropy) → bindless sampler index; | 2245 | - sampler S# → `VkSampler` (filter, address modes, LOD, compare, anisotropy) → bindless sampler index; |
| 2240 | - buffer V# / CBV → no Vulkan view; the descriptor already contains a console VA the shader dereferences. | 2246 | - buffer V# / CBV → no Vulkan view; the descriptor already contains a console VA the shader dereferences. |
| 2241 | - **Buffer UAVs.** `CreateUnorderedAccessView` on a buffer writes a V# in the first 16 bytes of the slot (the rest of | 2247 | - **Buffer UAVs.** `CreateUnorderedAccessView` on a buffer writes a V# in the first 16 bytes of the slot (the rest of |
| @@ -4801,6 +4807,12 @@ store, load, mesh, geometry and BVH tests; this layer is the other half. | |||
| 4801 | 4807 | ||
| 4802 | ### 5.1 Descriptor hash table details | 4808 | ### 5.1 Descriptor hash table details |
| 4803 | 4809 | ||
| 4810 | Since the T# index word (`docs/design.md`, "Bindless index in the T#") the table serves only what the word does not | ||
| 4811 | reach: every S#, and the T#s a translated module cannot trace to a heap slot (1,062 of the 439,415 T# operands of | ||
| 4812 | the 1.0.2.1 corpus, in 108 modules). A T# loaded from a heap the layer writes carries its index and kind in dword 6 | ||
| 4813 | and is never looked up. Every T# key is still inserted, as the title wrote it: a T# outside the heaps is found by | ||
| 4814 | those words. | ||
| 4815 | |||
| 4804 | The exact layout the shader reads (from `tools/rdna2spirv.py`, `desc_lookup`): | 4816 | The exact layout the shader reads (from `tools/rdna2spirv.py`, `desc_lookup`): |
| 4805 | 4817 | ||
| 4806 | ``` | 4818 | ``` |