[VK] spec-clean MasterSemaphore submits (#285)
fixes this error [ 18.505526] Render.Vulkan <Info> video_core/vulkan_common/vulkan_debug_callback.cpp:DebugUtilCallback:59: Validation Information: [ UNASSIGNED-BestPractices-SemaphoreCount ] | MessageID = 0x6cfe18a5 | pSubmits[0].pWaitSemaphores is set, but pSubmits[0].waitSemaphoreCount is 0. This patch is only corrective in nature and is trivial and should not fix or break anything just one of the best practices in vulkan. It nulls pWaitSemaphores / pWaitDstStageMask / pSignalSemaphores when the corresponding counts are zero. Reviewed-on: #285 Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev> Co-authored-by: wildcard <wildcard@eden-emu.dev> Co-committed-by: wildcard <wildcard@eden-emu.dev>
This commit is contained in:
parent
c228f9b746
commit
949f72222b
1 changed files with 25 additions and 8 deletions
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -129,11 +132,19 @@ VkResult MasterSemaphore::SubmitQueueTimeline(vk::CommandBuffer& cmdbuf,
|
|||
const std::array cmdbuffers{*upload_cmdbuf, *cmdbuf};
|
||||
|
||||
const u32 num_wait_semaphores = wait_semaphore ? 1 : 0;
|
||||
// Pointers must be null when the count is zero (best-practices)
|
||||
const VkSemaphore* p_wait_sems =
|
||||
(num_wait_semaphores > 0) ? &wait_semaphore : nullptr;
|
||||
const VkPipelineStageFlags* p_wait_masks =
|
||||
(num_wait_semaphores > 0) ? wait_stage_masks.data() : nullptr;
|
||||
const VkSemaphore* p_signal_sems =
|
||||
(num_signal_semaphores > 0) ? signal_semaphores.data() : nullptr;
|
||||
const u64 wait_zero = 0; // dummy for binary wait
|
||||
const VkTimelineSemaphoreSubmitInfo timeline_si{
|
||||
.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO,
|
||||
.pNext = nullptr,
|
||||
.waitSemaphoreValueCount = 0,
|
||||
.pWaitSemaphoreValues = nullptr,
|
||||
.waitSemaphoreValueCount = num_wait_semaphores,
|
||||
.pWaitSemaphoreValues = num_wait_semaphores ? &wait_zero : nullptr,
|
||||
.signalSemaphoreValueCount = num_signal_semaphores,
|
||||
.pSignalSemaphoreValues = signal_values.data(),
|
||||
};
|
||||
|
@ -141,12 +152,12 @@ VkResult MasterSemaphore::SubmitQueueTimeline(vk::CommandBuffer& cmdbuf,
|
|||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||
.pNext = &timeline_si,
|
||||
.waitSemaphoreCount = num_wait_semaphores,
|
||||
.pWaitSemaphores = &wait_semaphore,
|
||||
.pWaitDstStageMask = wait_stage_masks.data(),
|
||||
.pWaitSemaphores = p_wait_sems,
|
||||
.pWaitDstStageMask = p_wait_masks,
|
||||
.commandBufferCount = static_cast<u32>(cmdbuffers.size()),
|
||||
.pCommandBuffers = cmdbuffers.data(),
|
||||
.signalSemaphoreCount = num_signal_semaphores,
|
||||
.pSignalSemaphores = signal_semaphores.data(),
|
||||
.pSignalSemaphores = p_signal_sems,
|
||||
};
|
||||
|
||||
return device.GetGraphicsQueue().Submit(submit_info);
|
||||
|
@ -159,18 +170,24 @@ VkResult MasterSemaphore::SubmitQueueFence(vk::CommandBuffer& cmdbuf,
|
|||
const u32 num_signal_semaphores = signal_semaphore ? 1 : 0;
|
||||
const u32 num_wait_semaphores = wait_semaphore ? 1 : 0;
|
||||
|
||||
const VkSemaphore* p_wait_sems =
|
||||
(num_wait_semaphores > 0) ? &wait_semaphore : nullptr;
|
||||
const VkPipelineStageFlags* p_wait_masks =
|
||||
(num_wait_semaphores > 0) ? wait_stage_masks.data() : nullptr;
|
||||
const VkSemaphore* p_signal_sems =
|
||||
(num_signal_semaphores > 0) ? &signal_semaphore : nullptr;
|
||||
const std::array cmdbuffers{*upload_cmdbuf, *cmdbuf};
|
||||
|
||||
const VkSubmitInfo submit_info{
|
||||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||
.pNext = nullptr,
|
||||
.waitSemaphoreCount = num_wait_semaphores,
|
||||
.pWaitSemaphores = &wait_semaphore,
|
||||
.pWaitDstStageMask = wait_stage_masks.data(),
|
||||
.pWaitSemaphores = p_wait_sems,
|
||||
.pWaitDstStageMask = p_wait_masks,
|
||||
.commandBufferCount = static_cast<u32>(cmdbuffers.size()),
|
||||
.pCommandBuffers = cmdbuffers.data(),
|
||||
.signalSemaphoreCount = num_signal_semaphores,
|
||||
.pSignalSemaphores = &signal_semaphore,
|
||||
.pSignalSemaphores = p_signal_sems,
|
||||
};
|
||||
|
||||
auto fence = GetFreeFence();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue