mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:30:53 +01:00
[PR #499] d3d12/vulkan: replay full graphics state for ExecuteIndirect DRAW and DRAW_INDEXED (D3D-EXECIND-GRAPHICS) #549
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#549
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/499
Author: @jujumoneylol
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:pr/d3d12-execind-graphics📝 Commits (2)
106c718d3d12/vulkan: replay full graphics state for ExecuteIndirect DRAW and DRAW_INDEXED3093a84d3d12/vulkan: gate indirect draw replay on multiDrawIndirect and drawIndirectCount📊 Changes
10 files changed (+1072 additions, -163 deletions)
View changed files
📝
runtime/CMakeLists.txt(+9 -1)📝
runtime/shims/d3d12_com.cpp(+9 -0)📝
runtime/shims/d3d12_com.h(+4 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+5 -0)📝
runtime/src/command_list.h(+6 -0)📝
runtime/src/vulkan_backend.h(+14 -2)📝
runtime/src/vulkan_replay.h(+197 -160)➕
runtime/test/d3d12_indirect_draw_test.cpp(+782 -0)📝
runtime/test/d3d12_state_map_test.cpp(+40 -0)📝
runtime/test/vk_test_device.h(+6 -0)📄 Description
Claimed in the coordination issue as: D3D-EXECIND-GRAPHICS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123837093)
Depends on: #469 (adjacent lines in
vulkan_replay.hdraw replay,d3d12_vulkan_device.cppfeature enables, andvk_test_device.hif both merge; this branch is based cleanly on currentmain8f481cf16with no code dependency on #469)What and why
Previously,
ExecuteIndirectfor graphics draw signatures (D3D12_INDIRECT_ARGUMENT_TYPE_DRAWandD3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED) only validated the argument/count buffers and emitted a barevkCmdDrawIndirect*call without snapshotting graphics state, starting dynamic rendering, or binding the graphics pipeline, render targets, push constants, viewport/scissor, or vertex/index buffers. In addition, neithercreate_vulkan_device_standalonenorvktest::Deviceenabled Vulkan'smultiDrawIndirectordrawIndirectCountfeatures required formax_count > 1and GPU count buffers.runtime/src/command_list.h,runtime/shims/d3d12_com.cpp):bool has_draw+Draw drawtoleonida::ExecuteIndirect.ExecuteIndirectis recorded fordrawordraw_indexedwithmax_command_count > 0and a bound graphics pipeline, root signature, and primitive topology, snapshots the full graphics state (pipeline, root user data, render targets, depth target, vertex/index buffer views, viewport, scissor, blend factor, stencil refs), matchingDrawInstanced/DrawIndexedInstanced(including the zero-viewport early-out).has_draw == falsewhen no graphics PSO is bound ormax_command_count == 0, preserving existingClose()validation parity (d3d12_indirect_zero_test,d3d12_execute_indirect_validation_test) and bare-IR tests (d3d12_indirect_rt_test).runtime/src/vulkan_replay.h):ind->drawviadetail::prepare_draw(resolving targets, format variants, vertex buffers, and index buffer).emit_graphics_passhelper used by both directDrawand graphicsExecuteIndirectso dynamic rendering, attachment layout transitions, pipeline, bindless set, push constants, dynamic state, and vertex/index buffer bindings are identical.max_count == 0as a clean no-op without opening an empty render pass.runtime/shims/d3d12_vulkan_device.cpp,runtime/test/vk_test_device.h):VkPhysicalDeviceFeatures::multiDrawIndirectandVkPhysicalDeviceVulkan12Features::drawIndirectCountwhere supported by the GPU.runtime/test/d3d12_indirect_draw_test.cpp):d3dcompiler_47for host reference).DRAWfixed/multi/padded-stride,DRAWwith GPU count buffer 0/1/clamped 5>2,DRAW_INDEXEDmulti/padded-stride withBaseVertexLocation,DRAW_INDEXEDwith GPU count buffer 1/2, andmax_count = 0no-op), comparing all 64/64 pixels byte-for-byte against host Windows D3D12 on the same adapter.Tested
d3d12_indirect_draw_test,d3d12_indirect_zero_test,d3d12_execute_indirect_validation_test, andd3d12_state_map_testwith MSVC 19.44 (vcvars64) + Ninja on top ofmain8f481cf16.d3d12_indirect_draw_test: ALL 11 CASES PASSED (EXACT MATCH vs host D3D12) — 64/64 pixels exact on every case on NVIDIA GeForce GTX 1650 with 0 validation errors.d3d12_indirect_zero_test: PASSED (6/6 exact vs GTX 1650 & WARP).d3d12_state_map_test: PASSED.py -3.13 -I scripts/check_no_game_data.pyon all 7 touched files: clean.GPUs tested: NVIDIA GeForce GTX 1650 Mobile 4 GB (driver 592.00, Vulkan 1.4.325, Windows 11 26200)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — D3D12 → Vulkan runtime only)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.