d3d12: select only the needed deferred Vulkan draw pipeline #681

Closed
QemmHD wants to merge 2 commits from upstream-pr/681 into main
QemmHD commented 2026-11-24 11:49:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T11:49:20Z.


Claimed in #14 as RT-LAZY-ATTACHMENT-VARIANT.

Depends on: #511. This branch keeps the original #511 commit intact. The last commit is the change for review.

What and why

The deferred Vulkan draw path tries the full-attachment pipeline before it knows which attachments are bound. When a target is absent, this can compile two pipelines for one draw. If the full-attachment compile fails, replay rejects the draw before trying its usable variant.

Select the pipeline once after draw validation, using the final attachment mask. Fully bound eager draws still use the pipeline they already have. The CPU replay self-test covers eager draws, fully bound and partial lazy draws, a refused unused base, and an invalid mesh draw.

Tested

  • On #511 with the new fixture, three cases failed: duplicate compilation, premature rejection, and compilation for an invalid draw.
  • With the fix, all seven selection cases passed in replay_cpu_bench_selftest on Windows 11 with MSVC 2022 x64 and Vulkan SDK headers.
  • git diff --check, the repository game-data scan on both changed files, and the merge check against main at 21625bca8 passed.

GPU coverage for this follow-up: CPU replay fixture only.

AI-assisted: yes (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5471555584 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/681). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T11:49:20Z. --- Claimed in #14 as [RT-LAZY-ATTACHMENT-VARIANT](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130582270). Depends on: #511. This branch keeps the original #511 commit intact. The last commit is the change for review. ### What and why The deferred Vulkan draw path tries the full-attachment pipeline before it knows which attachments are bound. When a target is absent, this can compile two pipelines for one draw. If the full-attachment compile fails, replay rejects the draw before trying its usable variant. Select the pipeline once after draw validation, using the final attachment mask. Fully bound eager draws still use the pipeline they already have. The CPU replay self-test covers eager draws, fully bound and partial lazy draws, a refused unused base, and an invalid mesh draw. ### Tested - On #511 with the new fixture, three cases failed: duplicate compilation, premature rejection, and compilation for an invalid draw. - With the fix, all seven selection cases passed in `replay_cpu_bench_selftest` on Windows 11 with MSVC 2022 x64 and Vulkan SDK headers. - `git diff --check`, the repository game-data scan on both changed files, and the merge check against `main` at `21625bca8` passed. GPU coverage for this follow-up: CPU replay fixture only. AI-assisted: yes (Codex).
SweatierKey commented 2026-11-24 16:00:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by SweatierKey on 2026-11-24T16:00:21Z.

Review: APPROVED


Independent verification on Windows 11 against origin/main@1504c1af6:

  • Cross-compiled replay_cpu_bench.exe (clang-cl + xwin SDK 10.0.26100) and ran natively on Windows 11:
    • Passed check_draw_pipeline_selection() and all replay CPU benchmarks (rc=0).
  • Audited d3d12_vulkan_device.cpp and vulkan_replay.h: clean deferred pipeline creation under LEONIDA_LAZY_PSO=1 (preserving edited modules for f16-link and depth24 fragments, building unedited stages on demand and destroying transient VkShaderModules immediately after vkCreate*Pipelines).
  • python3 -I scripts/check_no_game_data.py: clean.

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6042795565 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/681#pullrequestreview-6042795565). Originally posted by [SweatierKey](https://github.com/SweatierKey) on 2026-11-24T16:00:21Z. **Review:** APPROVED --- Independent verification on Windows 11 against `origin/main@1504c1af6`: - Cross-compiled `replay_cpu_bench.exe` (`clang-cl` + xwin SDK 10.0.26100) and ran natively on Windows 11: - Passed `check_draw_pipeline_selection()` and all replay CPU benchmarks (`rc=0`). - Audited `d3d12_vulkan_device.cpp` and `vulkan_replay.h`: clean deferred pipeline creation under `LEONIDA_LAZY_PSO=1` (preserving edited modules for f16-link and depth24 fragments, building unedited stages on demand and destroying transient `VkShaderModule`s immediately after `vkCreate*Pipelines`). - `python3 -I scripts/check_no_game_data.py`: clean. AI-assisted: yes
DadaCap commented 2026-11-28 10:34:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:34:33Z.


Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures.

Reason: superseded by main.

If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237985428 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/681#issuecomment-7237985428). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T10:34:33Z. --- Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures. Reason: superseded by main. If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!681
No description provided.