[VK] spec-clean MasterSemaphore submits
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.
This commit is contained in:
parent
c228f9b746
commit
7b3378fb8a
1 changed files with 22 additions and 8 deletions
|
@ -129,11 +129,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 +149,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 +167,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