[PR #644] d3d12/xs: guard 48-bit host-import VAs and sync title-written descriptor heaps (D3D-RTX5070-HOST-HEAP-SYNC) #684

Open
opened 2026-11-26 20:18:42 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/644
Author: @TanmaySatyam
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: feature/rtx5070-fixes


📝 Commits (1)

  • 2ec2ca4 d3d12/xs: guard 48-bit host-import VAs and fingerprint-sync custom descriptor heaps

📊 Changes

5 files changed (+339 additions, -10 deletions)

View changed files

📝 runtime/shims/d3d12_com.h (+7 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+5 -3)
📝 runtime/shims/d3d12_xs_device.cpp (+114 -7)
📝 runtime/test/d3d12_console_descriptor_heap_test.cpp (+148 -0)
📝 runtime/test/d3d12_existing_heap_test.cpp (+65 -0)

📄 Description

Claimed in the coordination issue as: D3D-RTX5070-HOST-HEAP-SYNC

AI-assisted.

Summary

  1. 48-bit VA guard for host-imported slot-133 buffers (runtime/shims/d3d12_vulkan_device.cpp)
    • When VK_EXT_external_memory_host places a title-backed host import below heap_base, address - heap_base wraps in 64-bit unsigned arithmetic (bits 48..63 = 0xFFFF), corrupting 48-bit V# buffer descriptors.
    • Detects va >= (1ull << 48) after subtracting heap_base and falls back to the existing in-arena shadow buffer path cleanly.
  2. Custom CPU descriptor heap mirroring & pre-submit synchronization (runtime/shims/d3d12_xs_device.cpp)
    • Backs mapped console-extended descriptor heaps with a real GPU-arena heap, translates and mirrors device descriptor writes (slots 17–24 and Xbox slot 70) back to the title's CPU backing, and diffs/syncs title-written shader-visible descriptors into the GPU arena prior to queue ExecuteCommandLists / ExecuteCommandListsX.

Testing & Verification

  • Hardware / Driver: NVIDIA GeForce RTX 5070 (Driver 591.74, Windows 11, MSVC RelWithDebInfo, main@21625bca8)
  • Passed d3d12_existing_heap, d3d12_descriptor, and d3d12_console_descriptor_heap CTests under LEONIDA_VK_VALIDATION=1 and VK_VALIDATION_VALIDATE_SYNC=1 (3/3 passed, 0 validation errors).
  • Clean-room verified: python -I scripts/check_no_game_data.py runtime/shims/d3d12_vulkan_device.cpp runtime/shims/d3d12_xs_device.cpp exited 0.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/644 **Author:** [@TanmaySatyam](https://github.com/TanmaySatyam) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/rtx5070-fixes` --- ### 📝 Commits (1) - [`2ec2ca4`](https://github.com/ubiquitarianism/leonida/commit/2ec2ca4505e618b2f194900cf1dd918ce309d019) d3d12/xs: guard 48-bit host-import VAs and fingerprint-sync custom descriptor heaps ### 📊 Changes **5 files changed** (+339 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_com.h` (+7 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+5 -3) 📝 `runtime/shims/d3d12_xs_device.cpp` (+114 -7) 📝 `runtime/test/d3d12_console_descriptor_heap_test.cpp` (+148 -0) 📝 `runtime/test/d3d12_existing_heap_test.cpp` (+65 -0) </details> ### 📄 Description Claimed in the coordination issue as: D3D-RTX5070-HOST-HEAP-SYNC AI-assisted. ### Summary 1. **48-bit VA guard for host-imported slot-133 buffers (`runtime/shims/d3d12_vulkan_device.cpp`)** - When `VK_EXT_external_memory_host` places a title-backed host import below `heap_base`, `address - heap_base` wraps in 64-bit unsigned arithmetic (`bits 48..63 = 0xFFFF`), corrupting 48-bit V# buffer descriptors. - Detects `va >= (1ull << 48)` after subtracting `heap_base` and falls back to the existing in-arena shadow buffer path cleanly. 2. **Custom CPU descriptor heap mirroring & pre-submit synchronization (`runtime/shims/d3d12_xs_device.cpp`)** - Backs mapped console-extended descriptor heaps with a real GPU-arena heap, translates and mirrors device descriptor writes (slots 17–24 and Xbox slot 70) back to the title's CPU backing, and diffs/syncs title-written shader-visible descriptors into the GPU arena prior to queue `ExecuteCommandLists` / `ExecuteCommandListsX`. ### Testing & Verification - **Hardware / Driver:** NVIDIA GeForce RTX 5070 (Driver 591.74, Windows 11, MSVC RelWithDebInfo, `main@21625bca8`) - Passed `d3d12_existing_heap`, `d3d12_descriptor`, and `d3d12_console_descriptor_heap` CTests under `LEONIDA_VK_VALIDATION=1` and `VK_VALIDATION_VALIDATE_SYNC=1` (3/3 passed, 0 validation errors). - Clean-room verified: `python -I scripts/check_no_game_data.py runtime/shims/d3d12_vulkan_device.cpp runtime/shims/d3d12_xs_device.cpp` exited 0. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#684
No description provided.