Fix flickering on multi-windows on macOS regression from #4141
This commit is contained in:
@@ -135,6 +135,7 @@ GPUTextureView* GPUSwapChainVulkan::GetBackBufferView()
|
||||
PROFILE_CPU();
|
||||
auto context = _device->MainContext;
|
||||
auto cmdBufferManager = context->GetCmdBufferManager();
|
||||
|
||||
// Keep commands recorded before acquire independent from the image-acquired semaphore wait below.
|
||||
if (cmdBufferManager->HasPendingActiveCmdBuffer())
|
||||
context->Flush();
|
||||
@@ -152,7 +153,6 @@ GPUTextureView* GPUSwapChainVulkan::GetBackBufferView()
|
||||
acquiredBackBuffer.WaitForSubmit();
|
||||
|
||||
const auto backBuffer = &_backBuffers[_acquiredImageIndex].Handle;
|
||||
|
||||
auto cmdBuffer = cmdBufferManager->GetCmdBuffer();
|
||||
|
||||
// Transition to render target (typical usage in most cases when calling backbuffer getter)
|
||||
@@ -171,6 +171,17 @@ GPUTextureView* GPUSwapChainVulkan::GetBackBufferView()
|
||||
void GPUSwapChainVulkan::Begin(RenderTask* task)
|
||||
{
|
||||
GPUSwapChain::Begin(task);
|
||||
|
||||
// Wait for the backbuffer to be available
|
||||
if (_currentImageIndex != -1)
|
||||
{
|
||||
auto& backBuffer = _backBuffers[_currentImageIndex];
|
||||
if (backBuffer.SubmitCmdBuffer)
|
||||
{
|
||||
backBuffer.SubmitCmdBuffer->Wait();
|
||||
backBuffer.SubmitCmdBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GPUSwapChainVulkan::Resize(int32 width, int32 height)
|
||||
|
||||
Reference in New Issue
Block a user