fix(gpu): present to the title's window, not a pseudoconsole's 0x0 window #2587
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2587:github-pr/2587" git switch "github-pr/2587"
Open
leonida/mandy
MoonEyes wants to merge 4 commits from
github-pr/2587 into main
pull from: github-pr/2587
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2587
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/2587"
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?
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
Reviewers 0 approvals
Details
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
d3d12/README.mdView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Item: PORT-NV-PRESENT-TITLE-WINDOW
Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7244604592
Source: trustno1-coder/VIctory-NVIDIA 3f054e46 (GPL-3.0), author JRamos1993 (kept as commit author, Co-authored-by, and a row in the
d3d12/README.mdcredit table).When
leonida.exeruns under a pseudoconsole, the process owns a 0x0 console window that can sit above the title's own window in the enumeration order, and the swap chain ended up presenting to it. The host now picks the window to present to with a pure function,pick_title_window: the window the title hooked (leonida.wndproc) wins, even while its client area is still empty; without one, the first window with a client area; a pseudoconsole's window alone is never chosen.Tests (no game files): 4 new unit tests in
leonida-gpuhost.rs(the_titles_window_wins_over_a_pseudo_console_above_it,the_titles_window_counts_even_while_its_client_area_is_empty,without_one_of_the_titles_the_first_with_a_client_area,a_pseudo_console_alone_is_no_window_to_present_to) pass on this branch merged withmain5cb45921e.descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytesfails onmaintoo and is unrelated.check_no_game_data.pyis clean.Not fixed here: a swap chain already made on the fallback window does not move to the title's window when it appears later.
maindoes not move it either (see the comments); a follow-up of its own.Not tested in the title: the selection is checked as a pure function only. Windows 11, RTX 4060 for the build; no GPU run.
AI-assisted (Claude Code, Claude Opus 5.5); reviewed by a separate agent before opening.
🤖 Generated with Claude Code
@DadaCap could you review this one when you have a moment? It merges cleanly with
main. The red checks are the three tests that fail onmain5cb45921e too, already claimed:test_valu_cvt_f16_int16_mods(translator f16),test_the_loader_gets_the_stack_reserve_cmake_gives_it(loader stack) andtest_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive(path dedup). None of them touches this diff. TheERROR:lines in those logs come from tests that pass.AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.
Reviewed
2757a1d7b(d3d12/crates/leonida-gpu/src/host.rs).pick_title_windowcleanly prefers a window tagged with the"leonida.wndproc"property over the first sized window and skips0x0windows such asPseudoConsoleWindow, preventing swapchain creation against a pseudoconsole HWND.Local verification:
cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib title_window_tests: 4/4 passed (a_pseudo_console_alone_is_no_window_to_present_to,the_titles_window_counts_even_while_its_client_area_is_empty,the_titles_window_wins_over_a_pseudo_console_above_it,without_one_of_the_titles_the_first_with_a_client_area).python -I scripts/check_no_game_data.py: passed.AI-assisted (Antigravity, Gemini).
Physical Hardware Verification — Windows 11 + NVIDIA GeForce RTX 3090 (
610.88)Verified head commit
2757a1d7bedba7fedba62284eb8daf9da9d0abebcleanly merged (no-commit) ontoorigin/main(1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3;git merge-tree --write-treerc=0).#2587merges cleanly with#2589, and has a trivial 1-line adjacent table-row conflict at the end of the settings table ind3d12/README.mdwith#2588(git merge-treerc=1ond3d12/README.mdonly).Red -> Green Verification
origin/main1bc055e6c2):#2587'stitle_window_testsonorigin/mainfails (E0432:Candidateandpick_title_windowabsent).EnumWindowsprobe creating a64x64visible process window marked withSetPropW(..., w!("leonida.wndproc"), ...)and a0x0WS_EX_TOPMOSTvisible unhooked window above it in z-order fails onorigin/main:title_window()stops at the first visible window (picked == Some(pseudo)instead ofSome(titled)).origin/main+2757a1d7be):cargo test --locked -p leonida-gpu --lib title_window -- --test-threads=4: 4/4 unit tests passed (the_titles_window_wins_over_a_pseudo_console_above_it,the_titles_window_counts_even_while_its_client_area_is_empty,without_one_of_the_titles_the_first_with_a_client_area,a_pseudo_console_alone_is_no_window_to_present_to), plus the live Win32EnumWindowsprobe now selectsSome(titled)over the topmost0x0unhooked window.cargo test --locked -p leonida-hle --lib lifecycle -- --test-threads=4: 10/10 passed.python -I tests/test_docs_encoding.py(1/1),python -I tests/test_docs_links.py(17/17),python -I tests/test_docs_env_vars.py(5/5), andpython -I scripts/check_no_game_data.py d3d12/README.md d3d12/crates/leonida-gpu/src/host.rs d3d12/crates/leonida-hle/src/modules/lifecycle.rs(0issues) all pass.Code Review Notes
TITLE_HOOK(w!("leonida.wndproc")) matchesTITLE_PROCinleonida_hle::modules::lifecycle,EnumWindowssafely collectsCandidateentries into stack-ownedfound: Vec<Candidate>, and fallback selection cleanly ignores0x0unhooked pseudoconsole windows while preserving non-empty unhooked windows for standalone host tests. No blockers found.AI-assisted.
Tested
2757a1d7bmerged (no commit) withmainaa918e5d9, Windows 11 10.0.26300, Rust 1.98.1 (NVIDIA GeForce RTX 3080, driver 621.40 in the machine; these are host-side unit tests).cargo test -p leonida-gpu --lib --locked: 519 passed, 0 failed, 46 ignored (plainmain: 515 passed, 0 failed, 46 ignored). The 4title_window_testspass. On currentmainthe 4 crate failures from the description are gone. Theleonida-gputest build gives 10 warnings, the same as onmain.pick_title_windowreduced tomain's rule (candidates.first(), the first visible window), all 4 tests fail (left: Some(1),right: Some(2)orNone).check_no_game_data.pyis clean on the 3 files.No blocker from my side. AI-assisted (Claude Code).
I reproduced the late-window case from the review with real Win32 windows and the production D3D12 presenter. Tested
2757a1d7bmerged on3535eb5c4under Wine 11.22 and VKD3D-Proton71cae091on an RTX 4070 SUPER (620.73.04) and Radeon 610M (RADV Mesa 26.3.1). The fixture checksIDXGISwapChain::GetHwndafter each present.The 0×0 HWND was a synthetic popup. The Gamescope headless wrapper occasionally exited during teardown after the Rust test had printed its result. The recorded comparisons come from the DXGI assertions during the test. AI-assisted with OpenAI Codex.
RUN (independent run, #2587 head 2757a1d7b on main 878b024f4; merged locally with
git merge --no-ff, no conflicts; also no conflict with #2566 head 7b5cb2941 pergit merge-tree --write-tree).Commands, in
d3d12/, target x86_64-pc-windows-msvc, toolchain 1.98.1:cargo check --tests -p leonida-gpu -p leonida-hle: OK on the merged tree.cargo test -p leonida-gpu -p leonida-hle: green. leonida-gpu 548 passed / 0 failed / 47 ignored (the 4title_window_testsamong them), leonida-hle 215 passed / 0 failed / 2 ignored, plus the other test binaries of both crates.pick_title_windowreduced to the old behaviour (the first visible window),cargo test -p leonida-gpu --lib title_windowgives 0 passed / 4 failed.Candidateandpick_title_windowunresolved). That alone proves little, hence the behavioural run above.EnumWindows/GetPropWsee the hook's property on a real title window under a pseudoconsole (only the pure selection is tested).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.
Verified by OreoFR
PR head
5f36be0d9(a merge of main on top of the tested2757a1d7b; the PR's own change is the same) merged withgit merge --no-ffonto main060c47160, no conflict. Windows 11 Pro 10.0.26300, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Rust 1.98.1 (host-side unit tests, no GPU used). New here: a red at this head.cargo test -p leonida-gpu -p leonida-hle --lockedind3d12/, own target dir.host::title_window_testspass; leonida-hle 218 passed / 0 failed / 2 ignored (+1 +1 in the other test binaries), the same as main.pick_title_window, a new function, so restoringhost.rsto main does not compile. I kept the PR and replaced only the body ofpick_title_windowwith main's rule (the first visible window:candidates.first()): all 4title_window_testsfail (for example the pseudoconsole case picksSome(1)instead ofSome(2)).--all-targets, leonida-gpu + leonida-hle): no new lint in the files the PR touches.eade9562c) rebase needed after this: no (git merge-treeis clean).Verdict: READY (green, red seen). Ready to merge per the maintainers' plan.
This verification was AI-assisted (Claude Code, oreofr-agent).
Independent check on Windows (not the author), at
27bfe203b.cargo test --locked -p leonida-gpu --lib(shared warm target): 567 passed, 0 failed, 52 ignored in 14.1 s.The present-to-the-title's-window behaviour needs the game/pseudoconsole scenario; this is compile + regression coverage of the crate.
Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, NVIDIA RTX 4070 Ti SUPER (driver 621.01), Rust 1.98.1 pinned.
AI-assisted: yes (opencode).
IN-GAME RUN (gate, independent): #2587 head 27bfe203b, RTX 3090 24 GB, NVIDIA 621.40, Windows 11.
Setup:
d3d12/scripts/build-nvidia.ps1(diag profile, no DLSS files),scripts/play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -Log, the same save restored before the run, standing still once in the world. Other jobs (cargo, a shader translation) ran on the PC at the same time, so the frame rates are not comparable with other runs.Gate: no device loss in the 300 s warm-up (world at 92 s) or in the 420 s run (world at 72 s, so 348 s in the world; ended at the time limit). Median 10.4 fps (p5 2.4).
The late memory build-up that main shows on this card in most runs (list scratch kept in card memory while the release thread's queue grows) is present here too, at the same scale as on main (queue about 226,000, mapped scratch 8.1 GB at the end, VRAM peak 19.8 GB). It is not caused by this PR.
Not checked: Series X, walking, picture. The cargo part of this verification follows separately.
RUN (independent run on Windows, #2587 head 27bfe203b, tested as it is: it already has main d367675c7 merged in. The PR's own changes are line for line the same as on its earlier heads 5f36be0d9 and 2757a1d7b; only main's commits came in. The head still merges cleanly into main 8f41d7d01. CI on 27bfe203b: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.) This replaces my earlier RUN on 2757a1d7b.
Commands, in
d3d12/, target x86_64-pc-windows-msvc, toolchain 1.98.1, all with--locked, at low priority:cargo test -p leonida-gpu --no-fail-fast: green, 567 passed / 0 failed / 52 ignored. Main d367675c7 gives 563 / 0 / 52, so the 4 newtitle_window_testspass.cargo test -p leonida-hle --no-fail-fast: 220 / 0 / 2, as on main.cargo clippy -p leonida-gpu -p leonida-hle --all-targets(without-D warnings, which already fails on main in leonida-shader and leonida-lua), on main and on the head: no new warning inhost.rsorlifecycle.rs(3 already there, the same 3 on the head).pick_title_windowput back to the old rule (the first visible window, whatever its size or mark) and the tests kept,cargo test -p leonida-gpu --lib title_windowgives 0 passed / 4 failed. Each test gets window 1, the 0x0 one, where it expects the title's window 2, or no window at all.EnumWindows/GetPropWsee the hook's property on a real title window under a pseudoconsole. Only the pure selection is tested; the in-game check is the A/B agent's.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.
@timbot103 @merzleckeier thanks, the point is right and it reproduces: once a swap chain is made on the fallback window, nothing moves it.
READ IN CODE,
main0d41b0a0cand head27bfe203b:maintoo and this pull request does not change it:host.rsmakes the presenter once, whenpresenter.is_none(), and never askstitle_window()again (mainhost.rs:13233).mainthe chain is made for that window and stays there, so nothing is ever shown. Here the picker returnsNone, the chain goes on a window of our own, and it stays there. Neither moves to the title's window later, as merzleckeier measured.maindoes not.CreateWindowExW/CreateWindowExA, before the title gets its handle back, so every window the title makes through them is marked. I did not measure whether the title can present before one is visible. In two of my runs onmain(RTX 4060) the swap chain was made once per run; that says nothing about this order.So I would keep this pull request to the choice of the window, and take the move in a follow-up of its own: it has to wait for the queue, drop the cached presenter with its overlays and the frame-generation swap chain, and remake it, which is a larger change on the present path than this one. merzleckeier's control (wait, drop, remake) is the right shape for its test. If a maintainer would rather have it here, say so and I will do it here.
Not fixed here, and said so in the description: the presenter does not move from the fallback window.
Posted by an AI agent (Claude Code) for MoonEyes.
VERIFY-2587 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game files
Verdict: PASS. The window the swap chain is made for is now chosen by a rule that cannot pick the pseudoconsole's 0x0 window, the rule is a pure function with tests, and nothing that passed before fails now.
Head
27bfe203, base the currentmain85ec1d33, merge based367675c, 3 files, +81/−7:d3d12/crates/leonida-gpu/src/host.rs,d3d12/crates/leonida-hle/src/modules/lifecycle.rs,d3d12/README.md.1. What it changes
The swap chain was made for the first visible top-level window of the process:
Started under a pseudoconsole (Windows Terminal, or any process that owns one), the process also owns a visible
PseudoConsoleWindowof 0 x 0 pixels. When that one was above the title's window in z-order, the swap chain was made for it and the title's window stayed white — no frame ever shown.The change collects every visible top-level window of the process with two facts about each — whether our own window-procedure hook marked it (
leonida.wndproc, the propertyleonida_hle::modules::lifecycleputs on the windows the title makes), and whether its client area is not empty — and picks by a rule that is a pure function:The hooked window wins even if it is below the pseudoconsole in z-order, which is the case that was broken; without a hooked window, a 0x0 window is skipped in favour of one with a client area.
2. What I checked
pick_title_windowreturnsNonefor an empty list, the hooked one when there is one, and otherwise the first with a client area — no path returns a 0x0 window unless every window is 0x0 ✓.TITLE_HOOK = "leonida.wndproc"is the property the lifecycle module sets on the windows the title makes; I checked that the string in the GPU crate is the same one the HLE side writes.GetCurrentProcessId()check andIsWindowVisible✓; the change adds facts to the list instead of taking the first window and stopping.3. What the tests do here
leonida-gpuandleonida-hledo not build on Linux (upstream: "The crates are Windows-only today … Linux follows #2577"), so I cross-compiled them forx86_64-pc-windows-gnuand ran the tests under Wine 11.21.This pull request changes no test, so the red side cannot be built (there is nothing to take); the base and the head were compared instead:
watchtests that need Microsoft'sVirtualAlloc/VirtualQuerybehaviour, which Wine does not have4. What I did not check
EnumWindows,GetClientRectandGetPropWneed a real desktop with the title's window and a pseudoconsole; the pure part (the rule) is what I could run.leonida_hle::modules::lifecycleside (four lines): that the hook marks the title's window and not another one.AI-assisted: MiniMax M3.1 Flash.
Ran natively on Windows 11, head
27bfe203bmerged into currentmain(2fc7383b9, no conflicts), toolchain 1.98.1,--locked. Earlier comments say thatEnumWindows/GetPropWwere not checked on real windows under a pseudoconsole. This run checks that with real Win32 windows and the realtitle_window(), using a throwaway ignored test inhost.rs(not committed).Suites on the merge:
leonida-gpu --lib699 passed / 0 failed / 59 ignored,leonida-hle --lib248 / 0 / 2, the 4title_windowtests pass. Clippy--all-targetshas one warning in these crates (mut hathost.rs:7633), which is outside this diff.Does the process really own a visible 0x0
PseudoConsoleWindow?PseudoConsoleWindowattributed to the processStart-Process), binary as the console's first processcmd /c ... & binaryCreatePseudoConsolehost (no terminal window)So the precondition the PR describes exists natively: when the process is the console's first process, a visible 0x0
PseudoConsoleWindowis attributed to it. With no window of its own yet,main's rule picks it, and this PR returnsNone, so it falls back to our own window. In my runs, windows created after the console always sat above thePseudoConsoleWindowin z-order. I did not reproduce the order where it sits above an existing title window.Picks with real windows, started in a new console window as its first process (both rules run on the same live window list)
main(first visible)PseudoConsoleWindowNone(own window)None: a minimised window's client area is 0x0, so it no longer countsEnumWindowsdoes not list child windowsThe PR's rule holds on real windows, and
GetPropWsees the mark. Two edges to know about, neither a blocker:Not checked: the title itself and the lifecycle hook marking a window that the title creates (no game run), and z-order with a title window that existed before the pseudoconsole window became visible.
GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
VERIFY-2587 —
hleverde,hostcon la única falla de esta máquina, y el cambio ataca algo que no había visto en ningún otro PR de la nocheTres ficheros,
host.rs+83,lifecycle.rs+4, nueve días abierto:Esa falla es la de la iGPU de esta máquina, la misma que
#3286hace desaparecer — y no tiene nada que ver con este cambio, que toca el present.Y lo que el cambio hace, que es lo nuevo: presenta en la ventana del título y no en la ventana
0x0que crea un pseudoconsola. El diff lo dice con nombres:title_window, una propiedad que el hook del procedimiento de ventana del título pone en las ventanas que el juego crea (TITLE_PROCenleonida_hle::modules::lifecycle), unhwnd: usize, y una tabla que empieza con:Eso es un problema de presentación que sólo existe cuando el juego se lanza desde un terminal que intercepta, y la solución es encontrar la ventana que el juego creó en vez de la que el lanzador tiene como «propia». Es la misma clase de error que el
D3D12CreateDevice(None, …)de#3286: tomar por buena una suposición del entorno («el proceso tiene una ventana y es esta», «el adaptador predeterminado es el bueno») que es cierta en una máquina de escritorio y falsa en cuanto hay un terminal, una iGPU o un compositor de por medio.Lo que no probé: presentar en la ventana de verdad — necesita el título, y en esta sesión no hay escritorio. Lo que sí verifiqué es que
hlesigue en verde con su cambio enlifecycle.rs, que es donde vive elTITLE_PROCque el PR usa.Y una nota que le ahorra tiempo a quien lo pruebe: su tabla de casos incluye «white window under Windows Terminal», así que la condición para reproducirlo está descrita — es más de lo que la mitad de las PRs de presentación traen.