[PR #751] [MERGED] d3d12: SYNC_COPY waits for the CLEAR stage too, ordering WriteBufferImmediate before copies (OLD-10048) #789

Closed
opened 2026-11-26 20:19:03 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/751
Author: @abnalstlll-byte
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: restore/old-10048-sync-copy-clear-stage


📝 Commits (1)

  • a744fa8 d3d12: 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

Restore old upstream PR 10048 (OLD-10048 / D3D-838).

An enhanced barrier's D3D12_BARRIER_SYNC_COPY mapped to VK_PIPELINE_STAGE_2_COPY_BIT only. Two D3D12 copy-scope commands are not Vulkan copies: WriteBufferImmediate is recorded as vkCmdUpdateBuffer and ResolveQueryData's never-written queries as vkCmdFillBuffer, and synchronization2 runs both in the CLEAR stage. A SYNC_COPY barrier after either therefore did not order it, and a copy after the barrier could read the word before the write landed.

vulkan_sync now maps SYNC_COPY to COPY | CLEAR. vk_command_replay_test part K records WriteBufferImmediate, a SYNC_COPY -> SYNC_COPY buffer barrier and a CopyBufferRegion of the written word; under LEONIDA_VK_VALIDATION=1 it is a read-after-write hazard without this change. d3d12_state_map_test and docs/d3d12_vulkan.md follow the new mapping.

Clean-room verified; zero game data.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/751 **Author:** [@abnalstlll-byte](https://github.com/abnalstlll-byte) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `restore/old-10048-sync-copy-clear-stage` --- ### 📝 Commits (1) - [`a744fa8`](https://github.com/ubiquitarianism/leonida/commit/a744fa8ab150c120babdbade56da470291d070cd) d3d12: SYNC_COPY waits for the CLEAR stage too (D3D-838) ### 📊 Changes **4 files changed** (+91 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description Restore old upstream PR 10048 (OLD-10048 / D3D-838). An enhanced barrier's D3D12_BARRIER_SYNC_COPY mapped to VK_PIPELINE_STAGE_2_COPY_BIT only. Two D3D12 copy-scope commands are not Vulkan copies: WriteBufferImmediate is recorded as vkCmdUpdateBuffer and ResolveQueryData's never-written queries as vkCmdFillBuffer, and synchronization2 runs both in the CLEAR stage. A SYNC_COPY barrier after either therefore did not order it, and a copy after the barrier could read the word before the write landed. vulkan_sync now maps SYNC_COPY to COPY | CLEAR. vk_command_replay_test part K records WriteBufferImmediate, a SYNC_COPY -> SYNC_COPY buffer barrier and a CopyBufferRegion of the written word; under LEONIDA_VK_VALIDATION=1 it is a read-after-write hazard without this change. d3d12_state_map_test and docs/d3d12_vulkan.md follow the new mapping. Clean-room verified; zero game data. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:03 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#789
No description provided.