diff --git a/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp index 337d111130..801420b0d2 100644 --- a/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp @@ -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; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/ViewportContext.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/ViewportContext.cpp index e1e87086e7..b5d3f815fe 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/ViewportContext.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/ViewportContext.cpp @@ -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();