Repository navigation
Runtime: SetPredication on VK_EXT_conditional_rendering (D3D-18) - #258
Conversation
f3e4400 to
ebff762
Compare
|
Tested ebff762 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
No game files used. AI-assisted run (Claude Code). |
ebff762 to
96f113a
Compare
- command_list.h: a Predication command (offset 8-byte aligned, EQUAL_ZERO or NOT_EQUAL_ZERO; a null buffer turns it off), recorded by GraphicsCommandList::SetPredication. - vulkan_replay.h: begin/end conditional rendering (INVERTED for NOT_EQUAL_ZERO), ended before a new predicate and at the end of the list. While predicated, whole-view clears go through vkCmdClearAttachments, which conditional rendering covers. New ReplayResult::invalid_predication; PreparedList::unpredicated_copies counts copies Vulkan cannot predicate. - Device: VK_EXT_conditional_rendering and its feature enabled when present, and buffers created with VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT; without it a predicated list is unsupported. - Tests: command_list_test (recording rules), vk_command_replay_test part C (GPU). - docs/d3d12_vulkan.md 4.7: what is done; copies and the 64-bit value are open. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
96f113a to
be91840
Compare
|
Tested be91840 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
This re-tests the new head (earlier pass: ebff762). No game files used. AI-assisted run (Claude Code). |
|
Tested: PR head be91840 merged onto main 4abd545, ctest 19/19. |
D3D-18 in #156 (
docs/d3d12_vulkan.md§4.7).What and why
ID3D12GraphicsCommandList::SetPredicationwas a logging stub. It now maps toVK_EXT_conditional_rendering:runtime/src/command_list.h): aPredicationcommand. The offset must be 8-byte aligned and the opEQUAL_ZEROorNOT_EQUAL_ZERO, as D3D12 requires; a null buffer turns predication off and ignores the other arguments.GraphicsCommandList::SetPredicationrecords it.runtime/src/vulkan_replay.h):vkCmdBeginConditionalRenderingEXTon the predicate buffer, plain forEQUAL_ZERO(Vulkan discards when the word is 0) andVK_CONDITIONAL_RENDERING_INVERTED_BIT_EXTforNOT_EQUAL_ZERO. It is ended before a new predicate (conditional rendering cannot nest) and at the end of the list (predication does not carry over to the next list). While a predicate is set, whole-view clears are replayed as one rectangle withvkCmdClearAttachments, becausevkCmdClearColorImage/vkCmdClearDepthStencilImageignore conditional rendering. NewReplayResult::invalid_predication(a predicate that isn't a buffer, or whose word is out of range).runtime/shims/d3d12_vulkan_device.cpp,vulkan_backend.h,d3d12_com.h): the standalone device enables the extension and itsconditionalRenderingfeature when the GPU has them (VulkanDeviceInfo::conditional_rendering), and then creates buffers withVK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT. The two entry points reach the replay only when the extension is on. Without it, a predicated list is rejected asunsupportedinstead of running unpredicated.SetPredicationin a bundle, so it invalidates the bundle likemain's other bundle-forbidden calls (ClosereturnsE_INVALIDARG). It's added to the bundle check ind3d12_com_testand to the bundle note in §3.2.Open (documented in §4.7, not hidden):
CopyBufferRegion/CopyTextureRegion/CopyResource/ResolveSubresource/ResolveSubresourceRegion(resolves are onmainsince Runtime: ResolveSubresource and multisampled textures on Vulkan #228). Vulkan's conditional rendering doesn't cover transfer commands, so they run unconditionally.PreparedList::unpredicated_copiescounts them for the caller. A fix replays them as a compute dispatch once compute pipelines are in (D3D-3).ExecuteIndirectget predication from conditional rendering as soon as they are replayed (D3D-3, D3D-4, D3D-17).Depends on: #119
Depends on: #278
Depends on: #286
Depends on: #288
Depends on: #291
Depends on: #306
Depends on: #317
Depends on: #335
Depends on: #367
Depends on: #388
Depends on: #391
Depends on: #417
Depends on: #419
Depends on: #469
(None of these is needed for this PR to work. Each one conflicts with it in git. I checked with
git merge-treeagainst every open PR that touches the same files, counting only conflicts this branch adds on top of what the PR already has withmain. The overlap is mechanical: a newCommandalternative, newReplayFunctionspointers, a newVulkanDeviceInfofield, a new optional extension in device creation and a new replay test part. #157, #333, #334, #423 and #450 already conflict withmainin the same files, so I'll re-check them after they rebase. I'll rebase onto whichever lands first.)Tested
Windows 11, NVIDIA GeForce RTX 3070 (driver 610.88, Vulkan 1.4.341), Vulkan SDK 1.4.363.0, MSVC 14.44 (VS 2022), rebased on
4abd545. No game files.cmake --build runtime/build --config RelWithDebInfo: builds with no warnings.ctest -C RelWithDebInfo: 19/19, includingcommand_listwith the new recording checks (alignment, op, off, closed list).vk_command_replay_testwithLEONIDA_VK_VALIDATION=1: parts A to D unchanged (C ismain's volume and resolve test, D its barrier test), new part E passes with no validation errors. Five layers, one case each, read back:EQUAL_ZEROon 0 skips a whole-view and a rectangle clear;EQUAL_ZEROon 1 runs;NOT_EQUAL_ZEROon 1 skips;NOT_EQUAL_ZEROon 0 runs; predication turned off runs. A predicate left set at the end of the list is ended by the replay (validation would flag it otherwise). Rejections checked: no extension (unsupported), unknown resource, out-of-range offset and an image as predicate (invalid_predication); one copy under a predicate is counted.d3d12_com_test: passes, including the new bundle check.d3d12_vulkan_device_test: passes with the extension enabled on the standalone device.(Validation on this PC also reports a loader error from a third-party overlay layer that fails to load; with that layer disabled through
VK_LOADER_LAYERS_DISABLEthe run has zero validation errors.)Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)AI-assisted (Claude Code).
🤖 Generated with Claude Code