mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:25:52 +01:00
[PR #1768] [CLOSED] d3d12: import a slot-133 buffer at any offset in its page (RT-SLOT133-IMPORT-OFFSET) #1782
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#1782
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/1768
Author: @Coderlord
Created: 11/25/2026
Status: ❌ Closed
Base:
main← Head:rt-slot133-import-offset📝 Commits (1)
55a77a3d3d12: import a slot-133 buffer at any offset in its page (RT-SLOT133-IMPORT-OFFSET)📊 Changes
3 files changed (+46 additions, -13 deletions)
View changed files
📝
runtime/shims/d3d12_vulkan_device.cpp(+26 -10)📝
runtime/test/d3d12_existing_heap_test.cpp(+2 -2)📝
runtime/test/d3d12_xmem_placed_test.cpp(+18 -1)📄 Description
Claimed in the coordination issue as: RT-SLOT133-IMPORT-OFFSET (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161446177)
What and why
The retail title places small buffers 32 bytes apart through slot 133 (one at +0xc60 of a page, measured on an
RTX 5080).
create_host_bufferimported the page that holds the address and bound the buffer at its offset in thatpage, which Vulkan refuses off the buffer's alignment (64 on that card), so such a buffer was declined and became a
shadow. A 32-byte buffer near the end of a page (+0xfe0) was declined too: its memory requirement (64 bytes) ran
past the imported pages.
Now:
ResourceBinding::buffer_offsetinto it, and its device address is offset to match, so the title VA alias and thebelow-the-arena check see the buffer's own address as before;
committed and writable by the same rules as the buffer's own pages (no write-combine, no-cache or guard page,
writable), and declines as before when they are not. The pin covers the larger range.
Replay already honors
buffer_offseteverywhere a binding is used (the GPU address arena relies on it), so copies,clears, views and the VA lookup need no change.
Tested
On
mained94fbef9plus this commit, Windows 11, RTX 5080, MSVC 2022 + Ninja, RelWithDebInfo:ctest -R "^(d3d12_xmem_placed|d3d12_existing_heap.*|d3d12_title_va.*|title_va_alias)$": 7/7 passed(
d3d12_existing_heap,_write_watch,_no_write_watch,d3d12_title_va,d3d12_title_va_shadow,d3d12_xmem_placed,title_va_alias). The newd3d12_xmem_placedcase prints "a 64-byte buffer at +0xc60 of apage is imported and the GPU reads the CPU's writes":
title_host_importsgoes up by one (a shadow would not) anda GPU copy of the buffer reads what the CPU wrote at that address.
removes ("offset 0xc60 in its page against alignment 0x40"); that buffer imported afterwards.
main(bcaa13dad) on this card without this change ran 400 s to the first-run pages with nofault; a boot with it has not been run yet.
GPUs tested: NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 Pro 26300 (MSVC 2022, Ninja, RelWithDebInfo)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.