From 109605a733d95e91a510fe96d8e9a202baa0e00f Mon Sep 17 00:00:00 2001 From: pruiksma Date: Thu, 29 Apr 2021 16:44:24 -0500 Subject: [PATCH] Cherry pick 06044522763512b78ae504f658a3e7cb5f99996c from 1.0 to main. [ATOM-15427] Fixing crash in DirectionalLightFeatureProcessor caused by incorrect use of a container. --- .../Source/CoreLights/DirectionalLightFeatureProcessor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 04175c461f..60bf487de3 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -731,11 +731,12 @@ namespace AZ } } } - + // Remove unnecessary camera views in shadow properties - for (uint16_t lightIndex = 0; lightIndex < aznumeric_cast(m_shadowProperties.GetDataCount()); ++lightIndex) + auto& shadowPropertiesVector = m_shadowProperties.GetDataVector(); + for (ShadowProperty& shadowProperty : shadowPropertiesVector) { - AZStd::unordered_map>& cascades = m_shadowProperties.GetData(lightIndex).m_segments; + auto& cascades = shadowProperty.m_segments; for (auto it = cascades.begin(); it != cascades.end();) { if (AZStd::find(cameraViews.begin(), cameraViews.end(), it->first) != cameraViews.end())