Repository navigation
d3d12: translate GPU-view V#s and guard untranslated title V#s (RT-UNTRANSLATED-VSHARP-GUARD) - #1728
TanmaySatyam wants to merge 1 commit into
Conversation
…TRANSLATED-VSHARP-GUARD) Maps GPU-only title views via title_gpu_views::to_cpu in resolve_title_memory and rebase_title_vsharp, allows decoded title-memory V#s within kTitleWindowMax to resolve title windows in console heap rebasing, and redirects any remaining unresolvable raw title-memory V# to a zeroed arena scratch slot with num_records=0 via runtime/src/title_vsharp_guard.h. Adds portable unit tests in runtime/test/title_vsharp_guard_test.cpp.
|
Tested this branch (4ebe446) against the retail 1.0.2.1 boot on an NVIDIA GeForce RTX 2070 SUPER (driver 616.56, Windows 11,
Hypothesis, not confirmed: the shader reaches the untranslated address through a raw 64-bit pointer loaded from memory rather than through a buffer V#, which a V# guard cannot redirect. Naming pipelines with AI-assisted (Claude Code); logs and dumps stay on my machine. |
|
Thanks, @TanmaySatyam. #1723 was merged just before this PR opened, and it covers most of it:
The one piece Two more things:
AI-assisted (Claude Code, Claude Opus 5.5). |
|
Reviewed 4ebe446: read the diff (4 files); ran the CMake-parsing Python tests on this tree and main (pass); the new C++ test could not be built here (no C++ toolchain available). AI-assisted review. Recommendation: Close |
Claimed in the coordination issue as: RT-UNTRANSLATED-VSHARP-GUARD (#1608 (comment))
What and why
When
resolve_title_memoryorrebase_title_vsharpencounters a title-memory buffer V# in either an explicit descriptor table (scan_title_table) or the directly-indexed console resource heap (fix_console_slot), three gaps can leave an unrebased raw title virtual address in the live GPU descriptor heap, causingREAD_INVALID/WRITE_INVALID(VK_ERROR_DEVICE_LOST):resolve_title_memory/rebase_title_vsharp:resolve_title_memoryandrebase_title_vsharpcheckedaliases.title_memory(base)directly without mapping GPU-only views throughleonida::title_gpu_views::to_cpu(base, span).LEONIDA_GEOMETRY_MBis set (heap.scratch != nullptr),fix_console_slotpassedmake_window = false, so decoded title-memory V#s withinkTitleWindowMaxthatgeometry_vadid not claim could not fall back toaliases.resolve(..., table_view).rebase_title_vsharpreturnsfalseon a decoded title-memory V# (e.g. uncommitted page, over-cap window, or unmapped GPU-only address), copying the original words leaves a raw title VA in the GPU descriptor heap.This adds a portable standalone helper
runtime/src/title_vsharp_guard.h(leonida::title_vsharp_guard::redirect_untranslated_vsharp) with deterministic unit tests inruntime/test/title_vsharp_guard_test.cppand hooks it intoruntime/shims/d3d12_vulkan_device.cpp:leonida::title_gpu_views::to_cpuinresolve_title_memoryandrebase_title_vsharp.kTitleWindowMaxinrebase_title_vsharpto request a title window viaaliases.resolve.num_records = 0(w[2] = 0) so translated buffer loads return 0 and buffer stores drop OOB instead of faulting the GPU. Leaves null descriptors, image T#s, arena VAs, known GPU buffer VAs (host imports / geometry views), and non-V# data untouched.Tested
ctest -R "^(title_vsharp_guard|title_va_alias|d3d12_existing_heap|d3d12_descriptor|d3d12_console_descriptor_heap)$"withLEONIDA_VK_VALIDATION=1-> 5/5 passed (0 VUIDs)title_vsharp_guard_testcovers 8 deterministic cases (null, T#, arena VA, known GPU VA, non-title address, raw title V#, GPU-only view V#, unavailable scratch) with no GPU or game filespython -I scripts/check_no_game_data.py runtime/src/title_vsharp_guard.h runtime/test/title_vsharp_guard_test.cpp runtime/shims/d3d12_vulkan_device.cpp runtime/CMakeLists.txt-> exit 0GPUs tested: NVIDIA GeForce RTX 5070 (Windows 11, MSVC RelWithDebInfo, Vulkan validation enabled, 0 VUIDs)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)