mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1062] d3d12: BeginRenderPass and EndRenderPass, Tier 0 emulation on the Vulkan-backed list (D3D-27) #1099
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#1099
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/1062
Author: @syntaxixr
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:d3d12/render-passes📝 Commits (2)
7d19436d3d12: BeginRenderPass and EndRenderPass, Tier 0 emulation on the Vulkan-backed list (D3D-27)3dcd091d3d12: render pass Close parity with the host runtime, from #1062's review (D3D-27)📊 Changes
4 files changed (+889 additions, -6 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+33 -6)📝
runtime/CMakeLists.txt(+8 -0)📝
runtime/shims/d3d12_com.cpp(+157 -0)➕
runtime/test/d3d12_render_pass_test.cpp(+691 -0)📄 Description
Claimed in the coordination issue as: D3D-27 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138565644). #628 had it before and was closed by its author with the branch deleted; this is a fresh implementation.
Problem
On
main,ID3D12GraphicsCommandList4::BeginRenderPass/EndRenderPassare the generated stubs. The device already reportsRenderPassesTier = TIER_0, so a title that records a frame with render passes binds no targets, runs no clears and no resolves.Change
Tier 0 emulation on the list's own commands, the way the D3D12 runtime handles a Tier 0 driver (
runtime/shims/d3d12_com.cpp):BeginRenderPassbinds the pass's RTVs/DSV through the same code asOMSetRenderTargets(bind_targets) and records eachCLEARbeginning access as aClearRenderTargetView/ClearDepthStencilView. Depth and stencil each go by their own access, in one clear.PRESERVE,DISCARD,NO_ACCESSandPRESERVE_LOCAL_*record nothing.RESOLVEending accesses are copied atBeginRenderPassand recorded atEndRenderPass, one per subresource parameter, throughResolveSubresourceRegion's checks. These are now in aresolve_regionhelper;ResolveSubresourceRegionbehaves the same.RESUMING_PASSskips the clears andSUSPENDING_PASSskips the resolves.Closereturns what Windows WARP returns (and, for the cases the review probed, the host D3D12 runtime on an RTX 5070 Ti):E_INVALIDARG:EndRenderPasswith no pass,EndRenderPasstwice, a nestedBeginRenderPass.E_FAIL: a pass left open; more than eight targets; a pass on a bundle or a compute list; andOMSetRenderTargets,ClearRenderTargetView,ClearDepthStencilView,CopyResource,CopyTextureRegion,CopyBufferRegion,DiscardResource,ResolveSubresource,ResolveSubresourceRegionorDispatchinside a pass (not recorded).S_OK: a resource barrier inside a pass, and aCLEARwith no descriptor or aRESOLVEwith no source, which WARP skips and so does the layer.Resetonly, not byClearState.docs/d3d12_vulkan.mdsection 4.3 and the M3 row are updated.Tested
New
d3d12_render_pass_test(in CMake and ctest). It runs eight cases through the D3D12 API on the Vulkan-backed device and on Windows WARP, and compares the readback bytes andCloseHRESULTs. It also checks WARP against the values written in the test, so a case cannot pass by both sides being wrong:mainALLOW_UAV_WRITESD32_FLOATdepth RESOLVE (MIN; skipped on a device without MIN depth resolves)Closecases, each with its expected HRESULTThe same eight pass with
LEONIDA_VK_VALIDATION=1(Khronos validation layer 1.4.341), 0 validation errors. Seven targeted mutations of the emulation (a forbidden call not checked, a bundle pass back toE_INVALIDARG, a null-RTV CLEAR made an error, RESUMING clearing, the depth resolve dropped, nine targets back toE_INVALIDARG, SUSPENDING resolving) each make one case fail.Setup: AMD Radeon RX 6600 (RDNA2), AMD Windows driver 26.6.4 (32.0.21043.19003), Windows 10 22H2 19045, MSVC 14.44 + Windows SDK 10.0.26100, Ninja, RelWithDebInfo.
Full
cteston this branch: 299/308 passed. 8 failures fail the same way onmainon this machine, because Windows 10 has an older D3D12 runtime and WARP:root_signature_oracle,d3d12_vulkan_device,d3d12_texture_tiles,d3d12_close_parity,d3d12_clear,d3d12_pso_validation,d3d12_mesh,d3d12_set_descriptor_heaps.d3d12_close_parity's output is line for line the same as onmain. The ninth,xmem("mapping them does not charge them", next to its remap race), failed once under the parallel run and passed 5/5 run alone; this PR does not touch xmem. Thetests/test_docs_*.pysuite,test_d3d12_stubs_generation.pyandcheck_no_game_data.pypass.Not covered: draws inside a pass (they use the same per-draw rendering scope as after
OMSetRenderTargets),PRESERVE_LOCAL_*, the forbidden calls WARP was not measured for (UAV clears,CopyTiles,ExecuteIndirect, queries), and a Tier 1 path.No game files. AI-assisted.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.