d3d12: LEONIDA_WINDOWS_BAR_MB says once that it does nothing without resizable BAR (D3D12-BAR-WINDOWS-WARNING) #2612
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2612"
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?
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:32:08Z.
Claimed in the coordination issue as: D3D12-BAR-WINDOWS-WARNING (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7249422163)
What and why
LEONIDA_WINDOWS_BAR_MBputs title memory windows in card memory the CPU maps (D3D12_HEAP_TYPE_GPU_UPLOAD). That memory exists only with resizable BAR, and a system and driver that offer it. Without it, the cap did nothing, and nothing said so:video_memory(), twoQueryVideoMemoryInfocalls) and took room in the cap's counter, beforemapped_card_bufferfound that the heap type is not there.This change:
shadow.rs:window_mapped_forchecksmapped_card_memory()before anything else. Without that memory, it logs once, at info level, that the cap does nothing (LEONIDA_WINDOWS_BAR_MB is set, but the card has no GPU upload heap (it needs resizable BAR, and a Windows and driver that offer it): title memory windows stay in the PC's memory and the setting does nothing) and returns. The decision is a small pure function,mapped_windows(most, supported), that asks for support only when a cap is set; its unit test covers the three cases, not the logging or the skippedvideo_memory()call, which need a device.play-nvidia.ps1: the default's line says the cap applies "if the card has resizable BAR". The-WindowsBarMBhelp gives the real default (under 48 GB of RAM and a card of 6 GB or more, since #2583) instead of "under 24 GB" (an unknown card size counts as 6 GB or more).d3d12/README.md: the same correction.Behaviour with resizable BAR is unchanged. It only skips work that could not succeed.
After an independent review: the note is info rather than a warning (the launcher sets the cap by default on every PC under 48 GB), and it names GPU upload heaps rather than only resizable BAR.
Tested
On Windows 11, from
d3d12\:cargo test -p leonida-gpu --locked mapped_windows: the newshadow::mapped_windows_tests::a_cap_does_nothing_on_a_card_without_memory_the_cpu_mapspasses. Onmainit does not build, becausemapped_windowsdoes not exist there.cargo test --workspace --locked: every suite passes exceptxtaskpolicy::tests::repository_passes_policy. That test fails the same way onmain(51d343b86):crates/leonida-gpu/src/host.rs(664,368 bytes) andcrates/leonida-shader/src/emit/lower.rs(676,599 bytes) are over the 655,360-byte limit. This change touches neither file.cargo fmt --all --checkandcargo clippy --workspace --all-targets --locked -- -D warningsare already red onmain, in files this change does not touch: formatting diffs across the workspace, and clippy errors inleonida-luaandleonida-shaderthat stop the build. In the changed lines,cargo fmt --checkreports no diff, andcargo clippy -p leonida-gpu --all-targets --lockedreports nothing.git diff --checkis clean, and so ispython -I scripts/check_no_game_data.pyon the three files.leonida.exe(diag build) ran with the launcher's default (LEONIDA_WINDOWS_BAR_MB=3072):card memory the CPU maps supported=false, then the new line, once (checked with the first version of the wording; a review then changed its level to info and its text);GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140, Windows 11 Pro 10.0.26300 (resizable BAR off).
AI-assisted: yes
Checklist
mainand merges cleanly (checked against the open pull requests that touch the same files: #2569, #2587, #2588, #2589).docs/design.md, with how it was confirmed. (Not applicable: no translator change.)Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T17:01:24Z.
Independent device check of
877c0d14amerged onto4364a4fa6on CachyOS, System Wine 11.22, VKD3D-Proton71cae091, AMD Raphael iGPU / RADV Mesa 26.3.1. An offline fixture initialized a real D3D12 device and called the productionwindow_mapped_forfrom four threads with 64 KiB per call. The only instrumentation counted calls toHost::video_memoryand captured the runtime's existing tracing output.VKD3D_CONFIG=no_gpu_upload_heapEvery case without mapped allocations also successfully made a buffer with the system-memory helper. The PR's
mapped_windowsunit test and No Game Data check for the three changed files passed. No game data or swap chain was used.The RTX 4070 SUPER control did not reach the test because DXVK could not initialize a Vulkan instance in this headless setup. I did not exercise native Windows or the PowerShell launcher.
AI-assisted with OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-29T18:41:43Z.
Independent native Windows 11 + AMD Radeon RX 7900 XTX (
gfx1100, driver32.0.32029.2010, Windows 1110.0.26200) check of877c0d14amerged cleanly ontomain4755667f5(no game files):main4755667f5):cargo test -p leonida-gpu --lib -- --test-threads=4->544 passed; 0 failed; 47 ignored(12.27 s).#2612(877c0d14a) +main4755667f5:cargo test -p leonida-gpu --lib -- --test-threads=4->545 passed; 0 failed; 47 ignored(14.20 s, +1 new test inshadow.rs, 0 regressions, 0 new compiler warnings).python -I scripts/check_no_game_data.pyon all 3 touched files: clean.AI-assisted: Antigravity (Gemini 4 Neon).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:28:58Z.
Partial verification, the part that can be checked without a Rust toolchain: the wiring and the script. I cannot build
d3d12/here (nocargoon this machine), so read this as "the names and the script agree", not "it works".LEONIDA_WINDOWS_BAR_MB, is read ind3d12/crates(1 file:shadow.rs, the one this branch touches), so the README row and the code cannot bedisagreeing about a name;
d3d12/scripts/play-nvidia.ps1parses as PowerShell (Parser::ParseInput, no errors);mainand merges cleanly againstorigin/mainedf0ff5d0(git merge-tree --write-tree), so it does not need a rebase to be reviewable - only tokeep its diff to three files.
Not verified: that the flag actually says once that it does nothing without resizable BAR, which is the behaviour the title claims; that needs the Rust build and a card, and this machine has
neither in this configuration.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T21:32:04Z.
RUN (independent run, #2612 head
877c0d14aon main878b024f4; merged locally withgit merge --no-ff, no conflicts; also no conflict with #2566 head7b5cb2941pergit merge-tree --write-tree).Commands, in
d3d12/, target x86_64-pc-windows-msvc, toolchain 1.98.1:cargo check --tests -p leonida-gpu: OK on the merged tree.cargo test -p leonida-gpu: green, 545 passed / 0 failed / 47 ignored, includingmapped_windows_tests::a_cap_does_nothing_on_a_card_without_memory_the_cpu_maps.mapped_windowsignoring the card (cap set meansTry, the old behaviour),cargo test -p leonida-gpu --lib mapped_windowsfails: leftTry, rightUnsupported.MappedWindowsandmapped_windowsunresolved).scripts/play-nvidia.ps1parses with 0 errors (parser only, not run). Its default (under 48 GB of RAM, not under 6 GB of VRAM) matches the new README text.window_mapped_fornow returns None before the budget and counter steps; before, it reached the same None throughmapped_card_buffer. So behaviour is unchanged apart from the one-time log line. The wiring inwindow_mapped_foritself (theOncemessage) is not exercised by a test.No runtime/ C++ or Python in this PR, so no link or import check applies.
Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T21:54:18Z.
Tested
877c0d14amerged (no commit) withmain060c47160: Windows 11, Rust toolchain fromd3d12/rust-toolchain.toml, CPU only, no game run.cargo test -p leonida-gpu --locked:main549 passed, 47 ignored; with this PR 550 passed, 47 ignored, 0 failed.cargo clippy -p leonida-gpu --locked -- -D warnings: 10 findings onmainand the same 10 with the PR (all inleonida-luaandleonida-shader); this PR adds none.mainand does not force a rebase of #2566.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T15:44:56Z.
RUN - in-game gate (Verified by OreoFR), PROVISIONAL - RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11.
f9f3ec4c6; B = main + this PR at22cd4ae24(git merge --no-ff), diag build ofleonida.exe.play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen, BAR 0, texture budget 1024, standing in the world, 360 s per run (window: world +30 to +330 s). Each exe got a cold run and a throw-away run first; measured runs interleaved with main (A B B A).Result: PASS - 0 device loss, 0 panics, every run alive at the end.
mapped_windowsasks for support only when a cap is set.LEONIDA_WINDOWS_BAR_MB=3072: the log hascard memory the CPU maps supported=trueonce. The new "does nothing" line is absent, which is correct because this card has GPU upload heaps. Windows went to mapped card memory (1616 MB at the end). The run gave 24.7 fps, was alive at the end, with no device loss.This run was AI-assisted (Claude Code, oreofr-agent).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T16:49:37Z.
Merging. Head
22cd4ae24merges cleanly withmainbe454caa4and does not force a rebase of #2566. Run in the game of 360 s, no device loss, posted on this head (OreoFR, RTX 4070 Laptop); cargo test on Windows with main: leonida-gpu 572 passed (main 571), leonida-shader 385 passed, 0 failed. Merged by MoonEyes.AI-assisted (Claude Code).