mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #1728] d3d12: translate GPU-view V#s and guard untranslated title V#s (RT-UNTRANSLATED-VSHARP-GUARD) #1741
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1741
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1728
Author: @TanmaySatyam
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rt-untranslated-vsharp-guard📝 Commits (1)
4ebe446d3d12: translate GPU-view V#s and guard untranslated title V#s (RT-UNTRANSLATED-VSHARP-GUARD)📊 Changes
4 files changed (+253 additions, -21 deletions)
View changed files
📝
runtime/CMakeLists.txt(+3 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+71 -21)➕
runtime/src/title_vsharp_guard.h(+43 -0)➕
runtime/test/title_vsharp_guard_test.cpp(+136 -0)📄 Description
Claimed in the coordination issue as: RT-UNTRANSLATED-VSHARP-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7158772853)
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)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.