Skip to content

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

Draft
QemmHD wants to merge 2 commits into
mainfrom
qemmhd/rt-lazy-attachment-variant
Draft

QemmHD wants to merge 2 commits into
mainfrom
qemmhd/rt-lazy-attachment-variant

Conversation

@QemmHD

@QemmHD QemmHD commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

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

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

AI-assisted: yes (Codex).

VibeClauding and others added 2 commits November 24, 2026 08:38
…patch and keeps no unedited shader modules (RT-LAZY-PSO)

Graphics PSOs build their driver pipeline as variant(0) at the first draw; compute PSOs compile through
ComputePipeline::build at the first dispatch. A stage the runtime does not edit (no f16 link, no D24 depth patch)
keeps no VkShaderModule: build() makes one from the library's words per pipeline and destroys it after. The compute
subgroup request is still decided and recorded at creation in both modes. Off by default.

Tests: d3d12_compute_lazy_pso, d3d12_draw_lazy_pso, d3d12_mesh_lazy_pso (the existing tests with the switch on).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@SweatierKey SweatierKey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants