upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_backend.h
diff options
context:
space:
mode:
authorQemmHD <stephenlethco2@gmail.com>2026-11-24 11:25:15 -0500
committerGitHub <noreply@github.com>2026-11-24 11:25:15 -0500
commit7b5f8042e408d4947e4129b9b37233c7bd35cd54 (patch)
treeb824b7b936c92548d234026ce3afbb473519d37d /runtime/src/vulkan_backend.h
parentf5928c6b6bcedd4d5defe9a64cd58a0650a7d63d (diff)
parent9f9a503406c581320bcd84d5a73dc77ae9626107 (diff)
Merge pull request #470 from Kokonotcu/pr/submission-barrier
Merging. **Why merged:** Every queue submission now starts with a full memory barrier, which matches D3D12's ExecuteCommandLists boundary. Under synchronization validation, main's vk_queue_test fails with 10 WRITE_AFTER_WRITE errors; with this PR it reports "4 of 4 submissions start with a full memory barrier" and 0 errors. Three independent NVIDIA checks agree (kawaii-shakal, Timon360SB, DesertGamer). **Why it's good:** Cost, measured here because it was the open question: d3d12_bindless_churn (96 frames, many ExecuteCommandLists on 2 queues), 5 alternating runs, median, main vs PR: deferred 437.7 vs 433.8 ms, async 432.6 vs 437.3 ms, old-wait 438.3 vs 433.4 ms, old-wait async 440.2 vs 443.6 ms. vk_queue_test: 0.374 vs 0.370 s. All within run-to-run noise (about ±2%). These are synthetic tests, so there's no game-load number yet. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
Diffstat (limited to 'runtime/src/vulkan_backend.h')
-rw-r--r--runtime/src/vulkan_backend.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index f90dd6a3f..e2bf327b6 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -2553,6 +2553,18 @@ private:
2553 discard(); 2553 discard();
2554 return ReplayResult::unsupported; 2554 return ReplayResult::unsupported;
2555 } 2555 }
2556 // D3D12 ends every ExecuteCommandLists with all its work done and its writes visible to the next one on the
2557 // queue (implicit state decay relies on it), and a list may then touch the same memory without a barrier:
2558 // two submissions copying into one buffer, say. Vulkan orders submissions on a queue only by what their
2559 // barriers say, so this one starts with a full memory barrier against everything submitted before it
2560 // (synchronization validation: WRITE_AFTER_WRITE between vk_queue_test's back-to-back copies).
2561 if (context_.vk.vkCmdPipelineBarrier) { // a mocked context may leave it out
2562 VkMemoryBarrier full{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
2563 full.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT;
2564 full.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
2565 context_.vk.vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
2566 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1, &full, 0, nullptr, 0, nullptr);
2567 }
2556 if (!tracker_lock.owns_lock()) tracker_lock.lock(); 2568 if (!tracker_lock.owns_lock()) tracker_lock.lock();
2557 if (!transfer_only && context_.bindless_prepare_ && !context_.bindless_prepare_(command_buffer)) { 2569 if (!transfer_only && context_.bindless_prepare_ && !context_.bindless_prepare_(command_buffer)) {
2558 const bool ended = context_.vk.vkEndCommandBuffer(command_buffer) == VK_SUCCESS; 2570 const bool ended = context_.vk.vkEndCommandBuffer(command_buffer) == VK_SUCCESS;