Two misc bugfixes:

1) RayTracing will sometimes crash by dereferencing a null ptr.  This guards against it.
2) ViewportContext was missing some BusConnect / BusDisconnect calls.
This commit is contained in:
mbalfour
2021-04-27 12:54:20 -05:00
parent 17997b3df8
commit 251929d071
2 changed files with 5 additions and 1 deletions
@@ -168,7 +168,7 @@ namespace AZ
return;
}
if (m_rayTracingSceneSrg->IsQueuedForCompile())
if (!m_rayTracingSceneSrg || m_rayTracingSceneSrg->IsQueuedForCompile())
{
//[GFX TODO][ATOM-14792] AtomSampleViewer: Reset scene and feature processors before switching to sample
return;
@@ -33,6 +33,7 @@ namespace AZ
nativeWindow,
&AzFramework::WindowRequestBus::Events::GetClientAreaSize);
AzFramework::WindowNotificationBus::Handler::BusConnect(nativeWindow);
AzFramework::ViewportRequestBus::Handler::BusConnect(id);
m_onProjectionMatrixChangedHandler = ViewportContext::MatrixChangedEvent::Handler([this](const AZ::Matrix4x4& matrix)
{
@@ -48,6 +49,9 @@ namespace AZ
ViewportContext::~ViewportContext()
{
AzFramework::WindowNotificationBus::Handler::BusDisconnect();
AzFramework::ViewportRequestBus::Handler::BusDisconnect();
if (m_currentPipeline)
{
m_currentPipeline->RemoveFromRenderTick();