Fix for Linux/Vulkan/Editor crash on startup

* Temporary fix for Linux/Vulkan/XCB where the swap chain is not ready to present until the resize is complete
* Fix invalid GUID from LinuxXcbConnectionManager

Signed-off-by: spham-amzn <spham@amazon.com>
This commit is contained in:
Steve Pham
2021-07-31 08:42:02 -07:00
committed by GitHub
parent bb372f05cd
commit b46a80be2c
4 changed files with 23 additions and 1 deletions
@@ -35,7 +35,7 @@ namespace AzFramework
class LinuxXcbConnectionManager
{
public:
AZ_RTTI(LinuxXcbConnectionManager, "{649951316-3626-4C9D-9DCA-2E7ABF84C0A9}");
AZ_RTTI(LinuxXcbConnectionManager, "{1F756E14-8D74-42FD-843C-4863307710DB}");
virtual ~LinuxXcbConnectionManager() = default;
@@ -81,6 +81,15 @@ namespace AZ
AZ_RTTI(SwapChain, "{888B64A5-D956-406F-9C33-CF6A54FC41B0}", Object);
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
// On Linux platforms that uses XCB, a resize may occur in the swap chain but the command queue may still
// reference the original surface. This flag is a temporary fix to make sure that all the swap chains
// have finished their resize events before presenting the command queue.
// [GFX TODO][GHI - 2678]
AZStd::atomic_bool m_resized{ false };
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
protected:
SwapChain();
@@ -164,6 +164,10 @@ namespace AZ
m_currentImageIndex = 0;
}
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
m_resized.store(true);
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
return resultCode;
}
@@ -42,6 +42,15 @@ namespace AZ
void CommandQueue::ExecuteWork(const RHI::ExecuteWorkRequest& rhiRequest)
{
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
for (RHI::SwapChain* swapChain : rhiRequest.m_swapChainsToPresent)
{
if (!swapChain->m_resized)
{
return;
}
}
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
const ExecuteWorkRequest& request = static_cast<const ExecuteWorkRequest&>(rhiRequest);
QueueCommand([=](void* queue)
{