- the semaphore should never be added when its the last submit before waiting

This commit is contained in:
Magnus Norddahl 2019-04-20 16:42:52 +02:00
parent 401a4944b4
commit a3587009e7
2 changed files with 7 additions and 7 deletions

View file

@ -193,7 +193,7 @@ void VulkanFrameBuffer::DeleteFrameObjects()
FrameDeleteList.CommandBuffers.clear(); FrameDeleteList.CommandBuffers.clear();
} }
void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish) void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish, bool lastsubmit)
{ {
int currentIndex = mNextSubmit % maxConcurrentSubmitCount; int currentIndex = mNextSubmit % maxConcurrentSubmitCount;
@ -217,14 +217,14 @@ void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t cou
submit.addSignal(mRenderFinishedSemaphore.get()); submit.addSignal(mRenderFinishedSemaphore.get());
} }
if (!finish) if (!lastsubmit)
submit.addSignal(mSubmitSemaphore[currentIndex].get()); submit.addSignal(mSubmitSemaphore[currentIndex].get());
submit.execute(device, device->graphicsQueue, mSubmitFence[currentIndex].get()); submit.execute(device, device->graphicsQueue, mSubmitFence[currentIndex].get());
mNextSubmit++; mNextSubmit++;
} }
void VulkanFrameBuffer::FlushCommands(bool finish) void VulkanFrameBuffer::FlushCommands(bool finish, bool lastsubmit)
{ {
if (mDrawCommands || mTransferCommands) if (mDrawCommands || mTransferCommands)
{ {
@ -245,7 +245,7 @@ void VulkanFrameBuffer::FlushCommands(bool finish)
FrameDeleteList.CommandBuffers.push_back(std::move(mDrawCommands)); FrameDeleteList.CommandBuffers.push_back(std::move(mDrawCommands));
} }
FlushCommands(commands, count, finish); FlushCommands(commands, count, finish, lastsubmit);
current_rendered_commandbuffers += (int)count; current_rendered_commandbuffers += (int)count;
} }
@ -263,7 +263,7 @@ void VulkanFrameBuffer::WaitForCommands(bool finish)
mPostprocess->DrawPresentTexture(mOutputLetterbox, true, true); mPostprocess->DrawPresentTexture(mOutputLetterbox, true, true);
} }
FlushCommands(finish); FlushCommands(finish, true);
if (finish) if (finish)
{ {

View file

@ -34,7 +34,7 @@ public:
VkPostprocess *GetPostprocess() { return mPostprocess.get(); } VkPostprocess *GetPostprocess() { return mPostprocess.get(); }
VkRenderBuffers *GetBuffers() { return mActiveRenderBuffers; } VkRenderBuffers *GetBuffers() { return mActiveRenderBuffers; }
void FlushCommands(bool finish); void FlushCommands(bool finish, bool lastsubmit = false);
unsigned int GetLightBufferBlockSize() const; unsigned int GetLightBufferBlockSize() const;
@ -111,7 +111,7 @@ private:
void CopyScreenToBuffer(int w, int h, void *data); void CopyScreenToBuffer(int w, int h, void *data);
void UpdateShadowMap(); void UpdateShadowMap();
void DeleteFrameObjects(); void DeleteFrameObjects();
void FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish); void FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish, bool lastsubmit);
std::unique_ptr<VkShaderManager> mShaderManager; std::unique_ptr<VkShaderManager> mShaderManager;
std::unique_ptr<VkSamplerManager> mSamplerManager; std::unique_ptr<VkSamplerManager> mSamplerManager;