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

Closed
leonida/mandy
QemmHD wants to merge 0 commits from qemmhd/rt-lazy-attachment-variant into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

QemmHD commented 2026-11-24 11:49:20 +00:00

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).

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 approved these changes 2026-11-24 16:00:21 +00:00
SweatierKey left a comment

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

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

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.

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.
Sign in to join this conversation.
No description provided.