mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #1678] d3d12: geometry views fall back to system memory when the BAR window is full (RT-GEOMETRY-VIEWS-NO-REBAR) #1691
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#1691
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/1678
Author: @adrianmjim
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/geometry-views-no-rebar📝 Commits (2)
9f989cbd3d12: geometry views fall back to system memory when the BAR window is full (RT-GEOMETRY-VIEWS-NO-REBAR)3db487adocs: geometry views prefer device-local memory, with the system-memory fallback📊 Changes
2 files changed (+20 additions, -4 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+5 -2)📝
runtime/shims/d3d12_title_buffer_windows.h(+15 -2)📄 Description
Claimed in the coordination issue as: RT-GEOMETRY-VIEWS-NO-REBAR (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156374294)
What and why
d3d12_geometry_viewsfails on an RX 7900 XT without Resizable BAR, on every run, onmain42537e7b6:The cause:
LEONIDA_GEOMETRY_MBviews are allocated throughTitleBufferWindows::allocate(..., device_local = true), which requiresDEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT.HOST_VISIBLE | HOST_COHERENT, preferredDEVICE_LOCAL) fits it exactly, sincememory_type_orderaccepts a heap as large as the request, so the arena takes the whole BAR heap.VK_ERROR_OUT_OF_DEVICE_MEMORY, no view is made, and the translated shader reads zeros.The driver is not refusing the allocation itself: a standalone probe on the same machine allocates 64 KiB to 64 MiB from that memory type, with and without
VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT, when the heap is empty. Andmainpasses withLEONIDA_ARENA_MBset to 128, 224 or 240.The fix: a device-local view block that cannot be allocated now goes to host-visible system memory, logged once. It is the same memory the non-geometry title windows already fall back to, and it keeps the 47-bit offset check, so a block the shaders could not reach is still refused. Views that fit in the BAR stay there.
Docs:
LEONIDA_GEOMETRY_MBis now described as the cap for the views wherever they are, since the cap also counts fallback blocks.docs/d3d12_vulkan.mdsaid the 256 MiB default arena lands in system memory without Resizable BAR. That holds for a smaller BAR heap (the RTX 3090's 214 MiB), but a heap of exactly 256 MiB holds it, so the note now says so.Follow-up (not here): whether the arena should take the whole BAR heap when there is no Resizable BAR is a policy question. The arena holds the default-heap buffers, descriptor heaps and shader code, so moving it to system memory is not obviously better. This change only makes the views work whichever way that goes.
Tested
AMD Radeon RX 7900 XT (RDNA3), AMD driver 32.0.32029.2010 (26.11.2), no Resizable BAR, Windows 11 build 26300, VS 2022, RelWithDebInfo, on
main42537e7b6:ctest -R "^d3d12_(geometry_views|title_va)$": both pass, 3 of 3 runs. Without the change,d3d12_geometry_viewsfails 3 of 3 andd3d12_title_vapasses. The fallback line is printed once.ctestonmainwithout the change: 399 of 402. The failures ared3d12_geometry_views(this),d3d12_texture_tiles(#964) andd3d12_clear.tests/test_docs_links.py,tests/test_docs_repeated_lines.py,tests/test_docs_repo_paths.py,tests/test_text_write_line_endings.py: pass.GPUs tested: AMD Radeon RX 7900 XT (RDNA3), AMD 32.0.32029.2010, Windows 11 26300, Resizable BAR off
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.