Explicitly choose when to submit OutsideCmdBuffer on vulkan

* This prevents problems where a drawcall callback submits the command buffer
  before we're finished recording it.
This commit is contained in:
baldurk
2018-11-01 12:23:12 +00:00
parent 42229ca089
commit 3eaac9f6e7
2 changed files with 24 additions and 0 deletions
+22
View File
@@ -234,6 +234,23 @@ VkCommandBuffer WrappedVulkan::GetNextCmd()
return ret;
}
void WrappedVulkan::RemovePendingCommandBuffer(VkCommandBuffer cmd)
{
for(auto it = m_InternalCmds.pendingcmds.begin(); it != m_InternalCmds.pendingcmds.end(); ++it)
{
if(*it == cmd)
{
m_InternalCmds.pendingcmds.erase(it);
break;
}
}
}
void WrappedVulkan::AddPendingCommandBuffer(VkCommandBuffer cmd)
{
m_InternalCmds.pendingcmds.push_back(cmd);
}
void WrappedVulkan::SubmitCmds(VkSemaphore *unwrappedWaitSemaphores,
VkPipelineStageFlags *waitStageMask, uint32_t waitSemaphoreCount)
{
@@ -2849,6 +2866,9 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
{
VkCommandBuffer cmd = m_OutsideCmdBuffer = GetNextCmd();
// we'll explicitly submit this when we're ready
RemovePendingCommandBuffer(cmd);
VkCommandBufferBeginInfo beginInfo = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
@@ -2946,6 +2966,8 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
ObjDisp(cmd)->EndCommandBuffer(Unwrap(cmd));
AddPendingCommandBuffer(cmd);
SubmitCmds();
m_OutsideCmdBuffer = VK_NULL_HANDLE;
+2
View File
@@ -928,6 +928,8 @@ public:
return m_PhysicalDevice;
}
VkCommandBuffer GetNextCmd();
void RemovePendingCommandBuffer(VkCommandBuffer cmd);
void AddPendingCommandBuffer(VkCommandBuffer cmd);
void SubmitCmds(VkSemaphore *unwrappedWaitSemaphores = NULL,
VkPipelineStageFlags *waitStageMask = NULL, uint32_t waitSemaphoreCount = 0);
VkSemaphore GetNextSemaphore();