diff options
| author | DadaCap <167002618+DadaCap@users.noreply.github.com> | 2026-11-26 00:46:03 +0100 |
|---|---|---|
| committer | DadaCap <167002618+DadaCap@users.noreply.github.com> | 2026-11-26 01:22:14 +0100 |
| commit | 0ebd4286ea80b5de20dbf7adf7bf6b970c7492df (patch) | |
| tree | 351ecd034823d3274e316d056cd570da3e9c3518 /docs/d3d12_vulkan.md | |
| parent | 33bd07cf86bb42236635c27341359b3fe841d1d5 (diff) | |
d3d12: a slot-133 shadow keeps the GPU's writes where the title's bytes did not change (LEONIDA_SHADOW_KEEP)
ShadowPages copies pages that carry no sign of a title write (aliased,
unguarded, reopened with their 64 KiB block, write-watched or pinned) at
every refresh, and that copy overwrote what a shader had stored in the
shadow with the title's unchanged bytes. A value a compute program writes
for the next frame then read back as the title's old bytes every other
frame.
Each tracker now keeps a 64-bit sum per 256-byte piece of the bytes it
copied last (runtime/src/shadow_keep.h) and copies a piece only when the
title's bytes differ. Zeroed pages forget their sums. LEONIDA_SHADOW_KEEP=0
copies every job whole, as before. New CPU-only test shadow_keep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
Diffstat (limited to 'docs/d3d12_vulkan.md')
| -rw-r--r-- | docs/d3d12_vulkan.md | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index c29a9ab2f..e1e770c50 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -1723,6 +1723,15 @@ The copies: | |||
| 1723 | write-fault handler waits for the trackers' locks while the faulting thread may hold the process heap's lock (the | 1723 | write-fault handler waits for the trackers' locks while the faulting thread may hold the process heap's lock (the |
| 1724 | title's `XMemAlloc` blocks are `_aligned_malloc`'s), so the state changed under those locks allocates from a heap of | 1724 | title's `XMemAlloc` blocks are `_aligned_malloc`'s), so the state changed under those locks allocates from a heap of |
| 1725 | the runtime's own (`leonida::host_heap`), never the process heap. | 1725 | the runtime's own (`leonida::host_heap`), never the process heap. |
| 1726 | - **What the GPU wrote into a copy stays** until the title changes the bytes under it. Some pages are copied at | ||
| 1727 | every refresh without a sign that the title wrote them (mapped at two addresses, left writable, reopened with the | ||
| 1728 | 64 KiB around a written page, write-watched or pinned); copied whole, they overwrote a value a compute program had | ||
| 1729 | stored in the copy for the next frame with the title's unchanged bytes, so it read back as the title's old value | ||
| 1730 | every other frame. `ShadowPages` keeps a 64-bit sum per 256-byte piece of the bytes it copied last | ||
| 1731 | (`runtime/src/shadow_keep.h`) and copies a piece only when the title's bytes differ; a piece zeroed because its page | ||
| 1732 | went away is copied again in full once it comes back. Limit: a title that writes the same bytes again to reset a | ||
| 1733 | value the GPU changed is not seen (that needs the GPU's writes to reach the title's pages). `LEONIDA_SHADOW_KEEP=0` | ||
| 1734 | copies every page as before. | ||
| 1726 | - **Only the title's memory** gets a copy: the blocks and ranges the xmem shims hand the title (`XMemAlloc`, | 1735 | - **Only the title's memory** gets a copy: the blocks and ranges the xmem shims hand the title (`XMemAlloc`, |
| 1727 | `XMemAllocDefault`, `XMemVirtualAlloc`, the title's `VirtualAlloc`). An address anywhere else, the runtime's or a | 1736 | `XMemAllocDefault`, `XMemVirtualAlloc`, the title's `VirtualAlloc`). An address anywhere else, the runtime's or a |
| 1728 | host DLL's memory included, is left as it was and counted, as is an arena VA or a buffer the layer made. | 1737 | host DLL's memory included, is left as it was and counted, as is an arena VA or a buffer the layer made. |