mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #314] d3d12: SYNC_COPY waits for the CLEAR stage too, so WriteBufferImmediate is ordered (D3D-838) #365
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#365
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/314
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/10048📝 Commits (1)
bbc8999d3d12: SYNC_COPY waits for the CLEAR stage too (D3D-838)📊 Changes
4 files changed (+91 additions, -5 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+5 -1)📝
runtime/src/vulkan_replay.h(+4 -1)📝
runtime/test/d3d12_state_map_test.cpp(+6 -2)📝
runtime/test/vk_command_replay_test.cpp(+76 -1)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claimed in the coordination issue as: D3D-838 (https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117033945)
Re-submission of
#8187, which was closed unmerged with the other open PRs between 22:25 and 22:49 UTC; the fix is not onmain. Same commit, cherry-picked onto currentmain(de4c37383) without conflicts.#8187has three independent passes on it: an RTX 5070 with the full ctest, an RTX 4080 SUPER underLEONIDA_VK_VALIDATION=1with a negative control, and two CPU-only checks ofd3d12_state_map_test(Windows and Linux) that fail without the change.What and why
An enhanced barrier's
D3D12_BARRIER_SYNC_COPYmapped toVK_PIPELINE_STAGE_2_COPY_BITonly (vulkan_sync,runtime/src/vulkan_replay.h). Two D3D12 copy-scope commands are not Vulkan copies:WriteBufferImmediateis recorded asvkCmdUpdateBuffer, and a DEFAULT-mode write gets no barrier of its own (replay leaves it to the application's barriers);ResolveQueryDatafills never-written queries withvkCmdFillBuffer.Synchronization2 runs both in the
CLEARstage, notCOPY, so aSYNC_COPYbarrier after either did not order it, and a copy after the barrier could read the word before the write landed. The legacy-state path already covers this (COPY_DESTmaps toCOPY | TRANSFER).vulkan_sync:SYNC_COPY→COPY | CLEAR. Every access a copy barrier names stays valid in that mask (TRANSFER_WRITEis allowed inCLEAR;TRANSFER_READkeepsCOPY).vk_command_replay_testpart K:WriteBufferImmediateinto one buffer, aSYNC_COPY → SYNC_COPYbuffer barrier (COPY_DEST → COPY_SOURCE), thenCopyBufferRegionof the written word into another buffer. It checks the copied value and, underLEONIDA_VK_VALIDATION=1, that synchronization validation reports nothing.d3d12_state_map_test: the two expectations that includedSYNC_COPY, plus a direct check of the new mapping.docs/d3d12_vulkan.md: one sentence on the mapping where the enhanced barriers are described.Tested
Windows 10, NVIDIA GeForce RTX 2070 SUPER, driver 610.88 (Vulkan 1.4.341), MSVC 14.44 (VS 2022 Build Tools 17.14), Ninja
RelWithDebInfo, Vulkan SDK 1.4.363.0 validation layer with synchronization validation.On this branch (current
main+ the commit):d3d12_state_map_test: pass.vk_command_replay_testwithLEONIDA_VK_VALIDATION=1: parts A–K pass, 0 validation errors (part D's 360 sync/access pairs included, so the wider stage mask is valid on every barrier kind);vk_sync_validation_selftestconfirms synchronization validation is active.On
#8187's base (dde82f27e):vulkan_replay.hchange, part K fails with 1 validation error (the read-after-write hazard), so the test catches the bug.ctest -j 8: 253 of 262 passed; the 8 failures reproduce without the change on the same build (details in https://github.com/ProjectLeonida/Leonida/pull/8187#issuecomment-7110226888 and#166).Open PRs touching the same files merge with this one without conflicts (
git merge-treeagainst each). No game files used.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.