Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
O3DE Linux Editor fix
From cc94550c7e27058cff8a9e6ad2007e4ce209fcc7 Mon Sep 17 00:00:00 2001
From: Fabio Anderegg <fabioa@kythera.ai>
Date: Fri, 16 Jul 2021 09:22:31 +0100
Subject: linux hack: do not try to submit command buffers until first window
resize event was handled
Signed-off-by: Fabio Anderegg <fabioa@kythera.ai>
diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/SwapChain.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/SwapChain.h
index 14e9968e4..d10fd7abb 100644
--- a/Gems/Atom/RHI/Code/Include/Atom/RHI/SwapChain.h
+++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/SwapChain.h
@@ -81,6 +81,8 @@ namespace AZ
AZ_RTTI(SwapChain, "{888B64A5-D956-406F-9C33-CF6A54FC41B0}", Object);
+ AZStd::atomic_uint resizeCounter = {0};
+
protected:
SwapChain();
diff --git a/Gems/Atom/RHI/Code/Source/RHI/SwapChain.cpp b/Gems/Atom/RHI/Code/Source/RHI/SwapChain.cpp
index b0501d937..a568b68c8 100644
--- a/Gems/Atom/RHI/Code/Source/RHI/SwapChain.cpp
+++ b/Gems/Atom/RHI/Code/Source/RHI/SwapChain.cpp
@@ -164,6 +164,8 @@ namespace AZ
m_currentImageIndex = 0;
}
+ resizeCounter++;
+
return resultCode;
}
diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp
index ca6c829cc..24b6af9d9 100644
--- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp
+++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp
@@ -42,6 +42,14 @@ namespace AZ
void CommandQueue::ExecuteWork(const RHI::ExecuteWorkRequest& rhiRequest)
{
+ for (RHI::SwapChain* swapChain : rhiRequest.m_swapChainsToPresent)
+ {
+ if (swapChain->resizeCounter == 0)
+ {
+ return;
+ }
+ }
+
const ExecuteWorkRequest& request = static_cast<const ExecuteWorkRequest&>(rhiRequest);
QueueCommand([=](void* queue)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment