Преглед на файлове

Resolved merge conflicts.

Signed-off-by: Chris Galvan <[email protected]>
Chris Galvan преди 3 години
родител
ревизия
2d34bf6cd7
променени са 100 файла, в които са добавени 955 реда и са изтрити 625 реда
  1. 3 2
      CMakeLists.txt
  2. 3 2
      EngineFinder.cmake
  3. 3 2
      Gem/CMakeLists.txt
  4. 6 25
      Gem/Code/CMakeLists.txt
  5. 3 2
      Gem/Code/Lib/MaterialFunctors/StacksShaderCollectionFunctor.cpp
  6. 5 3
      Gem/Code/Lib/MaterialFunctors/StacksShaderCollectionFunctor.h
  7. 3 2
      Gem/Code/Lib/MaterialFunctors/StacksShaderInputFunctor.cpp
  8. 5 3
      Gem/Code/Lib/MaterialFunctors/StacksShaderInputFunctor.h
  9. 17 17
      Gem/Code/Source/AreaLightExampleComponent.cpp
  10. 3 2
      Gem/Code/Source/AreaLightExampleComponent.h
  11. 6 5
      Gem/Code/Source/AssetLoadTestComponent.cpp
  12. 3 2
      Gem/Code/Source/AssetLoadTestComponent.h
  13. 10 5
      Gem/Code/Source/AtomSampleViewerModule.cpp
  14. 3 2
      Gem/Code/Source/AtomSampleViewerOptions.h
  15. 3 2
      Gem/Code/Source/AtomSampleViewerRequestBus.h
  16. 4 3
      Gem/Code/Source/AtomSampleViewerSystemComponent.cpp
  17. 3 2
      Gem/Code/Source/AtomSampleViewerSystemComponent.h
  18. 23 4
      Gem/Code/Source/Automation/AssetStatusTracker.cpp
  19. 7 3
      Gem/Code/Source/Automation/AssetStatusTracker.h
  20. 3 2
      Gem/Code/Source/Automation/ImageComparisonConfig.cpp
  21. 3 2
      Gem/Code/Source/Automation/ImageComparisonConfig.h
  22. 84 8
      Gem/Code/Source/Automation/ScriptManager.cpp
  23. 14 5
      Gem/Code/Source/Automation/ScriptManager.h
  24. 3 2
      Gem/Code/Source/Automation/ScriptRepeaterBus.h
  25. 81 8
      Gem/Code/Source/Automation/ScriptReporter.cpp
  26. 10 2
      Gem/Code/Source/Automation/ScriptReporter.h
  27. 3 2
      Gem/Code/Source/Automation/ScriptRunnerBus.h
  28. 3 2
      Gem/Code/Source/Automation/ScriptableImGui.cpp
  29. 3 2
      Gem/Code/Source/Automation/ScriptableImGui.h
  30. 4 4
      Gem/Code/Source/AuxGeomExampleComponent.cpp
  31. 3 2
      Gem/Code/Source/AuxGeomExampleComponent.h
  32. 3 2
      Gem/Code/Source/AuxGeomSharedDrawFunctions.cpp
  33. 3 2
      Gem/Code/Source/AuxGeomSharedDrawFunctions.h
  34. 8 10
      Gem/Code/Source/BakedShaderVariantExampleComponent.cpp
  35. 3 2
      Gem/Code/Source/BakedShaderVariantExampleComponent.h
  36. 15 23
      Gem/Code/Source/BloomExampleComponent.cpp
  37. 5 3
      Gem/Code/Source/BloomExampleComponent.h
  38. 11 23
      Gem/Code/Source/CheckerboardExampleComponent.cpp
  39. 7 7
      Gem/Code/Source/CheckerboardExampleComponent.h
  40. 24 4
      Gem/Code/Source/CommonSampleComponentBase.cpp
  41. 9 2
      Gem/Code/Source/CommonSampleComponentBase.h
  42. 7 17
      Gem/Code/Source/CullingAndLodExampleComponent.cpp
  43. 3 3
      Gem/Code/Source/CullingAndLodExampleComponent.h
  44. 3 2
      Gem/Code/Source/DecalContainer.cpp
  45. 3 2
      Gem/Code/Source/DecalContainer.h
  46. 38 5
      Gem/Code/Source/DecalExampleComponent.cpp
  47. 10 2
      Gem/Code/Source/DecalExampleComponent.h
  48. 6 6
      Gem/Code/Source/DepthOfFieldExampleComponent.cpp
  49. 3 2
      Gem/Code/Source/DepthOfFieldExampleComponent.h
  50. 19 31
      Gem/Code/Source/DiffuseGIExampleComponent.cpp
  51. 3 2
      Gem/Code/Source/DiffuseGIExampleComponent.h
  52. 137 24
      Gem/Code/Source/DynamicDrawExampleComponent.cpp
  53. 8 2
      Gem/Code/Source/DynamicDrawExampleComponent.h
  54. 4 2
      Gem/Code/Source/DynamicMaterialTestComponent.cpp
  55. 3 2
      Gem/Code/Source/DynamicMaterialTestComponent.h
  56. 4 3
      Gem/Code/Source/EntityLatticeTestComponent.cpp
  57. 3 2
      Gem/Code/Source/EntityLatticeTestComponent.h
  58. 3 2
      Gem/Code/Source/EntityUtilityFunctions.cpp
  59. 3 2
      Gem/Code/Source/EntityUtilityFunctions.h
  60. 3 2
      Gem/Code/Source/ExampleComponentBus.h
  61. 5 5
      Gem/Code/Source/ExposureExampleComponent.cpp
  62. 3 2
      Gem/Code/Source/ExposureExampleComponent.h
  63. 20 24
      Gem/Code/Source/LightCullingExampleComponent.cpp
  64. 3 2
      Gem/Code/Source/LightCullingExampleComponent.h
  65. 74 86
      Gem/Code/Source/MSAA_RPI_ExampleComponent.cpp
  66. 24 26
      Gem/Code/Source/MSAA_RPI_ExampleComponent.h
  67. 6 13
      Gem/Code/Source/MaterialHotReloadTestComponent.cpp
  68. 3 3
      Gem/Code/Source/MaterialHotReloadTestComponent.h
  69. 21 19
      Gem/Code/Source/MeshExampleComponent.cpp
  70. 4 3
      Gem/Code/Source/MeshExampleComponent.h
  71. 5 8
      Gem/Code/Source/MultiRenderPipelineExampleComponent.cpp
  72. 3 5
      Gem/Code/Source/MultiRenderPipelineExampleComponent.h
  73. 7 34
      Gem/Code/Source/MultiSceneExampleComponent.cpp
  74. 3 4
      Gem/Code/Source/MultiSceneExampleComponent.h
  75. 5 7
      Gem/Code/Source/MultiViewSingleSceneAuxGeomExampleComponent.cpp
  76. 3 2
      Gem/Code/Source/MultiViewSingleSceneAuxGeomExampleComponent.h
  77. 5 7
      Gem/Code/Source/ParallaxMappingExampleComponent.cpp
  78. 3 2
      Gem/Code/Source/ParallaxMappingExampleComponent.h
  79. 4 8
      Gem/Code/Source/Passes/RayTracingAmbientOcclusionPass.cpp
  80. 5 4
      Gem/Code/Source/Passes/RayTracingAmbientOcclusionPass.h
  81. 3 2
      Gem/Code/Source/Platform/Android/AtomSampleViewerOptions_Android.cpp
  82. 3 2
      Gem/Code/Source/Platform/Android/BakedShaderVariantExampleComponent_Traits_Platform.h
  83. 3 2
      Gem/Code/Source/Platform/Android/EntityLatticeTestComponent_Traits_Platform.h
  84. 3 2
      Gem/Code/Source/Platform/Android/MultiThreadComponent_Traits_Platform.h
  85. 3 2
      Gem/Code/Source/Platform/Android/SSRExampleComponent_Traits_Platform.h
  86. 9 3
      Gem/Code/Source/Platform/Android/SampleComponentManager_Android.cpp
  87. 3 2
      Gem/Code/Source/Platform/Android/SceneReloadSoakTestComponent_Traits_Platform.h
  88. 3 2
      Gem/Code/Source/Platform/Android/ScriptReporter_Android.cpp
  89. 3 2
      Gem/Code/Source/Platform/Android/StreamingImageExampleComponent_Android.cpp
  90. 3 2
      Gem/Code/Source/Platform/Android/TriangleConstantBufferExampleComponent_Traits_Platform.h
  91. 3 2
      Gem/Code/Source/Platform/Android/Utils_Android.cpp
  92. 3 2
      Gem/Code/Source/Platform/Android/additional_android_runtime_library.cmake
  93. 3 2
      Gem/Code/Source/Platform/Android/atomsampleviewer_android_files.cmake
  94. 3 2
      Gem/Code/Source/Platform/Android/platform_android.cmake
  95. 3 2
      Gem/Code/Source/Platform/Linux/AtomSampleViewerOptions_Linux.cpp
  96. 3 2
      Gem/Code/Source/Platform/Linux/BakedShaderVariantExampleComponent_Traits_Platform.h
  97. 3 2
      Gem/Code/Source/Platform/Linux/EntityLatticeTestComponent_Traits_Platform.h
  98. 3 2
      Gem/Code/Source/Platform/Linux/MultiThreadComponent_Traits_Platform.h
  99. 3 2
      Gem/Code/Source/Platform/Linux/SSRExampleComponent_Traits_Platform.h
  100. 8 2
      Gem/Code/Source/Platform/Linux/SampleComponentManager_Linux.cpp

+ 3 - 2
CMakeLists.txt

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #

+ 3 - 2
EngineFinder.cmake

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #

+ 3 - 2
Gem/CMakeLists.txt

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #

+ 6 - 25
Gem/Code/CMakeLists.txt

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #
@@ -43,6 +44,7 @@ ly_add_target(
             Gem::Atom_Feature_Common.Static
             Gem::Atom_Feature_Common.Static
             Gem::Atom_Component_DebugCamera.Static
             Gem::Atom_Component_DebugCamera.Static
             Gem::AtomSampleViewer.Lib.Static
             Gem::AtomSampleViewer.Lib.Static
+            Gem::Profiler.Static
 )
 )
 
 
 ly_add_target(
 ly_add_target(
@@ -139,31 +141,10 @@ endif()
 ################################################################################
 ################################################################################
 # Gem dependencies
 # Gem dependencies
 ################################################################################
 ################################################################################
-# The GameLauncher uses "Clients" gem variants:
-ly_enable_gems(PROJECT_NAME AtomSampleViewer GEM_FILE enabled_gems.cmake
-    TARGETS AtomSampleViewer.GameLauncher
-    VARIANTS Clients)
+
+ly_enable_gems(PROJECT_NAME AtomSampleViewer GEM_FILE enabled_gems.cmake)
 
 
 # If we build a server, then apply the gems to the server
 # If we build a server, then apply the gems to the server
 if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
 if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
-    # if we're making a server, then add the "Server" gem variants to it:
-    ly_enable_gems(PROJECT_NAME AtomSampleViewer GEM_FILE enabled_gems.cmake
-        TARGETS AtomSampleViewer.ServerLauncher
-        VARIANTS Servers)
-
     set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS AtomSampleViewer)
     set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS AtomSampleViewer)
 endif()
 endif()
-
-if (PAL_TRAIT_BUILD_HOST_TOOLS)
-    # The Editor uses "Tools" gem variants:
-    ly_enable_gems(
-        PROJECT_NAME AtomSampleViewer GEM_FILE enabled_gems.cmake
-        TARGETS Editor
-        VARIANTS Tools)
-
-    # The pipeline tools use "Builders" gem variants:
-    ly_enable_gems(
-        PROJECT_NAME AtomSampleViewer GEM_FILE enabled_gems.cmake
-        TARGETS AssetBuilder AssetProcessor AssetProcessorBatch
-        VARIANTS Builders)
-endif()

+ 3 - 2
Gem/Code/Lib/MaterialFunctors/StacksShaderCollectionFunctor.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 5 - 3
Gem/Code/Lib/MaterialFunctors/StacksShaderCollectionFunctor.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -22,7 +23,8 @@ namespace AtomSampleViewer
         AZ_RTTI(StacksShaderCollectionFunctor, "{4E51A7D5-7DF1-4402-8975-F6C9DFDEDC1E}", AZ::RPI::MaterialFunctor);
         AZ_RTTI(StacksShaderCollectionFunctor, "{4E51A7D5-7DF1-4402-8975-F6C9DFDEDC1E}", AZ::RPI::MaterialFunctor);
 
 
         static void Reflect(AZ::ReflectContext* context);
         static void Reflect(AZ::ReflectContext* context);
-
+        
+        using AZ::RPI::MaterialFunctor::Process;
         void Process(RuntimeContext& context) override;
         void Process(RuntimeContext& context) override;
 
 
     private:
     private:

+ 3 - 2
Gem/Code/Lib/MaterialFunctors/StacksShaderInputFunctor.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 5 - 3
Gem/Code/Lib/MaterialFunctors/StacksShaderInputFunctor.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -23,7 +24,8 @@ namespace AtomSampleViewer
         AZ_RTTI(StacksShaderInputFunctor, "{7F607170-1BC2-4510-A252-8A665FC02052}", AZ::RPI::MaterialFunctor);
         AZ_RTTI(StacksShaderInputFunctor, "{7F607170-1BC2-4510-A252-8A665FC02052}", AZ::RPI::MaterialFunctor);
 
 
         static void Reflect(AZ::ReflectContext* context);
         static void Reflect(AZ::ReflectContext* context);
-
+        
+        using AZ::RPI::MaterialFunctor::Process;
         void Process(RuntimeContext& context) override;
         void Process(RuntimeContext& context) override;
 
 
     private:
     private:

+ 17 - 17
Gem/Code/Source/AreaLightExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -62,16 +63,15 @@ namespace AtomSampleViewer
     void AreaLightExampleComponent::Activate()
     void AreaLightExampleComponent::Activate()
     {
     {
         // Get Feature processors
         // Get Feature processors
-        AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        m_meshFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::MeshFeatureProcessorInterface>();
-        m_pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
-        m_diskLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
-        m_capsuleLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::CapsuleLightFeatureProcessorInterface>();
-        m_polygonLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PolygonLightFeatureProcessorInterface>();
-        m_quadLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::QuadLightFeatureProcessorInterface>();
-        m_skyBoxFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::SkyBoxFeatureProcessorInterface>();
+        m_meshFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::MeshFeatureProcessorInterface>();
+        m_pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+        m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
+        m_capsuleLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::CapsuleLightFeatureProcessorInterface>();
+        m_polygonLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PolygonLightFeatureProcessorInterface>();
+        m_quadLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::QuadLightFeatureProcessorInterface>();
+        m_skyBoxFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::SkyBoxFeatureProcessorInterface>();
 
 
-        m_auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(scene);
+        m_auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(m_scene);
 
 
         // Create background
         // Create background
         m_skyBoxFeatureProcessor->SetSkyboxMode(AZ::Render::SkyBoxMode::Cubemap);
         m_skyBoxFeatureProcessor->SetSkyboxMode(AZ::Render::SkyBoxMode::Cubemap);
@@ -99,7 +99,7 @@ namespace AtomSampleViewer
             azrtti_typeid<AZ::Debug::NoClipControllerComponent>());
             azrtti_typeid<AZ::Debug::NoClipControllerComponent>());
 
 
         // Sidebar
         // Sidebar
-        m_materialBrowser.SetFilter([this](const AZ::Data::AssetInfo& assetInfo)
+        m_materialBrowser.SetFilter([](const AZ::Data::AssetInfo& assetInfo)
             {
             {
                 return assetInfo.m_assetType == azrtti_typeid<AZ::RPI::MaterialAsset>() &&
                 return assetInfo.m_assetType == azrtti_typeid<AZ::RPI::MaterialAsset>() &&
                     assetInfo.m_assetId.m_subId == 0; // no materials generated from models.
                     assetInfo.m_assetId.m_subId == 0; // no materials generated from models.
@@ -368,7 +368,7 @@ namespace AtomSampleViewer
             TransformVertices(points, m_config.GetRotationQuaternion(), position);
             TransformVertices(points, m_config.GetRotationQuaternion(), position);
 
 
             AZ::Vector3 direction = m_config.GetRotationQuaternion().TransformVector(AZ::Vector3::CreateAxisZ());
             AZ::Vector3 direction = m_config.GetRotationQuaternion().TransformVector(AZ::Vector3::CreateAxisZ());
-            m_polygonLightFeatureProcessor->SetPolygonPoints(handle, points.data(), points.size(), direction);
+            m_polygonLightFeatureProcessor->SetPolygonPoints(handle, points.data(), static_cast<uint32_t>(points.size()), direction);
         }
         }
     }
     }
 
 
@@ -436,7 +436,7 @@ namespace AtomSampleViewer
         for (uint32_t i = 0; i < vertexCount; ++i)
         for (uint32_t i = 0; i < vertexCount; ++i)
         {
         {
             // Get a point on the circle and scale it by the min or max radius for every other point.
             // Get a point on the circle and scale it by the min or max radius for every other point.
-            AZ::Vector3 point = GetCirclePoint(i, vertexCount) * minMaxRadius[i % 2];
+            AZ::Vector3 point = GetCirclePoint(static_cast<float>(i), static_cast<float>(vertexCount)) * minMaxRadius[i % 2];
             points.push_back(point);
             points.push_back(point);
         }
         }
         return points;
         return points;
@@ -452,8 +452,8 @@ namespace AtomSampleViewer
         {
         {
             uint32_t nextI = (i + 1) % vertexCount;
             uint32_t nextI = (i + 1) % vertexCount;
 
 
-            AZ::Vector3 p0 = GetCirclePoint(i, vertexCount) * minMaxRadius[i % 2];
-            AZ::Vector3 p1 = GetCirclePoint(nextI, vertexCount) * minMaxRadius[nextI % 2];
+            AZ::Vector3 p0 = GetCirclePoint(static_cast<float>(i), static_cast<float>(vertexCount)) * minMaxRadius[i % 2];
+            AZ::Vector3 p1 = GetCirclePoint(static_cast<float>(nextI), static_cast<float>(vertexCount)) * minMaxRadius[nextI % 2];
 
 
             tris.push_back(p0);
             tris.push_back(p0);
             tris.push_back(p1);
             tris.push_back(p1);
@@ -833,7 +833,7 @@ namespace AtomSampleViewer
                 AZ::RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments args;
                 AZ::RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments args;
                 args.m_colorCount = 1;
                 args.m_colorCount = 1;
                 args.m_colors = &nitsColor;
                 args.m_colors = &nitsColor;
-                args.m_vertCount = tris.size();
+                args.m_vertCount = static_cast<uint32_t>(tris.size());
                 args.m_verts = tris.data();
                 args.m_verts = tris.data();
                 m_auxGeom->DrawTriangles(args);
                 m_auxGeom->DrawTriangles(args);
                 break;
                 break;

+ 3 - 2
Gem/Code/Source/AreaLightExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 6 - 5
Gem/Code/Source/AssetLoadTestComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -62,7 +63,7 @@ namespace AtomSampleViewer
         };
         };
         m_materialBrowser.SetDefaultPinnedAssets(defaultMaterialAllowlist);
         m_materialBrowser.SetDefaultPinnedAssets(defaultMaterialAllowlist);
 
 
-        m_pinnedMaterialCount = m_materialBrowser.GetPinnedAssets().size();
+        m_pinnedMaterialCount = static_cast<uint32_t>(m_materialBrowser.GetPinnedAssets().size());
 
 
         const AZStd::vector<AZStd::string> defaultModelAllowist =
         const AZStd::vector<AZStd::string> defaultModelAllowist =
         {
         {
@@ -233,7 +234,7 @@ namespace AtomSampleViewer
         }
         }
         else
         else
         {
         {
-            return AZ::RPI::AssetUtils::GetAssetIdForProductPath("shaders/staticmesh.azmaterial", AZ::RPI::AssetUtils::TraceLevel::Error);
+            return AZ::RPI::AssetUtils::GetAssetIdForProductPath(DefaultPbrMaterialPath, AZ::RPI::AssetUtils::TraceLevel::Error);
         }
         }
     }
     }
 
 
@@ -306,7 +307,7 @@ namespace AtomSampleViewer
 
 
             if (materialsChanged)
             if (materialsChanged)
             {
             {
-                m_pinnedMaterialCount = pinnedMaterials.size();
+                m_pinnedMaterialCount = static_cast<uint32_t>(pinnedMaterials.size());
                 // Keep the current m_cachedMaterials to avoid release-load the same material
                 // Keep the current m_cachedMaterials to avoid release-load the same material
                 MaterialAssetSet newCache;
                 MaterialAssetSet newCache;
                 // clean up cached material which refcount is 1
                 // clean up cached material which refcount is 1

+ 3 - 2
Gem/Code/Source/AssetLoadTestComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 10 - 5
Gem/Code/Source/AtomSampleViewerModule.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -13,7 +14,7 @@
 #include <AuxGeomExampleComponent.h>
 #include <AuxGeomExampleComponent.h>
 #include <AtomSampleViewerSystemComponent.h>
 #include <AtomSampleViewerSystemComponent.h>
 #include <BakedShaderVariantExampleComponent.h>
 #include <BakedShaderVariantExampleComponent.h>
-#include <BistroBenchmarkComponent.h>
+#include <SponzaBenchmarkComponent.h>
 #include <BloomExampleComponent.h>
 #include <BloomExampleComponent.h>
 #include <CheckerboardExampleComponent.h>
 #include <CheckerboardExampleComponent.h>
 #include <CullingAndLodExampleComponent.h>
 #include <CullingAndLodExampleComponent.h>
@@ -43,6 +44,7 @@
 #include <TransparencyExampleComponent.h>
 #include <TransparencyExampleComponent.h>
 #include <DiffuseGIExampleComponent.h>
 #include <DiffuseGIExampleComponent.h>
 #include <SSRExampleComponent.h>
 #include <SSRExampleComponent.h>
+#include <ShaderReloadTestComponent.h>
 
 
 #include <RHI/AlphaToCoverageExampleComponent.h>
 #include <RHI/AlphaToCoverageExampleComponent.h>
 #include <RHI/AsyncComputeExampleComponent.h>
 #include <RHI/AsyncComputeExampleComponent.h>
@@ -69,6 +71,7 @@
 #include <RHI/TriangleExampleComponent.h>
 #include <RHI/TriangleExampleComponent.h>
 #include <RHI/TrianglesConstantBufferExampleComponent.h>
 #include <RHI/TrianglesConstantBufferExampleComponent.h>
 #include <RHI/RayTracingExampleComponent.h>
 #include <RHI/RayTracingExampleComponent.h>
+#include <RHI/MatrixAlignmentTestExampleComponent.h>
 #include <AzFramework/Scene/SceneSystemComponent.h>
 #include <AzFramework/Scene/SceneSystemComponent.h>
 
 
 #include <Atom/Feature/SkinnedMesh/SkinnedMeshInputBuffers.h>
 #include <Atom/Feature/SkinnedMesh/SkinnedMeshInputBuffers.h>
@@ -115,7 +118,8 @@ namespace AtomSampleViewer
                 TextureMapExampleComponent::CreateDescriptor(),
                 TextureMapExampleComponent::CreateDescriptor(),
                 TriangleExampleComponent::CreateDescriptor(),
                 TriangleExampleComponent::CreateDescriptor(),
                 TrianglesConstantBufferExampleComponent::CreateDescriptor(),
                 TrianglesConstantBufferExampleComponent::CreateDescriptor(),
-                RayTracingExampleComponent::CreateDescriptor()
+                RayTracingExampleComponent::CreateDescriptor(),
+                MatrixAlignmentTestExampleComponent::CreateDescriptor()
                 });
                 });
 
 
             // RPI Samples
             // RPI Samples
@@ -123,7 +127,7 @@ namespace AtomSampleViewer
                 AreaLightExampleComponent::CreateDescriptor(),
                 AreaLightExampleComponent::CreateDescriptor(),
                 AssetLoadTestComponent::CreateDescriptor(),
                 AssetLoadTestComponent::CreateDescriptor(),
                 BakedShaderVariantExampleComponent::CreateDescriptor(),
                 BakedShaderVariantExampleComponent::CreateDescriptor(),
-                BistroBenchmarkComponent::CreateDescriptor(),
+                SponzaBenchmarkComponent::CreateDescriptor(),
                 BloomExampleComponent::CreateDescriptor(),
                 BloomExampleComponent::CreateDescriptor(),
                 CheckerboardExampleComponent::CreateDescriptor(),
                 CheckerboardExampleComponent::CreateDescriptor(),
                 CullingAndLodExampleComponent::CreateDescriptor(),
                 CullingAndLodExampleComponent::CreateDescriptor(),
@@ -153,6 +157,7 @@ namespace AtomSampleViewer
                 ParallaxMappingExampleComponent::CreateDescriptor(),
                 ParallaxMappingExampleComponent::CreateDescriptor(),
                 DiffuseGIExampleComponent::CreateDescriptor(),
                 DiffuseGIExampleComponent::CreateDescriptor(),
                 SSRExampleComponent::CreateDescriptor(),
                 SSRExampleComponent::CreateDescriptor(),
+                ShaderReloadTestComponent::CreateDescriptor(),
                 });
                 });
         }
         }
 
 

+ 3 - 2
Gem/Code/Source/AtomSampleViewerOptions.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/AtomSampleViewerRequestBus.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 4 - 3
Gem/Code/Source/AtomSampleViewerSystemComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -110,7 +111,7 @@ namespace AtomSampleViewer
             AZ::Render::Bootstrap::DefaultWindowBus::Broadcast(&AZ::Render::Bootstrap::DefaultWindowBus::Events::SetCreateDefaultScene, false);
             AZ::Render::Bootstrap::DefaultWindowBus::Broadcast(&AZ::Render::Bootstrap::DefaultWindowBus::Events::SetCreateDefaultScene, false);
         }
         }
 
 
-        AZ::Data::AssetCatalogRequestBus::Broadcast(&AZ::Data::AssetCatalogRequestBus::Events::LoadCatalog, "@assets@/assetcatalog.xml");
+        AZ::Data::AssetCatalogRequestBus::Broadcast(&AZ::Data::AssetCatalogRequestBus::Events::LoadCatalog, "@products@/assetcatalog.xml");
 
 
         m_atomSampleViewerEntity->Activate();
         m_atomSampleViewerEntity->Activate();
 
 

+ 3 - 2
Gem/Code/Source/AtomSampleViewerSystemComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 23 - 4
Gem/Code/Source/Automation/AssetStatusTracker.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -47,7 +48,7 @@ namespace AtomSampleViewer
         AZStd::to_lower(sourceAssetPath.begin(), sourceAssetPath.end());
         AZStd::to_lower(sourceAssetPath.begin(), sourceAssetPath.end());
 
 
         AZStd::lock_guard<AZStd::mutex> lock(m_mutex);
         AZStd::lock_guard<AZStd::mutex> lock(m_mutex);
-        m_allAssetStatusData[sourceAssetPath].m_expecteCount += expectedCount;
+        m_allAssetStatusData[sourceAssetPath].m_expectedCount += expectedCount;
     }
     }
 
 
     bool AssetStatusTracker::DidExpectedAssetsFinish() const
     bool AssetStatusTracker::DidExpectedAssetsFinish() const
@@ -58,7 +59,7 @@ namespace AtomSampleViewer
         {
         {
             const AssetStatusEvents& status = assetData.second;
             const AssetStatusEvents& status = assetData.second;
 
 
-            if (status.m_expecteCount > (status.m_succeeded + status.m_failed))
+            if (status.m_expectedCount > (status.m_succeeded + status.m_failed))
             {
             {
                 return false;
                 return false;
             }
             }
@@ -66,6 +67,24 @@ namespace AtomSampleViewer
 
 
         return true;
         return true;
     }
     }
+    
+    AZStd::vector<AZStd::string> AssetStatusTracker::GetIncompleteAssetList() const
+    {
+        AZStd::vector<AZStd::string> incomplete;
+        
+        for (auto& assetData : m_allAssetStatusData)
+        {
+            const AssetStatusEvents& status = assetData.second;
+
+            if (status.m_expectedCount > (status.m_succeeded + status.m_failed))
+            {
+                incomplete.push_back(assetData.first);
+            }
+        }
+
+        return incomplete;
+    }
+
 
 
     void AssetStatusTracker::AssetCompilationStarted(const AZStd::string& assetPath)
     void AssetStatusTracker::AssetCompilationStarted(const AZStd::string& assetPath)
     {
     {

+ 7 - 3
Gem/Code/Source/Automation/AssetStatusTracker.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -32,6 +33,9 @@ namespace AtomSampleViewer
         //! Returns whether all of the expected assets have finished.
         //! Returns whether all of the expected assets have finished.
         bool DidExpectedAssetsFinish() const;
         bool DidExpectedAssetsFinish() const;
 
 
+        //! Return a list of assets that have not completed expected processing.
+        AZStd::vector<AZStd::string> GetIncompleteAssetList() const;
+
         //! Stops tracking asset status updates from the Asset Processor. Clears any asset status information already collected.
         //! Stops tracking asset status updates from the Asset Processor. Clears any asset status information already collected.
         void StopTracking();
         void StopTracking();
 
 
@@ -43,7 +47,7 @@ namespace AtomSampleViewer
             uint32_t m_started = 0;
             uint32_t m_started = 0;
             uint32_t m_succeeded = 0;
             uint32_t m_succeeded = 0;
             uint32_t m_failed = 0;
             uint32_t m_failed = 0;
-            uint32_t m_expecteCount = 0;
+            uint32_t m_expectedCount = 0;
         };
         };
 
 
         // AssetSystemInfoBus overrides...
         // AssetSystemInfoBus overrides...

+ 3 - 2
Gem/Code/Source/Automation/ImageComparisonConfig.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Automation/ImageComparisonConfig.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 84 - 8
Gem/Code/Source/Automation/ScriptManager.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -30,7 +31,6 @@
 #include <AzFramework/IO/LocalFileIO.h>
 #include <AzFramework/IO/LocalFileIO.h>
 #include <AzFramework/Windowing/WindowBus.h>
 #include <AzFramework/Windowing/WindowBus.h>
 
 
-#include <AtomCore/Serialization/Json/JsonUtils.h>
 #include <AtomSampleViewerRequestBus.h>
 #include <AtomSampleViewerRequestBus.h>
 #include <Utils/Utils.h>
 #include <Utils/Utils.h>
 
 
@@ -55,7 +55,7 @@ namespace AtomSampleViewer
         ReflectScriptContext(m_sriptBehaviorContext.get());
         ReflectScriptContext(m_sriptBehaviorContext.get());
         m_scriptContext->BindTo(m_sriptBehaviorContext.get());
         m_scriptContext->BindTo(m_sriptBehaviorContext.get());
 
 
-        m_scriptBrowser.SetFilter([this](const AZ::Data::AssetInfo& assetInfo)
+        m_scriptBrowser.SetFilter([](const AZ::Data::AssetInfo& assetInfo)
         {
         {
             return AzFramework::StringFunc::EndsWith(assetInfo.m_relativePath, ".bv.luac");
             return AzFramework::StringFunc::EndsWith(assetInfo.m_relativePath, ".bv.luac");
         });
         });
@@ -331,11 +331,15 @@ namespace AtomSampleViewer
                 m_assetTrackingTimeout -= deltaTime;
                 m_assetTrackingTimeout -= deltaTime;
                 if (m_assetTrackingTimeout < 0)
                 if (m_assetTrackingTimeout < 0)
                 {
                 {
-                    AZ_Error("Automation", false, "Script asset tracking timed out. Continuing...");
+                    auto incomplateAssetList = m_assetStatusTracker.GetIncompleteAssetList();
+                    AZStd::string incompleteAssetListString;
+                    AzFramework::StringFunc::Join(incompleteAssetListString, incomplateAssetList.begin(), incomplateAssetList.end(), "\n    ");
+                    AZ_Error("Automation", false, "Script asset tracking timed out waiting for:\n    %s \n Continuing...", incompleteAssetListString.c_str());
                     m_waitForAssetTracker = false;
                     m_waitForAssetTracker = false;
                 }
                 }
                 else if (m_assetStatusTracker.DidExpectedAssetsFinish())
                 else if (m_assetStatusTracker.DidExpectedAssetsFinish())
                 {
                 {
+                    AZ_Printf("Automation", "Asset Tracker finished with %f seconds remaining.", m_assetTrackingTimeout);
                     m_waitForAssetTracker = false;
                     m_waitForAssetTracker = false;
                 }
                 }
                 else
                 else
@@ -749,8 +753,10 @@ namespace AtomSampleViewer
 
 
         // Profiling data...
         // Profiling data...
         behaviorContext->Method("CapturePassTimestamp", &Script_CapturePassTimestamp);
         behaviorContext->Method("CapturePassTimestamp", &Script_CapturePassTimestamp);
+        behaviorContext->Method("CaptureCpuFrameTime", &Script_CaptureCpuFrameTime);
         behaviorContext->Method("CapturePassPipelineStatistics", &Script_CapturePassPipelineStatistics);
         behaviorContext->Method("CapturePassPipelineStatistics", &Script_CapturePassPipelineStatistics);
         behaviorContext->Method("CaptureCpuProfilingStatistics", &Script_CaptureCpuProfilingStatistics);
         behaviorContext->Method("CaptureCpuProfilingStatistics", &Script_CaptureCpuProfilingStatistics);
+        behaviorContext->Method("CaptureBenchmarkMetadata", &Script_CaptureBenchmarkMetadata);
 
 
         // Camera...
         // Camera...
         behaviorContext->Method("ArcBallCameraController_SetCenter", &Script_ArcBallCameraController_SetCenter);
         behaviorContext->Method("ArcBallCameraController_SetCenter", &Script_ArcBallCameraController_SetCenter);
@@ -1076,7 +1082,7 @@ namespace AtomSampleViewer
         s_instance->m_isCapturePending = true;
         s_instance->m_isCapturePending = true;
         s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect();
         s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect();
         s_instance->PauseScript();
         s_instance->PauseScript();
-        
+
         return true;
         return true;
     }
     }
 
 
@@ -1275,6 +1281,13 @@ namespace AtomSampleViewer
         ResumeScript();
         ResumeScript();
     }
     }
 
 
+    void ScriptManager::OnCaptureCpuFrameTimeFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
+    {
+        m_isCapturePending = false;
+        AZ::Render::ProfilingCaptureNotificationBus::Handler::BusDisconnect();
+        ResumeScript();
+    }
+
     void ScriptManager::OnCaptureQueryPipelineStatisticsFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
     void ScriptManager::OnCaptureQueryPipelineStatisticsFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
     {
     {
         m_isCapturePending = false;
         m_isCapturePending = false;
@@ -1283,6 +1296,13 @@ namespace AtomSampleViewer
     }
     }
 
 
     void ScriptManager::OnCaptureCpuProfilingStatisticsFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
     void ScriptManager::OnCaptureCpuProfilingStatisticsFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
+    {
+        m_isCapturePending = false;
+        Profiler::ProfilerNotificationBus::Handler::BusDisconnect();
+        ResumeScript();
+    }
+
+    void ScriptManager::OnCaptureBenchmarkMetadataFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
     {
     {
         m_isCapturePending = false;
         m_isCapturePending = false;
         AZ::Render::ProfilingCaptureNotificationBus::Handler::BusDisconnect();
         AZ::Render::ProfilingCaptureNotificationBus::Handler::BusDisconnect();
@@ -1310,6 +1330,27 @@ namespace AtomSampleViewer
         s_instance->m_scriptOperations.push(AZStd::move(operation));
         s_instance->m_scriptOperations.push(AZStd::move(operation));
     }
     }
 
 
+    void ScriptManager::Script_CaptureCpuFrameTime(AZ::ScriptDataContext& dc)
+    {
+        AZStd::string outputFilePath;
+        const bool readScriptDataContext = ValidateProfilingCaptureScripContexts(dc, outputFilePath);
+        if (!readScriptDataContext)
+        {
+            return;
+        }
+
+        auto operation = [outputFilePath]()
+        {
+            s_instance->m_isCapturePending = true;
+            s_instance->AZ::Render::ProfilingCaptureNotificationBus::Handler::BusConnect();
+            s_instance->PauseScript();
+
+            AZ::Render::ProfilingCaptureRequestBus::Broadcast(&AZ::Render::ProfilingCaptureRequestBus::Events::CaptureCpuFrameTime, outputFilePath);
+        };
+
+        s_instance->m_scriptOperations.push(AZStd::move(operation));
+    }
+
     void ScriptManager::Script_CapturePassPipelineStatistics(AZ::ScriptDataContext& dc)
     void ScriptManager::Script_CapturePassPipelineStatistics(AZ::ScriptDataContext& dc)
     {
     {
         AZStd::string outputFilePath;
         AZStd::string outputFilePath;
@@ -1341,12 +1382,47 @@ namespace AtomSampleViewer
         }
         }
 
 
         auto operation = [outputFilePath]()
         auto operation = [outputFilePath]()
+        {
+            s_instance->m_isCapturePending = true;
+            s_instance->Profiler::ProfilerNotificationBus::Handler::BusConnect();
+            s_instance->PauseScript();
+
+            Profiler::ProfilerRequestBus::Broadcast(&Profiler::ProfilerRequestBus::Events::CaptureCpuProfilingStatistics, outputFilePath);
+        };
+
+        s_instance->m_scriptOperations.push(AZStd::move(operation));
+    }
+
+    void ScriptManager::Script_CaptureBenchmarkMetadata(AZ::ScriptDataContext& dc)
+    {
+        if (dc.GetNumArguments() != 2)
+        {
+            ReportScriptError("CaptureBenchmarkMetadata needs two arguments, benchmarkName and outputFilePath.");
+            return;
+        }
+
+        if (!dc.IsString(0) || !dc.IsString(1))
+        {
+            ReportScriptError("CaptureBenchmarkMetadata's arguments benchmarkName and outputFilePath must both be of type string.");
+            return;
+        }
+
+        const char* stringValue = nullptr;
+        AZStd::string benchmarkName;
+        AZStd::string outputFilePath;
+
+        dc.ReadArg(0, stringValue);
+        benchmarkName = AZStd::string(stringValue);
+        dc.ReadArg(1, stringValue);
+        outputFilePath = AZStd::string(stringValue);
+
+        auto operation = [benchmarkName, outputFilePath]()
         {
         {
             s_instance->m_isCapturePending = true;
             s_instance->m_isCapturePending = true;
             s_instance->AZ::Render::ProfilingCaptureNotificationBus::Handler::BusConnect();
             s_instance->AZ::Render::ProfilingCaptureNotificationBus::Handler::BusConnect();
             s_instance->PauseScript();
             s_instance->PauseScript();
 
 
-            AZ::Render::ProfilingCaptureRequestBus::Broadcast(&AZ::Render::ProfilingCaptureRequestBus::Events::CaptureCpuProfilingStatistics, outputFilePath);
+            AZ::Render::ProfilingCaptureRequestBus::Broadcast(&AZ::Render::ProfilingCaptureRequestBus::Events::CaptureBenchmarkMetadata, benchmarkName, outputFilePath);
         };
         };
 
 
         s_instance->m_scriptOperations.push(AZStd::move(operation));
         s_instance->m_scriptOperations.push(AZStd::move(operation));
@@ -1388,7 +1464,7 @@ namespace AtomSampleViewer
     {
     {
         AZ::RPI::RPISystemInterface* rpiSystem = AZ::RPI::RPISystemInterface::Get();
         AZ::RPI::RPISystemInterface* rpiSystem = AZ::RPI::RPISystemInterface::Get();
         return rpiSystem->GetRenderApiName().GetCStr();
         return rpiSystem->GetRenderApiName().GetCStr();
-        
+
     }
     }
 
 
     int ScriptManager::Script_GetRandomTestSeed()
     int ScriptManager::Script_GetRandomTestSeed()

+ 14 - 5
Gem/Code/Source/Automation/ScriptManager.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -16,8 +17,9 @@
 #include <Automation/ScriptReporter.h>
 #include <Automation/ScriptReporter.h>
 #include <Automation/ImageComparisonConfig.h>
 #include <Automation/ImageComparisonConfig.h>
 #include <Utils/ImGuiAssetBrowser.h>
 #include <Utils/ImGuiAssetBrowser.h>
+#include <Profiler/ProfilerBus.h>
 
 
-namespace AZ 
+namespace AZ
 {
 {
     class ScriptContext;
     class ScriptContext;
     class ScriptDataContext;
     class ScriptDataContext;
@@ -48,13 +50,14 @@ namespace AtomSampleViewer
         , public AZ::Debug::CameraControllerNotificationBus::Handler
         , public AZ::Debug::CameraControllerNotificationBus::Handler
         , public AZ::Render::FrameCaptureNotificationBus::Handler
         , public AZ::Render::FrameCaptureNotificationBus::Handler
         , public AZ::Render::ProfilingCaptureNotificationBus::Handler
         , public AZ::Render::ProfilingCaptureNotificationBus::Handler
+        , public Profiler::ProfilerNotificationBus::Handler
     {
     {
     public:
     public:
         ScriptManager();
         ScriptManager();
 
 
         void Activate();
         void Activate();
         void Deactivate();
         void Deactivate();
-        
+
         void SetCameraEntity(AZ::Entity* cameraEntity);
         void SetCameraEntity(AZ::Entity* cameraEntity);
 
 
         void TickScript(float deltaTime);
         void TickScript(float deltaTime);
@@ -63,7 +66,7 @@ namespace AtomSampleViewer
         void OpenScriptRunnerDialog();
         void OpenScriptRunnerDialog();
 
 
         void RunMainTestSuite(const AZStd::string& suiteFilePath, bool exitOnTestEnd, int randomSeed);
         void RunMainTestSuite(const AZStd::string& suiteFilePath, bool exitOnTestEnd, int randomSeed);
-        
+
     private:
     private:
 
 
         void ShowScriptRunnerDialog();
         void ShowScriptRunnerDialog();
@@ -133,8 +136,10 @@ namespace AtomSampleViewer
 
 
         // Profiling statistics data...
         // Profiling statistics data...
         static void Script_CapturePassTimestamp(AZ::ScriptDataContext& dc);
         static void Script_CapturePassTimestamp(AZ::ScriptDataContext& dc);
+        static void Script_CaptureCpuFrameTime(AZ::ScriptDataContext& dc);
         static void Script_CapturePassPipelineStatistics(AZ::ScriptDataContext& dc);
         static void Script_CapturePassPipelineStatistics(AZ::ScriptDataContext& dc);
         static void Script_CaptureCpuProfilingStatistics(AZ::ScriptDataContext& dc);
         static void Script_CaptureCpuProfilingStatistics(AZ::ScriptDataContext& dc);
+        static void Script_CaptureBenchmarkMetadata(AZ::ScriptDataContext& dc);
 
 
         // Camera...
         // Camera...
         static void Script_ArcBallCameraController_SetCenter(AZ::Vector3 center);
         static void Script_ArcBallCameraController_SetCenter(AZ::Vector3 center);
@@ -200,7 +205,11 @@ namespace AtomSampleViewer
 
 
         // ProfilingCaptureNotificationBus overrides...
         // ProfilingCaptureNotificationBus overrides...
         void OnCaptureQueryTimestampFinished(bool result, const AZStd::string& info) override;
         void OnCaptureQueryTimestampFinished(bool result, const AZStd::string& info) override;
+        void OnCaptureCpuFrameTimeFinished(bool result, const AZStd::string& info) override;
         void OnCaptureQueryPipelineStatisticsFinished(bool result, const AZStd::string& info) override;
         void OnCaptureQueryPipelineStatisticsFinished(bool result, const AZStd::string& info) override;
+        void OnCaptureBenchmarkMetadataFinished(bool result, const AZStd::string& info) override;
+
+        // ProfilerNotificationBus overrides...
         void OnCaptureCpuProfilingStatisticsFinished(bool result, const AZStd::string& info) override;
         void OnCaptureCpuProfilingStatisticsFinished(bool result, const AZStd::string& info) override;
 
 
         void AbortScripts(const AZStd::string& reason);
         void AbortScripts(const AZStd::string& reason);

+ 3 - 2
Gem/Code/Source/Automation/ScriptRepeaterBus.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 81 - 8
Gem/Code/Source/Automation/ScriptReporter.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -91,7 +92,7 @@ namespace AtomSampleViewer
             }
             }
 
 
             // Turn it back into a full path
             // Turn it back into a full path
-            path = Utils::ResolvePath("@devassets@" + path);
+            path = Utils::ResolvePath("@projectroot@/" + path);
 
 
             return path;
             return path;
         }
         }
@@ -422,6 +423,8 @@ namespace AtomSampleViewer
             highlightTextIf(totalScreenshotWarnings > 0, HighlightWarning);
             highlightTextIf(totalScreenshotWarnings > 0, HighlightWarning);
             ImGui::Text("Total Screenshot Warnings: %u %s", totalScreenshotWarnings, seeBelow(totalScreenshotWarnings).c_str());
             ImGui::Text("Total Screenshot Warnings: %u %s", totalScreenshotWarnings, seeBelow(totalScreenshotWarnings).c_str());
 
 
+            ImGui::Text("Exported test results: %s", m_exportedTestResultsPath.c_str());
+
             resetTextHighlight();
             resetTextHighlight();
 
 
             if (ImGui::Button("Update All Local Baseline Images"))
             if (ImGui::Button("Update All Local Baseline Images"))
@@ -435,6 +438,16 @@ namespace AtomSampleViewer
                         UpdateAllLocalBaselineImages();
                         UpdateAllLocalBaselineImages();
                     });
                     });
             }
             }
+            if (ImGui::Button("Export Test Results"))
+            {
+                m_messageBox.OpenPopupConfirmation(
+                    "Export Test Results",
+                    "All test results will be exported \n"
+                    "Proceed?",
+                    [this]() {
+                        ExportTestResults();
+                    });
+            }
 
 
             int displayOption = m_displayOption;
             int displayOption = m_displayOption;
             ImGui::Combo("Display", &displayOption, DiplayOptions, AZ_ARRAY_SIZE(DiplayOptions));
             ImGui::Combo("Display", &displayOption, DiplayOptions, AZ_ARRAY_SIZE(DiplayOptions));
@@ -561,18 +574,18 @@ namespace AtomSampleViewer
                         {
                         {
                             resetTextHighlight();
                             resetTextHighlight();
 
 
-                            ImGui::Text(("Screenshot:        " + screenshotResult.m_screenshotFilePath).c_str());
+                            ImGui::Text("Screenshot:        %s", screenshotResult.m_screenshotFilePath.c_str());
 
 
                             ImGui::Spacing();
                             ImGui::Spacing();
 
 
                             highlightTextIf(!screenshotPassed, HighlightFailed);
                             highlightTextIf(!screenshotPassed, HighlightFailed);
 
 
-                            ImGui::Text(("Official Baseline: " + screenshotResult.m_officialBaselineScreenshotFilePath).c_str());
+                            ImGui::Text("Official Baseline: %s", screenshotResult.m_officialBaselineScreenshotFilePath.c_str());
 
 
                             // Official Baseline Result
                             // Official Baseline Result
                             ImGui::Indent();
                             ImGui::Indent();
                             {
                             {
-                                ImGui::Text(screenshotResult.m_officialComparisonResult.GetSummaryString().c_str());
+                                ImGui::Text("%s", screenshotResult.m_officialComparisonResult.GetSummaryString().c_str());
 
 
                                 if (screenshotResult.m_officialComparisonResult.m_resultCode == ImageComparisonResult::ResultCode::ThresholdExceeded ||
                                 if (screenshotResult.m_officialComparisonResult.m_resultCode == ImageComparisonResult::ResultCode::ThresholdExceeded ||
                                     screenshotResult.m_officialComparisonResult.m_resultCode == ImageComparisonResult::ResultCode::Pass)
                                     screenshotResult.m_officialComparisonResult.m_resultCode == ImageComparisonResult::ResultCode::Pass)
@@ -632,12 +645,12 @@ namespace AtomSampleViewer
 
 
                             highlightTextIf(localBaselineWarning, HighlightWarning);
                             highlightTextIf(localBaselineWarning, HighlightWarning);
 
 
-                            ImGui::Text(("Local Baseline:    " + screenshotResult.m_localBaselineScreenshotFilePath).c_str());
+                            ImGui::Text("Local Baseline:    %s", screenshotResult.m_localBaselineScreenshotFilePath.c_str());
 
 
                             // Local Baseline Result
                             // Local Baseline Result
                             ImGui::Indent();
                             ImGui::Indent();
                             {
                             {
-                                ImGui::Text(screenshotResult.m_localComparisonResult.GetSummaryString().c_str());
+                                ImGui::Text("%s", screenshotResult.m_localComparisonResult.GetSummaryString().c_str());
 
 
                                 resetTextHighlight();
                                 resetTextHighlight();
 
 
@@ -1080,4 +1093,64 @@ namespace AtomSampleViewer
         }
         }
 
 
     }
     }
+     
+    void ScriptReporter::ExportTestResults()
+    {
+        m_exportedTestResultsPath = GenerateAndCreateExportedTestResultsPath();
+        for (const ScriptReport& scriptReport : m_scriptReports)
+        {
+            const AZStd::string assertLogLine = AZStd::string::format("Asserts: %u \n", scriptReport.m_assertCount);
+            const AZStd::string errorsLogLine = AZStd::string::format("Errors: %u \n", scriptReport.m_generalErrorCount);
+            const AZStd::string warningsLogLine = AZStd::string::format("Warnings: %u \n", scriptReport.m_generalWarningCount);
+            const AZStd::string screenshotErrorsLogLine = AZStd::string::format("Screenshot errors: %u \n", scriptReport.m_screenshotErrorCount);
+            const AZStd::string screenshotWarningsLogLine = AZStd::string::format("Screenshot warnings: %u \n", scriptReport.m_screenshotWarningCount);
+            const AZStd::string failedScreenshotsLogLine = "\nScreenshot test info below.\n";
+            
+            AZ::IO::HandleType logHandle;
+            auto io = AZ::IO::LocalFileIO::GetInstance();
+            if (io->Open(m_exportedTestResultsPath.c_str(), AZ::IO::OpenMode::ModeWrite, logHandle))
+            {
+                io->Write(logHandle, assertLogLine.c_str(), assertLogLine.size());
+                io->Write(logHandle, errorsLogLine.c_str(), errorsLogLine.size());
+                io->Write(logHandle, warningsLogLine.c_str(), warningsLogLine.size());
+                io->Write(logHandle, screenshotErrorsLogLine.c_str(), screenshotErrorsLogLine.size());
+                io->Write(logHandle, screenshotWarningsLogLine.c_str(), screenshotWarningsLogLine.size());
+                io->Write(logHandle, failedScreenshotsLogLine.c_str(), failedScreenshotsLogLine.size());
+
+                for (const ScreenshotTestInfo& screenshotTest : scriptReport.m_screenshotTests)
+                {
+                    const AZStd::string screenshotPath = AZStd::string::format("Test screenshot path: %s \n", screenshotTest.m_screenshotFilePath.c_str());
+                    const AZStd::string officialBaselineScreenshotPath = AZStd::string::format("Official baseline screenshot path: %s \n", screenshotTest.m_officialBaselineScreenshotFilePath.c_str());
+                    const AZStd::string toleranceLevelLogLine = AZStd::string::format("Tolerance level: %s \n", screenshotTest.m_toleranceLevel.ToString().c_str());
+                    const AZStd::string officialComparisonLogLine = AZStd::string::format("Image comparison result: %s \n", screenshotTest.m_officialComparisonResult.GetSummaryString().c_str());
+
+                    io->Write(logHandle, toleranceLevelLogLine.c_str(), toleranceLevelLogLine.size());
+                    io->Write(logHandle, officialComparisonLogLine.c_str(), officialComparisonLogLine.size());
+                }
+                io->Close(logHandle);
+            }
+            m_messageBox.OpenPopupMessage("Exported test results", AZStd::string::format("Results exported to %s", m_exportedTestResultsPath.c_str()));
+            AZ_Printf("Test results exported to %s \n", m_exportedTestResultsPath.c_str());
+        }
+    }
+
+    AZStd::string ScriptReporter::GenerateAndCreateExportedTestResultsPath() const
+    {
+        // Setup our variables for the exported test results path and .txt file.
+        const auto projectPath = AZ::Utils::GetProjectPath();
+        const AZStd::chrono::system_clock::time_point now = AZStd::chrono::system_clock::now();
+        const float timeFloat = AZStd::chrono::duration<float>(now.time_since_epoch()).count();
+        const AZStd::string timeString = AZStd::string::format("%.4f", timeFloat);
+        const AZStd::string exportFileName = AZStd::string::format("exportedTestResults_%s.txt", timeString.c_str());
+        AZStd::string exportTestResultsFolder;
+        AzFramework::StringFunc::Path::Join(projectPath.c_str(), "TestResults/", exportTestResultsFolder);
+
+        // Create the exported test results path & return .txt file path.
+        auto io = AZ::IO::LocalFileIO::GetInstance();
+        io->CreatePath(exportTestResultsFolder.c_str());
+        AZStd::string exportFile;
+        AzFramework::StringFunc::Path::Join(exportTestResultsFolder.c_str(), exportFileName.c_str(), exportFile);
+
+        return exportFile;
+    }
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 10 - 2
Gem/Code/Source/Automation/ScriptReporter.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -84,6 +85,9 @@ namespace AtomSampleViewer
         //! Returns true if there are any errors or asserts in the script report
         //! Returns true if there are any errors or asserts in the script report
         bool HasErrorsAssertsInReport() const;
         bool HasErrorsAssertsInReport() const;
 
 
+        // For exporting test results
+        void ExportTestResults();
+
         struct ImageComparisonResult
         struct ImageComparisonResult
         {
         {
             enum class ResultCode
             enum class ResultCode
@@ -231,6 +235,9 @@ namespace AtomSampleViewer
 
 
         void ShowDiffButton(const char* buttonLabel, const AZStd::string& imagePathA, const AZStd::string& imagePathB);
         void ShowDiffButton(const char* buttonLabel, const AZStd::string& imagePathA, const AZStd::string& imagePathB);
 
 
+        // Generates a path to the exported test results file.
+        AZStd::string GenerateAndCreateExportedTestResultsPath() const;
+
         ScriptReport* GetCurrentScriptReport();
         ScriptReport* GetCurrentScriptReport();
 
 
         ImGuiMessageBox m_messageBox;
         ImGuiMessageBox m_messageBox;
@@ -245,6 +252,7 @@ namespace AtomSampleViewer
         DisplayOption m_displayOption = DisplayOption::AllResults;
         DisplayOption m_displayOption = DisplayOption::AllResults;
         bool m_forceShowUpdateButtons = false; //< By default, the "Update" buttons are visible only for failed screenshots. This forces them to be visible.
         bool m_forceShowUpdateButtons = false; //< By default, the "Update" buttons are visible only for failed screenshots. This forces them to be visible.
         AZStd::string m_officialBaselineSourceFolder; //< Used for updating official baseline screenshots
         AZStd::string m_officialBaselineSourceFolder; //< Used for updating official baseline screenshots
+        AZStd::string m_exportedTestResultsPath = "Click the 'Export Test Results' button."; //< Path to exported test results file (if exported).
     };
     };
 
 
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 3 - 2
Gem/Code/Source/Automation/ScriptRunnerBus.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Automation/ScriptableImGui.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Automation/ScriptableImGui.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 4 - 4
Gem/Code/Source/AuxGeomExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -127,8 +128,7 @@ namespace AtomSampleViewer
 
 
     void AuxGeomExampleComponent::DrawSampleOfAllAuxGeom() const
     void AuxGeomExampleComponent::DrawSampleOfAllAuxGeom() const
     {
     {
-        auto defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        if (auto auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(defaultScene))
+        if (auto auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(m_scene))
         {
         {
             if (m_drawBackgroundBox)
             if (m_drawBackgroundBox)
             {
             {

+ 3 - 2
Gem/Code/Source/AuxGeomExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/AuxGeomSharedDrawFunctions.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/AuxGeomSharedDrawFunctions.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 8 - 10
Gem/Code/Source/BakedShaderVariantExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -63,7 +64,7 @@ namespace AtomSampleViewer
         TickBus::Handler::BusConnect();
         TickBus::Handler::BusConnect();
         m_imguiSidebar.Activate();
         m_imguiSidebar.Activate();
 
 
-        m_materialBrowser.SetFilter([this](const AZ::Data::AssetInfo& assetInfo) {
+        m_materialBrowser.SetFilter([](const AZ::Data::AssetInfo& assetInfo) {
             if (!AzFramework::StringFunc::Path::IsExtension(assetInfo.m_relativePath.c_str(), "azmaterial"))
             if (!AzFramework::StringFunc::Path::IsExtension(assetInfo.m_relativePath.c_str(), "azmaterial"))
             {
             {
                 return false;
                 return false;
@@ -91,13 +92,10 @@ namespace AtomSampleViewer
         m_meshHandle = m_meshFeatureProcessor->AcquireMesh(Render::MeshHandleDescriptor{ m_modelAsset }, m_material);
         m_meshHandle = m_meshFeatureProcessor->AcquireMesh(Render::MeshHandleDescriptor{ m_modelAsset }, m_material);
         m_meshFeatureProcessor->SetTransform(m_meshHandle, meshTransform);
         m_meshFeatureProcessor->SetTransform(m_meshHandle, meshTransform);
 
 
-        AZStd::vector<AZStd::string> passHierarchy;
-        passHierarchy.push_back(ATOMSAMPLEVIEWER_TRAIT_BAKED_SHADERVARIANT_SAMPLE_PASS_NAME);
-        AZ::RPI::PassHierarchyFilter passFilter(passHierarchy);
-        AZStd::vector<AZ::RPI::Pass*> foundPasses = AZ::RPI::PassSystemInterface::Get()->FindPasses(passFilter);
-        m_forwardPass = foundPasses[0];
+        AZ::RPI::PassFilter passFilter = AZ::RPI::PassFilter::CreateWithPassName(AZ::Name(ATOMSAMPLEVIEWER_TRAIT_BAKED_SHADERVARIANT_SAMPLE_PASS_NAME), 
+            m_meshFeatureProcessor->GetParentScene());
+        m_forwardPass = AZ::RPI::PassSystemInterface::Get()->FindFirstPass(passFilter);
         m_forwardPass->SetTimestampQueryEnabled(true);
         m_forwardPass->SetTimestampQueryEnabled(true);
-
         SetRootVariantUsage(true);
         SetRootVariantUsage(true);
     }
     }
 
 
@@ -123,7 +121,7 @@ namespace AtomSampleViewer
         m_imGuiFrameTimer.PushValue(deltaTime);
         m_imGuiFrameTimer.PushValue(deltaTime);
 
 
         AZ::RPI::TimestampResult forwardTimestampResult = m_forwardPass->GetLatestTimestampResult();
         AZ::RPI::TimestampResult forwardTimestampResult = m_forwardPass->GetLatestTimestampResult();
-        double gpuForwardFrameTimeMs = aznumeric_cast<double>(forwardTimestampResult.GetDurationInNanoseconds()) / 1000000;
+        float gpuForwardFrameTimeMs = aznumeric_cast<float>(forwardTimestampResult.GetDurationInNanoseconds()) / 1000000;
         m_imGuiForwardPassTimer.PushValue(gpuForwardFrameTimeMs);
         m_imGuiForwardPassTimer.PushValue(gpuForwardFrameTimeMs);
 
 
 
 

+ 3 - 2
Gem/Code/Source/BakedShaderVariantExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 15 - 23
Gem/Code/Source/BloomExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -50,9 +51,7 @@ namespace AtomSampleViewer
     {
     {
         m_dynamicDraw = RPI::GetDynamicDraw();
         m_dynamicDraw = RPI::GetDynamicDraw();
 
 
-        RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
-
-        m_postProcessFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessorInterface>();
+        m_postProcessFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessorInterface>();
 
 
         CreateBloomEntity();
         CreateBloomEntity();
 
 
@@ -86,14 +85,6 @@ namespace AtomSampleViewer
         // Load a default image
         // Load a default image
         QueueAssetPathForLoad("textures/tonemapping/hdr_test_pattern.exr.streamingimage");
         QueueAssetPathForLoad("textures/tonemapping/hdr_test_pattern.exr.streamingimage");
 
 
-        const char* engineRoot = nullptr;
-        AZStd::string screenshotFolder;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-        if (engineRoot)
-        {
-            AzFramework::StringFunc::Path::Join(engineRoot, "Screenshots", screenshotFolder, true, false);
-        }
-
         Data::Asset<RPI::AnyAsset> displayMapperAsset = RPI::AssetUtils::LoadAssetByProductPath<RPI::AnyAsset>("passes/DisplayMapperConfiguration.azasset", RPI::AssetUtils::TraceLevel::Error);
         Data::Asset<RPI::AnyAsset> displayMapperAsset = RPI::AssetUtils::LoadAssetByProductPath<RPI::AnyAsset>("passes/DisplayMapperConfiguration.azasset", RPI::AssetUtils::TraceLevel::Error);
         const Render::DisplayMapperConfigurationDescriptor* displayMapperConfigurationDescriptor = RPI::GetDataFromAnyAsset<Render::DisplayMapperConfigurationDescriptor>(displayMapperAsset);
         const Render::DisplayMapperConfigurationDescriptor* displayMapperConfigurationDescriptor = RPI::GetDataFromAnyAsset<Render::DisplayMapperConfigurationDescriptor>(displayMapperAsset);
         if (displayMapperConfigurationDescriptor == nullptr)
         if (displayMapperConfigurationDescriptor == nullptr)
@@ -312,16 +303,18 @@ namespace AtomSampleViewer
     void BloomExampleComponent::PrepareRenderData()
     void BloomExampleComponent::PrepareRenderData()
     {
     {
         const auto CreatePipeline = [](const char* shaderFilepath,
         const auto CreatePipeline = [](const char* shaderFilepath,
-            const char* srgFilepath,
-            Data::Asset<AZ::RPI::ShaderResourceGroupAsset>& srgAsset,
+            const char* srgName,
+            Data::Asset<AZ::RPI::ShaderAsset>& shaderAsset,
+            RHI::Ptr<AZ::RHI::ShaderResourceGroupLayout>& srgLayout,
             RHI::ConstPtr<RHI::PipelineState>& pipelineState,
             RHI::ConstPtr<RHI::PipelineState>& pipelineState,
-            RHI::DrawListTag& drawListTag)
+            RHI::DrawListTag& drawListTag,
+            RPI::Scene* scene)
         {
         {
             // Since the shader is using SV_VertexID and SV_InstanceID as VS input, we won't need to have vertex buffer.
             // Since the shader is using SV_VertexID and SV_InstanceID as VS input, we won't need to have vertex buffer.
             // Also, the index buffer is not needed with DrawLinear.
             // Also, the index buffer is not needed with DrawLinear.
             RHI::PipelineStateDescriptorForDraw pipelineStateDescriptor;
             RHI::PipelineStateDescriptorForDraw pipelineStateDescriptor;
 
 
-            Data::Asset<RPI::ShaderAsset> shaderAsset = RPI::AssetUtils::LoadAssetByProductPath<RPI::ShaderAsset>(shaderFilepath, RPI::AssetUtils::TraceLevel::Error);
+            shaderAsset = RPI::AssetUtils::LoadAssetByProductPath<RPI::ShaderAsset>(shaderFilepath, RPI::AssetUtils::TraceLevel::Error);
             Data::Instance<RPI::Shader> shader = RPI::Shader::FindOrCreate(shaderAsset);
             Data::Instance<RPI::Shader> shader = RPI::Shader::FindOrCreate(shaderAsset);
 
 
             if (!shader)
             if (!shader)
@@ -334,7 +327,6 @@ namespace AtomSampleViewer
             shaderVariant.ConfigurePipelineState(pipelineStateDescriptor);
             shaderVariant.ConfigurePipelineState(pipelineStateDescriptor);
             drawListTag = shader->GetDrawListTag();
             drawListTag = shader->GetDrawListTag();
 
 
-            RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
             scene->ConfigurePipelineState(shader->GetDrawListTag(), pipelineStateDescriptor);
             scene->ConfigurePipelineState(shader->GetDrawListTag(), pipelineStateDescriptor);
 
 
             pipelineStateDescriptor.m_inputStreamLayout.SetTopology(AZ::RHI::PrimitiveTopology::TriangleStrip);
             pipelineStateDescriptor.m_inputStreamLayout.SetTopology(AZ::RHI::PrimitiveTopology::TriangleStrip);
@@ -346,13 +338,13 @@ namespace AtomSampleViewer
                 AZ_Error("Render", false, "Failed to acquire default pipeline state for shader %s", shaderFilepath);
                 AZ_Error("Render", false, "Failed to acquire default pipeline state for shader %s", shaderFilepath);
             }
             }
 
 
-            // Load shader resource group asset
-            srgAsset = RPI::AssetUtils::LoadAssetByProductPath<RPI::ShaderResourceGroupAsset>(srgFilepath, RPI::AssetUtils::TraceLevel::Error);
+            // Load shader resource group layout
+            srgLayout = shaderAsset->FindShaderResourceGroupLayout(AZ::Name(srgName));
         };
         };
 
 
         // Create the example's main pipeline object
         // Create the example's main pipeline object
         {
         {
-            CreatePipeline("Shaders/tonemappingexample/renderimage.azshader", "Shaders/tonemappingexample/renderimage_renderimagesrg.azsrg", m_srgAsset, m_pipelineState, m_drawListTag);
+            CreatePipeline("Shaders/tonemappingexample/renderimage.azshader", "RenderImageSrg", m_shaderAsset, m_srgLayout, m_pipelineState, m_drawListTag, m_scene);
 
 
             // Set the input indices
             // Set the input indices
             m_imageInputIndex.Reset();
             m_imageInputIndex.Reset();
@@ -361,7 +353,7 @@ namespace AtomSampleViewer
             m_colorSpaceIndex.Reset();
             m_colorSpaceIndex.Reset();
         }
         }
 
 
-        m_drawImage.m_srg = RPI::ShaderResourceGroup::Create(m_srgAsset);
+        m_drawImage.m_srg = RPI::ShaderResourceGroup::Create(m_shaderAsset, m_srgLayout->GetName());
         m_drawImage.m_wasStreamed = false;
         m_drawImage.m_wasStreamed = false;
 
 
         // Set the image to occupy the full screen.
         // Set the image to occupy the full screen.
@@ -395,7 +387,7 @@ namespace AtomSampleViewer
 
 
         // Submit draw packet
         // Submit draw packet
         AZStd::unique_ptr<const RHI::DrawPacket> drawPacket(drawPacketBuilder.End());
         AZStd::unique_ptr<const RHI::DrawPacket> drawPacket(drawPacketBuilder.End());
-        m_dynamicDraw->AddDrawPacket(RPI::RPISystemInterface::Get()->GetDefaultScene().get(), AZStd::move(drawPacket));
+        m_dynamicDraw->AddDrawPacket(m_scene, AZStd::move(drawPacket));
     }
     }
 
 
     RPI::ColorSpaceId BloomExampleComponent::GetColorSpaceIdForIndex(uint8_t colorSpaceIndex) const
     RPI::ColorSpaceId BloomExampleComponent::GetColorSpaceIdForIndex(uint8_t colorSpaceIndex) const

+ 5 - 3
Gem/Code/Source/BloomExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -95,7 +96,8 @@ namespace AtomSampleViewer
         // render related data
         // render related data
         AZ::RHI::ConstPtr<AZ::RHI::PipelineState> m_pipelineState;
         AZ::RHI::ConstPtr<AZ::RHI::PipelineState> m_pipelineState;
         AZ::RHI::DrawListTag m_drawListTag;
         AZ::RHI::DrawListTag m_drawListTag;
-        AZ::Data::Asset<AZ::RPI::ShaderResourceGroupAsset> m_srgAsset;
+        AZ::Data::Asset<AZ::RPI::ShaderAsset> m_shaderAsset;
+        AZ::RHI::Ptr<AZ::RHI::ShaderResourceGroupLayout> m_srgLayout;
 
 
         // shader input indices
         // shader input indices
         AZ::RHI::ShaderInputNameIndex m_imageInputIndex = "m_texture";
         AZ::RHI::ShaderInputNameIndex m_imageInputIndex = "m_texture";

+ 11 - 23
Gem/Code/Source/CheckerboardExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -51,8 +52,7 @@ namespace AtomSampleViewer
         defaultMaterial.m_materialAsset = materialAsset;
         defaultMaterial.m_materialAsset = materialAsset;
         defaultMaterial.m_materialInstance = AZ::RPI::Material::FindOrCreate(defaultMaterial.m_materialAsset);
         defaultMaterial.m_materialInstance = AZ::RPI::Material::FindOrCreate(defaultMaterial.m_materialAsset);
 
 
-        AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        m_meshFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::MeshFeatureProcessorInterface>();
+        m_meshFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::MeshFeatureProcessorInterface>();
         m_meshHandle = m_meshFeatureProcessor->AcquireMesh(AZ::Render::MeshHandleDescriptor{ meshAsset }, materials);
         m_meshHandle = m_meshFeatureProcessor->AcquireMesh(AZ::Render::MeshHandleDescriptor{ meshAsset }, materials);
         m_meshFeatureProcessor->SetTransform(m_meshHandle, AZ::Transform::CreateIdentity());
         m_meshFeatureProcessor->SetTransform(m_meshHandle, AZ::Transform::CreateIdentity());
         
         
@@ -60,7 +60,7 @@ namespace AtomSampleViewer
             azrtti_typeid<AZ::Debug::ArcBallControllerComponent>());
             azrtti_typeid<AZ::Debug::ArcBallControllerComponent>());
 
 
         // Add an Image based light.
         // Add an Image based light.
-        m_defaultIbl.Init(scene.get());
+        m_defaultIbl.Init(m_scene);
 
 
 
 
         AZ::TickBus::Handler::BusConnect();
         AZ::TickBus::Handler::BusConnect();
@@ -71,7 +71,7 @@ namespace AtomSampleViewer
         ActivateCheckerboardPipeline();
         ActivateCheckerboardPipeline();
 
 
         // Create an ImGuiActiveContextScope to ensure the ImGui context on the new pipeline's ImGui pass is activated.
         // Create an ImGuiActiveContextScope to ensure the ImGui context on the new pipeline's ImGui pass is activated.
-        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass(AZ::RPI::PassHierarchyFilter({ "CheckerboardPipeline", "ImGuiPass" }));
+        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass({ "CheckerboardPipeline", "ImGuiPass" });
         m_imguiSidebar.Activate();
         m_imguiSidebar.Activate();
     }
     }
 
 
@@ -92,15 +92,6 @@ namespace AtomSampleViewer
         m_meshFeatureProcessor = nullptr;
         m_meshFeatureProcessor = nullptr;
     }
     }
     
     
-    bool CheckerboardExampleComponent::ReadInConfig(const AZ::ComponentConfig* baseConfig)
-    {
-        auto config = azrtti_cast<const SampleComponentConfig*>(baseConfig);
-        AZ_Assert(config && config->IsValid(), "SampleComponentConfig required for sample component configuration.");
-        m_cameraEntityId = config->m_cameraEntityId;
-        m_entityContextId = config->m_entityContextId;
-        return true;
-    }
-
     void CheckerboardExampleComponent::DefaultWindowCreated()
     void CheckerboardExampleComponent::DefaultWindowCreated()
     {
     {
         AZ::Render::Bootstrap::DefaultWindowBus::BroadcastResult(m_windowContext,
         AZ::Render::Bootstrap::DefaultWindowBus::BroadcastResult(m_windowContext,
@@ -110,9 +101,8 @@ namespace AtomSampleViewer
     void CheckerboardExampleComponent::ActivateCheckerboardPipeline()
     void CheckerboardExampleComponent::ActivateCheckerboardPipeline()
     {        
     {        
         // save original render pipeline first and remove it from the scene
         // save original render pipeline first and remove it from the scene
-        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        m_originalPipeline = defaultScene->GetDefaultRenderPipeline();
-        defaultScene->RemoveRenderPipeline(m_originalPipeline->GetId());
+        m_originalPipeline = m_scene->GetDefaultRenderPipeline();
+        m_scene->RemoveRenderPipeline(m_originalPipeline->GetId());
 
 
         // add the checker board pipeline
         // add the checker board pipeline
         AZ::RPI::RenderPipelineDescriptor pipelineDesc;
         AZ::RPI::RenderPipelineDescriptor pipelineDesc;
@@ -120,17 +110,15 @@ namespace AtomSampleViewer
         pipelineDesc.m_name = "Checkerboard";
         pipelineDesc.m_name = "Checkerboard";
         pipelineDesc.m_rootPassTemplate = "CheckerboardPipeline";
         pipelineDesc.m_rootPassTemplate = "CheckerboardPipeline";
         m_cbPipeline = AZ::RPI::RenderPipeline::CreateRenderPipelineForWindow(pipelineDesc, *m_windowContext);
         m_cbPipeline = AZ::RPI::RenderPipeline::CreateRenderPipelineForWindow(pipelineDesc, *m_windowContext);
-        defaultScene->AddRenderPipeline(m_cbPipeline);
+        m_scene->AddRenderPipeline(m_cbPipeline);
         m_cbPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
         m_cbPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
     }
     }
 
 
     void CheckerboardExampleComponent::DeactivateCheckerboardPipeline()
     void CheckerboardExampleComponent::DeactivateCheckerboardPipeline()
     {
     {
         // remove cb pipeline before adding original pipeline.
         // remove cb pipeline before adding original pipeline.
-        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        defaultScene->RemoveRenderPipeline(m_cbPipeline->GetId());
-
-        defaultScene->AddRenderPipeline(m_originalPipeline);
+        m_scene->RemoveRenderPipeline(m_cbPipeline->GetId());
+        m_scene->AddRenderPipeline(m_originalPipeline);
 
 
         m_cbPipeline = nullptr;
         m_cbPipeline = nullptr;
     }
     }

+ 7 - 7
Gem/Code/Source/CheckerboardExampleComponent.h

@@ -1,12 +1,15 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
 
 
 #pragma once
 #pragma once
 
 
+#include <CommonSampleComponentBase.h>
+
 #include <Atom/Bootstrap/DefaultWindowBus.h>
 #include <Atom/Bootstrap/DefaultWindowBus.h>
 #include <Atom/Feature/ImGui/ImGuiUtils.h>
 #include <Atom/Feature/ImGui/ImGuiUtils.h>
 #include <Atom/Feature/Mesh/MeshFeatureProcessorInterface.h>
 #include <Atom/Feature/Mesh/MeshFeatureProcessorInterface.h>
@@ -24,12 +27,12 @@ namespace AtomSampleViewer
 {
 {
     // This component renders a model with pbr material using checkerboard render pipeline.
     // This component renders a model with pbr material using checkerboard render pipeline.
     class CheckerboardExampleComponent final
     class CheckerboardExampleComponent final
-        : public AZ::Component
+        : public CommonSampleComponentBase
         , public AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler
         , public AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler
         , public AZ::TickBus::Handler
         , public AZ::TickBus::Handler
     {
     {
     public:
     public:
-        AZ_COMPONENT(CheckerboardExampleComponent, "{0E5B3D5F-5BD2-41BF-BB1E-425AF976DFC9}");
+        AZ_COMPONENT(CheckerboardExampleComponent, "{0E5B3D5F-5BD2-41BF-BB1E-425AF976DFC9}", CommonSampleComponentBase);
 
 
         static void Reflect(AZ::ReflectContext* context);
         static void Reflect(AZ::ReflectContext* context);
 
 
@@ -41,9 +44,6 @@ namespace AtomSampleViewer
 
 
     private:
     private:
 
 
-        // AZ::Component overrides...
-        bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
-
         // DefaultWindowNotificationBus::Handler overrides...
         // DefaultWindowNotificationBus::Handler overrides...
         void DefaultWindowCreated() override;
         void DefaultWindowCreated() override;
         
         

+ 24 - 4
Gem/Code/Source/CommonSampleComponentBase.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -22,6 +23,8 @@ namespace AtomSampleViewer
 
 
     bool CommonSampleComponentBase::ReadInConfig(const ComponentConfig* baseConfig)
     bool CommonSampleComponentBase::ReadInConfig(const ComponentConfig* baseConfig)
     {
     {
+        m_scene = RPI::RPISystemInterface::Get()->GetSceneByName(AZ::Name("RPI"));
+
         auto config = azrtti_cast<const SampleComponentConfig*>(baseConfig);
         auto config = azrtti_cast<const SampleComponentConfig*>(baseConfig);
         if (config && config->IsValid())
         if (config && config->IsValid())
         {
         {
@@ -88,6 +91,18 @@ namespace AtomSampleViewer
             }
             }
         }
         }
 
 
+        // set the initial lighting preset
+        static const char* InitialLightingPresetName = "Palermo Sidewalk";
+        for (uint32_t index = 0; index < m_lightingPresets.size(); ++index)
+        {
+            if (m_lightingPresets[index].m_displayName == InitialLightingPresetName)
+            {
+                m_currentLightingPresetIndex = index;
+                OnLightingPresetSelected(m_lightingPresets[m_currentLightingPresetIndex], m_useAlternateSkybox);
+                break;
+            }
+        }
+
         AZ::TransformNotificationBus::MultiHandler::BusConnect(m_cameraEntityId);
         AZ::TransformNotificationBus::MultiHandler::BusConnect(m_cameraEntityId);
         AZ::EntityBus::MultiHandler::BusConnect(m_postProcessEntity->GetId());
         AZ::EntityBus::MultiHandler::BusConnect(m_postProcessEntity->GetId());
     }
     }
@@ -183,8 +198,8 @@ namespace AtomSampleViewer
 
 
                 // Each LightingPreset can have an alternate skybox (usually a blurred version of the primary skybox), so we expose both here as separate items in the UI.
                 // Each LightingPreset can have an alternate skybox (usually a blurred version of the primary skybox), so we expose both here as separate items in the UI.
 
 
-                bool useThisPresetWithNormalSkybox = (i == m_currentLightingPresetIndex) && !m_useAlternateSkybox;
-                bool useThisPresetWithAlternateSkybox = (i == m_currentLightingPresetIndex) && m_useAlternateSkybox;
+                bool useThisPresetWithNormalSkybox = (static_cast<int32_t>(i) == m_currentLightingPresetIndex) && !m_useAlternateSkybox;
+                bool useThisPresetWithAlternateSkybox = (static_cast<int32_t>(i) == m_currentLightingPresetIndex) && m_useAlternateSkybox;
 
 
                 useThisPresetWithNormalSkybox = ScriptableImGui::Selectable(name.c_str(), useThisPresetWithNormalSkybox);
                 useThisPresetWithNormalSkybox = ScriptableImGui::Selectable(name.c_str(), useThisPresetWithNormalSkybox);
                 useThisPresetWithAlternateSkybox = ScriptableImGui::Selectable(nameForAlternateSkybox.c_str(), useThisPresetWithAlternateSkybox);
                 useThisPresetWithAlternateSkybox = ScriptableImGui::Selectable(nameForAlternateSkybox.c_str(), useThisPresetWithAlternateSkybox);
@@ -279,4 +294,9 @@ namespace AtomSampleViewer
             });
             });
     }
     }
 
 
+    void CommonSampleComponentBase::ResetScene()
+    {
+        m_meshFeatureProcessor = nullptr;
+    }
+
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 9 - 2
Gem/Code/Source/CommonSampleComponentBase.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -57,6 +58,9 @@ namespace AtomSampleViewer
         //! Clear all lighting presets.
         //! Clear all lighting presets.
         void ClearLightingPresets();
         void ClearLightingPresets();
 
 
+        //! Reset internal scene related data
+        void ResetScene();
+
         //! Apply lighting presets to the scene.
         //! Apply lighting presets to the scene.
         //! Derived samples can override this function to have custom behaviors.
         //! Derived samples can override this function to have custom behaviors.
         virtual void OnLightingPresetSelected(const AZ::Render::LightingPreset& preset, bool useAltSkybox);
         virtual void OnLightingPresetSelected(const AZ::Render::LightingPreset& preset, bool useAltSkybox);
@@ -86,6 +90,8 @@ namespace AtomSampleViewer
 
 
         AZStd::string m_sampleName;
         AZStd::string m_sampleName;
 
 
+        AZ::RPI::Scene* m_scene = nullptr;
+
     private:
     private:
         // AZ::TransformNotificationBus::MultiHandler overrides...
         // AZ::TransformNotificationBus::MultiHandler overrides...
         void OnTransformChanged(const AZ::Transform&, const AZ::Transform&) override;
         void OnTransformChanged(const AZ::Transform&, const AZ::Transform&) override;
@@ -113,6 +119,7 @@ namespace AtomSampleViewer
         constexpr static int32_t InvalidLightingPresetIndex = -1;
         constexpr static int32_t InvalidLightingPresetIndex = -1;
         int32_t m_currentLightingPresetIndex = InvalidLightingPresetIndex;
         int32_t m_currentLightingPresetIndex = InvalidLightingPresetIndex;
         bool m_useAlternateSkybox = false; //!< LightingPresets have an alternate skybox that can be used, when this is true. This is usually a blurred version of the primary skybox.
         bool m_useAlternateSkybox = false; //!< LightingPresets have an alternate skybox that can be used, when this is true. This is usually a blurred version of the primary skybox.
+
     };
     };
 
 
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 7 - 17
Gem/Code/Source/CullingAndLodExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -231,9 +232,7 @@ namespace AtomSampleViewer
                 AZ::Render::DirectionalLightFeatureProcessorInterface::DebugDrawFlags::DebugDrawNone);
                 AZ::Render::DirectionalLightFeatureProcessorInterface::DebugDrawFlags::DebugDrawNone);
             dirLightFP->SetViewFrustumCorrectionEnabled(handle, m_isCascadeCorrectionEnabled);
             dirLightFP->SetViewFrustumCorrectionEnabled(handle, m_isCascadeCorrectionEnabled);
             dirLightFP->SetShadowFilterMethod(handle, s_shadowFilterMethods[m_shadowFilterMethodIndex]);
             dirLightFP->SetShadowFilterMethod(handle, s_shadowFilterMethods[m_shadowFilterMethodIndex]);
-            dirLightFP->SetShadowBoundaryWidth(handle, m_boundaryWidth);
-            dirLightFP->SetPredictionSampleCount(handle, m_predictionSampleCount);
-            dirLightFP->SetFilteringSampleCount(handle, m_filteringSampleCount);
+            dirLightFP->SetFilteringSampleCount(handle, static_cast<uint16_t>(m_filteringSampleCount));
             dirLightFP->SetGroundHeight(handle, 0.f);
             dirLightFP->SetGroundHeight(handle, 0.f);
 
 
             m_directionalLightHandle = handle;
             m_directionalLightHandle = handle;
@@ -362,7 +361,7 @@ namespace AtomSampleViewer
                 ImGui::RadioButton("4", &m_cascadeCount, 4);
                 ImGui::RadioButton("4", &m_cascadeCount, 4);
             if (cascadesChanged)
             if (cascadesChanged)
             {
             {
-                m_directionalLightFeatureProcessor->SetCascadeCount(m_directionalLightHandle, m_cascadeCount);
+                m_directionalLightFeatureProcessor->SetCascadeCount(m_directionalLightHandle, static_cast<uint16_t>(m_cascadeCount));
             }
             }
 
 
             ImGui::Spacing();
             ImGui::Spacing();
@@ -396,21 +395,12 @@ namespace AtomSampleViewer
             {
             {
                 m_directionalLightFeatureProcessor->SetShadowFilterMethod(m_directionalLightHandle, s_shadowFilterMethods[m_shadowFilterMethodIndex]);
                 m_directionalLightFeatureProcessor->SetShadowFilterMethod(m_directionalLightHandle, s_shadowFilterMethods[m_shadowFilterMethodIndex]);
             }
             }
-            ImGui::Text("Boundary Width in meter");
-            if (ImGui::SliderFloat("Width", &m_boundaryWidth, 0.f, 0.1f, "%.3f"))
-            {
-                m_directionalLightFeatureProcessor->SetShadowBoundaryWidth(m_directionalLightHandle, m_boundaryWidth);
-            }
 
 
             ImGui::Spacing();
             ImGui::Spacing();
             ImGui::Text("Filtering (PCF specific)");
             ImGui::Text("Filtering (PCF specific)");
-            if (ImGui::SliderInt("Prediction #", &m_predictionSampleCount, 4, 16))
-            {
-                m_directionalLightFeatureProcessor->SetPredictionSampleCount(m_directionalLightHandle, m_predictionSampleCount);
-            }
             if (ImGui::SliderInt("Filtering #", &m_filteringSampleCount, 4, 64))
             if (ImGui::SliderInt("Filtering #", &m_filteringSampleCount, 4, 64))
             {
             {
-                m_directionalLightFeatureProcessor->SetFilteringSampleCount(m_directionalLightHandle, m_filteringSampleCount);
+                m_directionalLightFeatureProcessor->SetFilteringSampleCount(m_directionalLightHandle, static_cast<uint16_t>(m_filteringSampleCount));
             }
             }
         }
         }
         ImGui::Unindent();
         ImGui::Unindent();
@@ -423,7 +413,7 @@ namespace AtomSampleViewer
             int diskLightCount = m_diskLightCount;
             int diskLightCount = m_diskLightCount;
             if (ImGui::SliderInt("Number", &diskLightCount, 0, DiskLightCountMax))
             if (ImGui::SliderInt("Number", &diskLightCount, 0, DiskLightCountMax))
             {
             {
-                UpdateDiskLightCount(diskLightCount);
+                UpdateDiskLightCount(static_cast<uint16_t>(diskLightCount));
             }
             }
 
 
             if (ImGui::SliderFloat("Intensity##disk", &m_diskLightIntensity, 0.f, 100000.f, "%.1f", ImGuiSliderFlags_Logarithmic))
             if (ImGui::SliderFloat("Intensity##disk", &m_diskLightIntensity, 0.f, 100000.f, "%.1f", ImGuiSliderFlags_Logarithmic))

+ 3 - 3
Gem/Code/Source/CullingAndLodExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -125,7 +126,6 @@ namespace AtomSampleViewer
         static const AZ::Render::ShadowFilterMethod s_shadowFilterMethods[];
         static const AZ::Render::ShadowFilterMethod s_shadowFilterMethods[];
         static const char* s_shadowFilterMethodLabels[];
         static const char* s_shadowFilterMethodLabels[];
         int m_shadowFilterMethodIndex = 0; // filter method is None.
         int m_shadowFilterMethodIndex = 0; // filter method is None.
-        float m_boundaryWidth = 0.03f; // 3cm
         int m_predictionSampleCount = 4;
         int m_predictionSampleCount = 4;
         int m_filteringSampleCount = 16;
         int m_filteringSampleCount = 16;
 
 

+ 3 - 2
Gem/Code/Source/DecalContainer.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/DecalContainer.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 38 - 5
Gem/Code/Source/DecalExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -67,6 +68,8 @@ namespace AtomSampleViewer
         EnableArcBallCameraController();
         EnableArcBallCameraController();
         ConfigureCameraToLookDownAtObject();
         ConfigureCameraToLookDownAtObject();
         AddImageBasedLight();
         AddImageBasedLight();
+        AcquireDirectionalLightFeatureProcessor();
+        CreateDirectionalLight();
 
 
         ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::ResumeScript);
         ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::ResumeScript);
         AZ::TickBus::Handler::BusConnect();
         AZ::TickBus::Handler::BusConnect();
@@ -93,11 +96,29 @@ namespace AtomSampleViewer
         m_imguiSidebar.Deactivate();
         m_imguiSidebar.Deactivate();
         m_defaultIbl.Reset();
         m_defaultIbl.Reset();
         GetMeshFeatureProcessor()->ReleaseMesh(m_meshHandle);
         GetMeshFeatureProcessor()->ReleaseMesh(m_meshHandle);
+        m_directionalLightFeatureProcessor->ReleaseLight(m_directionalLightHandle);
     }
     }
 
 
     void DecalExampleComponent::AddImageBasedLight()
     void DecalExampleComponent::AddImageBasedLight()
     {
     {
-        m_defaultIbl.Init(AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get());
+        m_defaultIbl.Init(m_scene);
+    }
+
+    void DecalExampleComponent::AcquireDirectionalLightFeatureProcessor()
+    {
+        using namespace AZ;
+
+        m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DirectionalLightFeatureProcessorInterface>();
+    }
+
+    void DecalExampleComponent::CreateDirectionalLight()
+    {
+        using namespace AZ;
+
+        const auto directionalLightHandle = m_directionalLightFeatureProcessor->AcquireLight();
+        const Render::PhotometricColor<Render::PhotometricUnit::Lux> lightColor(AZ::Color::CreateOne());
+        m_directionalLightFeatureProcessor->SetRgbIntensity(directionalLightHandle, lightColor);
+        m_directionalLightHandle = directionalLightHandle;
     }
     }
 
 
     void DecalExampleComponent::EnableArcBallCameraController()
     void DecalExampleComponent::EnableArcBallCameraController()
@@ -120,6 +141,7 @@ namespace AtomSampleViewer
     void DecalExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
     void DecalExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
     {
     {
         DrawSidebar();
         DrawSidebar();
+        UpdateDirectionalLight();
     }
     }
 
 
     void DecalExampleComponent::DrawSidebar()
     void DecalExampleComponent::DrawSidebar()
@@ -146,15 +168,26 @@ namespace AtomSampleViewer
             }
             }
         }
         }
 
 
+        ScriptableImGui::SliderAngle("Direction##Directional", &m_directionalLightRotationAngle, 0, 360);
+
         m_imguiSidebar.End();
         m_imguiSidebar.End();
     }
     }
 
 
     void DecalExampleComponent::CreateDecalContainer()
     void DecalExampleComponent::CreateDecalContainer()
     {
     {
-        const AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
-        const auto decalFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DecalFeatureProcessorInterface>();
+        const auto decalFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DecalFeatureProcessorInterface>();
         m_decalContainer = AZStd::make_unique<DecalContainer>(decalFeatureProcessor, AZ::Vector3(1,0,0));
         m_decalContainer = AZStd::make_unique<DecalContainer>(decalFeatureProcessor, AZ::Vector3(1,0,0));
         m_decalContainerClone = AZStd::make_unique<DecalContainer>(decalFeatureProcessor, AZ::Vector3(-1,0,0));
         m_decalContainerClone = AZStd::make_unique<DecalContainer>(decalFeatureProcessor, AZ::Vector3(-1,0,0));
     }
     }
 
 
+    void DecalExampleComponent::UpdateDirectionalLight()
+    {
+        using namespace AZ;
+
+        constexpr float directionalLightDist = 10.0f;
+
+        const auto lightLocation = Vector3(directionalLightDist * sinf(m_directionalLightRotationAngle), directionalLightDist * cosf(m_directionalLightRotationAngle), 10.0f);
+        const auto lightTransform = Transform::CreateLookAt(lightLocation, Vector3::CreateZero());
+        m_directionalLightFeatureProcessor->SetDirection(m_directionalLightHandle, lightTransform.GetBasis(1));
+    }
 }
 }

+ 10 - 2
Gem/Code/Source/DecalExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -13,6 +14,7 @@
 #include <AzCore/Component/TickBus.h>
 #include <AzCore/Component/TickBus.h>
 
 
 #include <AzFramework/Input/Events/InputChannelEventListener.h>
 #include <AzFramework/Input/Events/InputChannelEventListener.h>
+#include <Atom/Feature/CoreLights/DirectionalLightFeatureProcessorInterface.h>
 #include <Atom/Feature/Decals/DecalFeatureProcessorInterface.h>
 #include <Atom/Feature/Decals/DecalFeatureProcessorInterface.h>
 #include <Utils/Utils.h>
 #include <Utils/Utils.h>
 #include <Utils/ImGuiSidebar.h>
 #include <Utils/ImGuiSidebar.h>
@@ -49,6 +51,9 @@ namespace AtomSampleViewer
         void EnableArcBallCameraController();
         void EnableArcBallCameraController();
         void ConfigureCameraToLookDownAtObject();
         void ConfigureCameraToLookDownAtObject();
         void AddImageBasedLight();
         void AddImageBasedLight();
+        void AcquireDirectionalLightFeatureProcessor();
+        void CreateDirectionalLight();
+        void UpdateDirectionalLight();
         void DrawSidebar();
         void DrawSidebar();
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         Utils::DefaultIBL m_defaultIbl;
         Utils::DefaultIBL m_defaultIbl;
@@ -57,6 +62,9 @@ namespace AtomSampleViewer
         AZStd::unique_ptr<DecalContainer> m_decalContainerClone;
         AZStd::unique_ptr<DecalContainer> m_decalContainerClone;
         ImGuiSidebar m_imguiSidebar;
         ImGuiSidebar m_imguiSidebar;
         bool m_cloneDecalsEnabled = false;
         bool m_cloneDecalsEnabled = false;
+        float m_directionalLightRotationAngle = 0.f; // in radians
+        AZ::Render::DirectionalLightFeatureProcessorInterface* m_directionalLightFeatureProcessor = nullptr;
+        AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle m_directionalLightHandle;
 
 
         // CommonSampleComponentBase overrides...
         // CommonSampleComponentBase overrides...
         void OnAllAssetsReadyActivate() override;
         void OnAllAssetsReadyActivate() override;

+ 6 - 6
Gem/Code/Source/DepthOfFieldExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -39,13 +40,12 @@ namespace AtomSampleViewer
     {
     {
         using namespace AZ;
         using namespace AZ;
 
 
-        RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
-        m_postProcessFeatureProcessor = scene->GetFeatureProcessor<Render::PostProcessFeatureProcessorInterface>();
-        m_directionalLightFeatureProcessor = scene->GetFeatureProcessor<Render::DirectionalLightFeatureProcessorInterface>();
+        m_postProcessFeatureProcessor = m_scene->GetFeatureProcessor<Render::PostProcessFeatureProcessorInterface>();
+        m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DirectionalLightFeatureProcessorInterface>();
 
 
         // Create the assets
         // Create the assets
         m_bunnyModelAsset = RPI::AssetUtils::GetAssetByProductPath<RPI::ModelAsset>("objects/bunny.azmodel", RPI::AssetUtils::TraceLevel::Assert);
         m_bunnyModelAsset = RPI::AssetUtils::GetAssetByProductPath<RPI::ModelAsset>("objects/bunny.azmodel", RPI::AssetUtils::TraceLevel::Assert);
-        m_materialAsset = RPI::AssetUtils::GetAssetByProductPath<RPI::MaterialAsset>("shaders/staticmesh.azmaterial", RPI::AssetUtils::TraceLevel::Assert);
+        m_materialAsset = RPI::AssetUtils::GetAssetByProductPath<RPI::MaterialAsset>(DefaultPbrMaterialPath, RPI::AssetUtils::TraceLevel::Assert);
 
 
         CreateMeshes();
         CreateMeshes();
         CreateLight();
         CreateLight();

+ 3 - 2
Gem/Code/Source/DepthOfFieldExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 19 - 31
Gem/Code/Source/DiffuseGIExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -85,10 +86,8 @@ namespace AtomSampleViewer
 
 
     void DiffuseGIExampleComponent::UnloadSampleScene(bool geometryOnly)
     void DiffuseGIExampleComponent::UnloadSampleScene(bool geometryOnly)
     {
     {
-        AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-
         // release meshes
         // release meshes
-        AZ::Render::MeshFeatureProcessorInterface* meshFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::MeshFeatureProcessorInterface>();
+        AZ::Render::MeshFeatureProcessorInterface* meshFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::MeshFeatureProcessorInterface>();
         for (auto& meshHandle : m_meshHandles)
         for (auto& meshHandle : m_meshHandles)
         {
         {
             meshFeatureProcessor->ReleaseMesh(meshHandle);
             meshFeatureProcessor->ReleaseMesh(meshHandle);
@@ -99,19 +98,19 @@ namespace AtomSampleViewer
         {
         {
             if (m_diffuseProbeGrid)
             if (m_diffuseProbeGrid)
             {
             {
-                AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
+                AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
                 diffuseProbeGridFeatureProcessor->RemoveProbeGrid(m_diffuseProbeGrid);
                 diffuseProbeGridFeatureProcessor->RemoveProbeGrid(m_diffuseProbeGrid);
             }
             }
 
 
             if (m_directionalLightHandle.IsValid())
             if (m_directionalLightHandle.IsValid())
             {
             {
-                AZ::Render::DirectionalLightFeatureProcessorInterface* directionalLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
+                AZ::Render::DirectionalLightFeatureProcessorInterface* directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
                 directionalLightFeatureProcessor->ReleaseLight(m_directionalLightHandle);
                 directionalLightFeatureProcessor->ReleaseLight(m_directionalLightHandle);
             }
             }
 
 
             if (m_pointLightHandle.IsValid())
             if (m_pointLightHandle.IsValid())
             {
             {
-                AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+                AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
                 pointLightFeatureProcessor->ReleaseLight(m_pointLightHandle);
                 pointLightFeatureProcessor->ReleaseLight(m_pointLightHandle);
             }
             }
         }
         }
@@ -339,8 +338,7 @@ namespace AtomSampleViewer
 
 
         // point light
         // point light
         {
         {
-            AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-            AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+            AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
             m_pointLightHandle = pointLightFeatureProcessor->AcquireLight();
             m_pointLightHandle = pointLightFeatureProcessor->AcquireLight();
             pointLightFeatureProcessor->SetPosition(m_pointLightHandle, m_pointLightPos);
             pointLightFeatureProcessor->SetPosition(m_pointLightHandle, m_pointLightPos);
             pointLightFeatureProcessor->SetRgbIntensity(m_pointLightHandle, AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela>(m_pointLightIntensity * m_pointLightColor));
             pointLightFeatureProcessor->SetRgbIntensity(m_pointLightHandle, AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela>(m_pointLightIntensity * m_pointLightColor));
@@ -350,8 +348,7 @@ namespace AtomSampleViewer
 
 
         // diffuse probe grid
         // diffuse probe grid
         {
         {
-            AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-            AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
+            AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
             AZ::Transform transform = AZ::Transform::CreateIdentity();
             AZ::Transform transform = AZ::Transform::CreateIdentity();
 
 
             m_origin.Set(0.3f, -0.25f, 0.5f);
             m_origin.Set(0.3f, -0.25f, 0.5f);
@@ -365,7 +362,7 @@ namespace AtomSampleViewer
             m_normalBias = 0.1f;
             m_normalBias = 0.1f;
             diffuseProbeGridFeatureProcessor->SetNormalBias(m_diffuseProbeGrid, m_normalBias);
             diffuseProbeGridFeatureProcessor->SetNormalBias(m_diffuseProbeGrid, m_normalBias);
 
 
-            AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface* diffuseGlobalIlluminationFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface>();
+            AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface* diffuseGlobalIlluminationFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface>();
             diffuseGlobalIlluminationFeatureProcessor->SetQualityLevel(AZ::Render::DiffuseGlobalIlluminationQualityLevel::Medium);
             diffuseGlobalIlluminationFeatureProcessor->SetQualityLevel(AZ::Render::DiffuseGlobalIlluminationQualityLevel::Medium);
         }
         }
 
 
@@ -398,8 +395,7 @@ namespace AtomSampleViewer
 
 
         // directional light
         // directional light
         {
         {
-            AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-            AZ::Render::DirectionalLightFeatureProcessorInterface* directionalLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
+            AZ::Render::DirectionalLightFeatureProcessorInterface* directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
             m_directionalLightHandle = directionalLightFeatureProcessor->AcquireLight();
             m_directionalLightHandle = directionalLightFeatureProcessor->AcquireLight();
             const auto lightTransform = AZ::Transform::CreateRotationZ(m_directionalLightYaw) * AZ::Transform::CreateRotationX(m_directionalLightPitch);
             const auto lightTransform = AZ::Transform::CreateRotationZ(m_directionalLightYaw) * AZ::Transform::CreateRotationX(m_directionalLightPitch);
             directionalLightFeatureProcessor->SetDirection(m_directionalLightHandle, lightTransform.GetBasis(1));
             directionalLightFeatureProcessor->SetDirection(m_directionalLightHandle, lightTransform.GetBasis(1));
@@ -408,16 +404,13 @@ namespace AtomSampleViewer
             directionalLightFeatureProcessor->SetShadowmapSize(m_directionalLightHandle, AZ::Render::ShadowmapSize::Size2048);
             directionalLightFeatureProcessor->SetShadowmapSize(m_directionalLightHandle, AZ::Render::ShadowmapSize::Size2048);
             directionalLightFeatureProcessor->SetViewFrustumCorrectionEnabled(m_directionalLightHandle, false);
             directionalLightFeatureProcessor->SetViewFrustumCorrectionEnabled(m_directionalLightHandle, false);
             directionalLightFeatureProcessor->SetShadowFilterMethod(m_directionalLightHandle, AZ::Render::ShadowFilterMethod::EsmPcf);
             directionalLightFeatureProcessor->SetShadowFilterMethod(m_directionalLightHandle, AZ::Render::ShadowFilterMethod::EsmPcf);
-            directionalLightFeatureProcessor->SetShadowBoundaryWidth(m_directionalLightHandle, 0.03f);
-            directionalLightFeatureProcessor->SetPredictionSampleCount(m_directionalLightHandle, 4);
             directionalLightFeatureProcessor->SetFilteringSampleCount(m_directionalLightHandle, 16);
             directionalLightFeatureProcessor->SetFilteringSampleCount(m_directionalLightHandle, 16);
             directionalLightFeatureProcessor->SetGroundHeight(m_directionalLightHandle, 0.0f);
             directionalLightFeatureProcessor->SetGroundHeight(m_directionalLightHandle, 0.0f);
         }
         }
 
 
         // point light
         // point light
         {
         {
-            AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-            AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+            AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
             m_pointLightHandle = pointLightFeatureProcessor->AcquireLight();
             m_pointLightHandle = pointLightFeatureProcessor->AcquireLight();
             pointLightFeatureProcessor->SetPosition(m_pointLightHandle, m_pointLightPos);
             pointLightFeatureProcessor->SetPosition(m_pointLightHandle, m_pointLightPos);
             pointLightFeatureProcessor->SetRgbIntensity(m_pointLightHandle, AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela>(m_pointLightIntensity * m_pointLightColor));
             pointLightFeatureProcessor->SetRgbIntensity(m_pointLightHandle, AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela>(m_pointLightIntensity * m_pointLightColor));
@@ -427,8 +420,7 @@ namespace AtomSampleViewer
 
 
         // diffuse probe grid
         // diffuse probe grid
         {
         {
-            AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-            AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
+            AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
             transform = AZ::Transform::CreateIdentity();
             transform = AZ::Transform::CreateIdentity();
         
         
             m_origin.Set(1.4f, -1.25f, 5.0f);
             m_origin.Set(1.4f, -1.25f, 5.0f);
@@ -442,7 +434,7 @@ namespace AtomSampleViewer
             m_normalBias = 0.4f;
             m_normalBias = 0.4f;
             diffuseProbeGridFeatureProcessor->SetNormalBias(m_diffuseProbeGrid, m_normalBias);
             diffuseProbeGridFeatureProcessor->SetNormalBias(m_diffuseProbeGrid, m_normalBias);
 
 
-            AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface* diffuseGlobalIlluminationFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface>();
+            AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface* diffuseGlobalIlluminationFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiffuseGlobalIlluminationFeatureProcessorInterface>();
             diffuseGlobalIlluminationFeatureProcessor->SetQualityLevel(AZ::Render::DiffuseGlobalIlluminationQualityLevel::Medium);
             diffuseGlobalIlluminationFeatureProcessor->SetQualityLevel(AZ::Render::DiffuseGlobalIlluminationQualityLevel::Medium);
         }
         }
 
 
@@ -466,10 +458,9 @@ namespace AtomSampleViewer
         }
         }
 
 
         // ImGui sidebar
         // ImGui sidebar
-        AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
-        AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
-        AZ::Render::DirectionalLightFeatureProcessorInterface* directionalLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
+        AZ::Render::DiffuseProbeGridFeatureProcessorInterface* diffuseProbeGridFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiffuseProbeGridFeatureProcessorInterface>();
+        AZ::Render::PointLightFeatureProcessorInterface* pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+        AZ::Render::DirectionalLightFeatureProcessorInterface* directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
 
 
         bool sceneChanged = false;
         bool sceneChanged = false;
 
 
@@ -682,8 +673,6 @@ namespace AtomSampleViewer
 
 
     void DiffuseGIExampleComponent::DisableGlobalIbl()
     void DiffuseGIExampleComponent::DisableGlobalIbl()
     {
     {
-        AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-
         // disable Ibl by setting the empty cubemap
         // disable Ibl by setting the empty cubemap
         const constexpr char* DiffuseAssetPath = "textures/default/default_iblglobalcm_ibldiffuse.dds.streamingimage";
         const constexpr char* DiffuseAssetPath = "textures/default/default_iblglobalcm_ibldiffuse.dds.streamingimage";
         const constexpr char* SpecularAssetPath = "textures/default/default_iblglobalcm_iblspecular.dds.streamingimage";
         const constexpr char* SpecularAssetPath = "textures/default/default_iblglobalcm_iblspecular.dds.streamingimage";
@@ -696,7 +685,7 @@ namespace AtomSampleViewer
             AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::StreamingImageAsset>
             AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::StreamingImageAsset>
             (SpecularAssetPath, assertTraceLevel);
             (SpecularAssetPath, assertTraceLevel);
 
 
-        auto featureProcessor = scene->GetFeatureProcessor<AZ::Render::ImageBasedLightFeatureProcessorInterface>();
+        auto featureProcessor = m_scene->GetFeatureProcessor<AZ::Render::ImageBasedLightFeatureProcessorInterface>();
         AZ_Assert(featureProcessor, "Unable to find ImageBasedLightFeatureProcessorInterface on scene.");
         AZ_Assert(featureProcessor, "Unable to find ImageBasedLightFeatureProcessorInterface on scene.");
 
 
         featureProcessor->SetDiffuseImage(diffuseImageAsset);
         featureProcessor->SetDiffuseImage(diffuseImageAsset);
@@ -705,8 +694,7 @@ namespace AtomSampleViewer
 
 
     void DiffuseGIExampleComponent::EnableDiffuseIbl()
     void DiffuseGIExampleComponent::EnableDiffuseIbl()
     {
     {
-        AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        AZ::Render::ImageBasedLightFeatureProcessorInterface* imageBaseLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::ImageBasedLightFeatureProcessorInterface>();
+        AZ::Render::ImageBasedLightFeatureProcessorInterface* imageBaseLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::ImageBasedLightFeatureProcessorInterface>();
         AZ_Assert(imageBaseLightFeatureProcessor, "Unable to find ImageBasedLightFeatureProcessorInterface on scene.");
         AZ_Assert(imageBaseLightFeatureProcessor, "Unable to find ImageBasedLightFeatureProcessorInterface on scene.");
 
 
         imageBaseLightFeatureProcessor->SetDiffuseImage(m_diffuseImageAsset);
         imageBaseLightFeatureProcessor->SetDiffuseImage(m_diffuseImageAsset);

+ 3 - 2
Gem/Code/Source/DiffuseGIExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 137 - 24
Gem/Code/Source/DynamicDrawExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -15,6 +16,8 @@
 #include <Atom/Component/DebugCamera/NoClipControllerComponent.h>
 #include <Atom/Component/DebugCamera/NoClipControllerComponent.h>
 
 
 #include <Atom/RPI.Public/DynamicDraw/DynamicDrawInterface.h>
 #include <Atom/RPI.Public/DynamicDraw/DynamicDrawInterface.h>
+#include <Atom/RPI.Public/Pass/PassFilter.h>
+#include <Atom/RPI.Public/Pass/RasterPass.h>
 #include <Atom/RPI.Public/RPIUtils.h>
 #include <Atom/RPI.Public/RPIUtils.h>
 
 
 namespace AtomSampleViewer
 namespace AtomSampleViewer
@@ -63,18 +66,21 @@ namespace AtomSampleViewer
         AZ::Debug::NoClipControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::NoClipControllerRequestBus::Events::SetHeading, DegToRad(-4.0f));
         AZ::Debug::NoClipControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::NoClipControllerRequestBus::Events::SetHeading, DegToRad(-4.0f));
         AZ::Debug::NoClipControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::NoClipControllerRequestBus::Events::SetPitch, DegToRad(1.9f));
         AZ::Debug::NoClipControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::NoClipControllerRequestBus::Events::SetPitch, DegToRad(1.9f));
 
 
-        // Create and initialize dynamic draw context
-        m_dynamicDraw = RPI::DynamicDrawInterface::Get()->CreateDynamicDrawContext(RPI::RPISystemInterface::Get()->GetDefaultScene().get());
+        AZStd::vector<RPI::DynamicDrawContext::VertexChannel> vertexChannels = 
+            {
+                { "POSITION", RHI::Format::R32G32B32_FLOAT },
+                { "COLOR", RHI::Format::R32G32B32A32_FLOAT }
+            };
         
         
+        // Create and initialize dynamic draw context
+        m_dynamicDraw = RPI::DynamicDrawInterface::Get()->CreateDynamicDrawContext();
         const char* shaderFilepath = "Shaders/dynamicdraw/dynamicdrawexample.azshader";
         const char* shaderFilepath = "Shaders/dynamicdraw/dynamicdrawexample.azshader";
         Data::Asset<RPI::ShaderAsset> shaderAsset = m_assetLoadManager.GetAsset<RPI::ShaderAsset>(shaderFilepath);
         Data::Asset<RPI::ShaderAsset> shaderAsset = m_assetLoadManager.GetAsset<RPI::ShaderAsset>(shaderFilepath);
         m_dynamicDraw->InitShader(shaderAsset);
         m_dynamicDraw->InitShader(shaderAsset);
-        m_dynamicDraw->InitVertexFormat(
-            {{ "POSITION", RHI::Format::R32G32B32_FLOAT },
-            { "COLOR", RHI::Format::R32G32B32A32_FLOAT }}
-            );
+        m_dynamicDraw->InitVertexFormat(vertexChannels);
         m_dynamicDraw->AddDrawStateOptions(RPI::DynamicDrawContext::DrawStateOptions::BlendMode | RPI::DynamicDrawContext::DrawStateOptions::PrimitiveType
         m_dynamicDraw->AddDrawStateOptions(RPI::DynamicDrawContext::DrawStateOptions::BlendMode | RPI::DynamicDrawContext::DrawStateOptions::PrimitiveType
             | RPI::DynamicDrawContext::DrawStateOptions::DepthState | RPI::DynamicDrawContext::DrawStateOptions::FaceCullMode);
             | RPI::DynamicDrawContext::DrawStateOptions::DepthState | RPI::DynamicDrawContext::DrawStateOptions::FaceCullMode);
+        m_dynamicDraw->SetOutputScope(m_scene);
         m_dynamicDraw->EndInit();
         m_dynamicDraw->EndInit();
 
 
         Data::Instance<RPI::ShaderResourceGroup> contextSrg = m_dynamicDraw->GetPerContextSrg();
         Data::Instance<RPI::ShaderResourceGroup> contextSrg = m_dynamicDraw->GetPerContextSrg();
@@ -87,6 +93,30 @@ namespace AtomSampleViewer
 
 
         AZ_Assert(m_dynamicDraw->IsVertexSizeValid(sizeof(ExampleVertex)), "Invalid vertex format");
         AZ_Assert(m_dynamicDraw->IsVertexSizeValid(sizeof(ExampleVertex)), "Invalid vertex format");
 
 
+        // Dynamic draw for pass        
+        m_dynamicDraw1ForPass = RPI::DynamicDrawInterface::Get()->CreateDynamicDrawContext();
+        m_dynamicDraw2ForPass = RPI::DynamicDrawInterface::Get()->CreateDynamicDrawContext();
+
+        // Get auxGeom pass from the current render pipeline
+        AZ::RPI::PassFilter passFilter = AZ::RPI::PassFilter::CreateWithPassName(
+            Name("AuxGeomPass"),
+            m_scene);
+        RPI::RasterPass* auxGeomPass = azrtti_cast<RPI::RasterPass*>(AZ::RPI::PassSystemInterface::Get()->FindFirstPass(passFilter));
+        AZ_Assert(auxGeomPass, "AuxGeomPass should be a RasterPass or a derived RasterPass");
+        
+        m_dynamicDraw1ForPass->InitShader(shaderAsset);
+        m_dynamicDraw1ForPass->InitVertexFormat(vertexChannels);
+        m_dynamicDraw1ForPass->AddDrawStateOptions(RPI::DynamicDrawContext::DrawStateOptions::BlendMode
+            | RPI::DynamicDrawContext::DrawStateOptions::DepthState);
+        m_dynamicDraw1ForPass->SetOutputScope(auxGeomPass);
+        m_dynamicDraw1ForPass->EndInit();
+
+        m_dynamicDraw2ForPass->InitShader(shaderAsset);        
+        m_dynamicDraw2ForPass->InitVertexFormat(vertexChannels);
+        m_dynamicDraw2ForPass->AddDrawStateOptions(RPI::DynamicDrawContext::DrawStateOptions::BlendMode
+            | RPI::DynamicDrawContext::DrawStateOptions::DepthState);
+        m_dynamicDraw2ForPass->SetOutputScope(auxGeomPass);
+        m_dynamicDraw2ForPass->EndInit();
 
 
         ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::ResumeScript);
         ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::ResumeScript);
     }
     }
@@ -103,6 +133,8 @@ namespace AtomSampleViewer
 
 
         m_dynamicDraw = nullptr;
         m_dynamicDraw = nullptr;
         m_contextSrg = nullptr;
         m_contextSrg = nullptr;
+        m_dynamicDraw1ForPass = nullptr;
+        m_dynamicDraw2ForPass = nullptr;
     }
     }
 
 
     void DynamicDrawExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
     void DynamicDrawExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
@@ -118,6 +150,7 @@ namespace AtomSampleViewer
             ScriptableImGui::Checkbox("Alpha Blend", &m_showAlphaBlend);
             ScriptableImGui::Checkbox("Alpha Blend", &m_showAlphaBlend);
             ScriptableImGui::Checkbox("Alpha Additive", &m_showAlphaAdditive);
             ScriptableImGui::Checkbox("Alpha Additive", &m_showAlphaAdditive);
             ScriptableImGui::Checkbox("Per Draw Viewport", &m_showPerDrawViewport);
             ScriptableImGui::Checkbox("Per Draw Viewport", &m_showPerDrawViewport);
+            ScriptableImGui::Checkbox("Sorting", &m_showSorting);
 
 
             m_imguiSidebar.End();
             m_imguiSidebar.End();
         }
         }
@@ -130,8 +163,7 @@ namespace AtomSampleViewer
 
 
         // Tetrahedron
         // Tetrahedron
         const uint32_t TetrahedronVertexCount = 12;
         const uint32_t TetrahedronVertexCount = 12;
-        const uint32_t TetrahedronIndexCount = 12;
-        const uint32_t TetrahedronWireframeIndexCount = 6;
+        const uint32_t TetrahedronWireframeIndexCount = 12;
 
 
         float positions[4][3] =
         float positions[4][3] =
         {
         {
@@ -160,12 +192,6 @@ namespace AtomSampleViewer
             ExampleVertex{positions[3], colors[3]}, // 3
             ExampleVertex{positions[3], colors[3]}, // 3
             ExampleVertex{positions[2], colors[3]} // 2
             ExampleVertex{positions[2], colors[3]} // 2
         };
         };
-        u16 tetrahedronIndices[TetrahedronIndexCount] = {
-            0, 1, 2,
-            3, 4, 5,
-            6, 7, 8,
-            9, 10, 11
-        };
 
 
         ExampleVertex tetrahedronWireFrameVerts[4] = {
         ExampleVertex tetrahedronWireFrameVerts[4] = {
             ExampleVertex{ positions[0], colors[0] },
             ExampleVertex{ positions[0], colors[0] },
@@ -174,7 +200,7 @@ namespace AtomSampleViewer
             ExampleVertex{ positions[3], colors[3] }
             ExampleVertex{ positions[3], colors[3] }
         };
         };
 
 
-        u16 tetrahedronWireframeIndices[TetrahedronIndexCount] =
+        u16 tetrahedronWireframeIndices[TetrahedronWireframeIndexCount] =
         {
         {
             0, 1,
             0, 1,
             0, 2,
             0, 2,
@@ -205,7 +231,7 @@ namespace AtomSampleViewer
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
-            m_dynamicDraw->DrawIndexed(tetrahedronVerts, TetrahedronVertexCount, tetrahedronIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawLinear(tetrahedronVerts, TetrahedronVertexCount, drawSrg);
         }
         }
 
 
         //front cull
         //front cull
@@ -216,7 +242,7 @@ namespace AtomSampleViewer
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
-            m_dynamicDraw->DrawIndexed(tetrahedronVerts, TetrahedronVertexCount, tetrahedronIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawLinear(tetrahedronVerts, TetrahedronVertexCount, drawSrg);
             m_dynamicDraw->SetCullMode(RHI::CullMode::None);
             m_dynamicDraw->SetCullMode(RHI::CullMode::None);
         }
         }
 
 
@@ -228,7 +254,7 @@ namespace AtomSampleViewer
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
-            m_dynamicDraw->DrawIndexed(tetrahedronVerts, TetrahedronVertexCount, tetrahedronIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawLinear(tetrahedronVerts, TetrahedronVertexCount, drawSrg);
             m_dynamicDraw->SetCullMode(RHI::CullMode::None);
             m_dynamicDraw->SetCullMode(RHI::CullMode::None);
         }
         }
 
 
@@ -240,7 +266,7 @@ namespace AtomSampleViewer
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
             m_dynamicDraw->SetPrimitiveType(RHI::PrimitiveTopology::LineList);
             m_dynamicDraw->SetPrimitiveType(RHI::PrimitiveTopology::LineList);
-            m_dynamicDraw->DrawIndexed(tetrahedronWireFrameVerts, 4, tetrahedronWireframeIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawIndexed(tetrahedronWireFrameVerts, 4, tetrahedronWireframeIndices, TetrahedronWireframeIndexCount, RHI::IndexFormat::Uint16, drawSrg);
             m_dynamicDraw->SetPrimitiveType(RHI::PrimitiveTopology::TriangleList);
             m_dynamicDraw->SetPrimitiveType(RHI::PrimitiveTopology::TriangleList);
         }
         }
 
 
@@ -260,7 +286,7 @@ namespace AtomSampleViewer
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
-            m_dynamicDraw->DrawIndexed(tetrahedronVerts, TetrahedronVertexCount, tetrahedronIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawLinear(tetrahedronVerts, TetrahedronVertexCount, drawSrg);
         }
         }
 
 
         // alpha additive
         // alpha additive
@@ -275,7 +301,7 @@ namespace AtomSampleViewer
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->SetConstant(index, Vector3(xPos, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
-            m_dynamicDraw->DrawIndexed(tetrahedronVerts, TetrahedronVertexCount, tetrahedronIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawLinear(tetrahedronVerts, TetrahedronVertexCount, drawSrg);
         }
         }
 
 
         // enable depth write
         // enable depth write
@@ -293,8 +319,95 @@ namespace AtomSampleViewer
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg = m_dynamicDraw->NewDrawSrg();
             drawSrg->SetConstant(index, Vector3(0, 0, 0));
             drawSrg->SetConstant(index, Vector3(0, 0, 0));
             drawSrg->Compile();
             drawSrg->Compile();
-            m_dynamicDraw->DrawIndexed(tetrahedronVerts, TetrahedronVertexCount, tetrahedronIndices, TetrahedronIndexCount, RHI::IndexFormat::Uint16, drawSrg);
+            m_dynamicDraw->DrawLinear(tetrahedronVerts, TetrahedronVertexCount, drawSrg);
             m_dynamicDraw->UnsetViewport();
             m_dynamicDraw->UnsetViewport();
         }
         }
+
+        // show draws from three different dynamic draw context with correct sorting
+        if (m_showSorting)
+        {
+            float black[4] = {0, 0, 0, 1};
+            float white[4] = {1, 1, 1, 1};
+            float red[4] = {1, 0, 0, 1};
+            float vertexPos[4][3] =
+            {
+                { -0.2, 0, 0.2f},
+                { -0.2, 0, -0.2f},
+                { 0.2, 0 , -0.2f},
+                { 0.2, 0 , 0.2f}
+            };
+            ExampleVertex blackQuad[4] =
+            {
+                ExampleVertex{ vertexPos[0], black },
+                ExampleVertex{ vertexPos[1], black }, 
+                ExampleVertex{ vertexPos[2], black }, 
+                ExampleVertex{ vertexPos[3], black }
+            };
+            ExampleVertex whiteQuad[4] =
+            {
+                ExampleVertex{ vertexPos[0], white },
+                ExampleVertex{ vertexPos[1], white }, 
+                ExampleVertex{ vertexPos[2], white }, 
+                ExampleVertex{ vertexPos[3], white }
+            };            
+            ExampleVertex redQuad[4] =
+            {
+                ExampleVertex{ vertexPos[0], red },
+                ExampleVertex{ vertexPos[1], red }, 
+                ExampleVertex{ vertexPos[2], red }, 
+                ExampleVertex{ vertexPos[3], red }
+            };
+            u16 quadIndics[6] =
+            {
+                0, 1, 2,
+                0, 2, 3
+            };
+
+            // disable depth for all and rely on sorting
+            depthState.m_writeMask = RHI::DepthWriteMask::Zero;
+            m_dynamicDraw->SetDepthState(depthState);
+            m_dynamicDraw1ForPass->SetDepthState(depthState);
+            m_dynamicDraw2ForPass->SetDepthState(depthState);
+            blendState.m_enable = false;
+            m_dynamicDraw->SetTarget0BlendState(blendState);
+            m_dynamicDraw1ForPass->SetTarget0BlendState(blendState);
+            m_dynamicDraw2ForPass->SetTarget0BlendState(blendState);                        
+
+            // draw two red quads via view
+            drawSrg = m_dynamicDraw->NewDrawSrg();
+            drawSrg->SetConstant(index, Vector3(-0.3f, 0, 0.7f));
+            drawSrg->Compile();
+            m_dynamicDraw->SetSortKey(0x200);
+            m_dynamicDraw->DrawIndexed(redQuad, 4, quadIndics, 6, RHI::IndexFormat::Uint16, drawSrg);
+            drawSrg = m_dynamicDraw->NewDrawSrg();
+            drawSrg->SetConstant(index, Vector3(0.3f, 0, 0.7f));
+            drawSrg->Compile();
+            m_dynamicDraw->SetSortKey(0);
+            m_dynamicDraw->DrawIndexed(redQuad, 4, quadIndics, 6, RHI::IndexFormat::Uint16, drawSrg);
+
+            // draw two white quads via ddc1 
+            drawSrg = m_dynamicDraw1ForPass->NewDrawSrg();
+            drawSrg->SetConstant(index, Vector3(-0.3f, 0, 0.8f));
+            drawSrg->Compile();
+            m_dynamicDraw1ForPass->SetSortKey(0x100);
+            m_dynamicDraw1ForPass->DrawIndexed(whiteQuad, 4, quadIndics, 6, RHI::IndexFormat::Uint16, drawSrg);
+            drawSrg = m_dynamicDraw1ForPass->NewDrawSrg();
+            drawSrg->SetConstant(index, Vector3(0.3f, 0, 0.8f));
+            drawSrg->Compile();
+            m_dynamicDraw1ForPass->SetSortKey(0x100);
+            m_dynamicDraw1ForPass->DrawIndexed(whiteQuad, 4, quadIndics, 6, RHI::IndexFormat::Uint16, drawSrg);
+        
+            // draw two black quads via dcc2
+            drawSrg = m_dynamicDraw2ForPass->NewDrawSrg();
+            drawSrg->SetConstant(index, Vector3(-0.3f, 0, 0.9f));
+            drawSrg->Compile();
+            m_dynamicDraw2ForPass->SetSortKey(0);
+            m_dynamicDraw2ForPass->DrawIndexed(blackQuad, 4, quadIndics, 6, RHI::IndexFormat::Uint16, drawSrg);
+            drawSrg = m_dynamicDraw2ForPass->NewDrawSrg();
+            drawSrg->SetConstant(index, Vector3(0.3f, 0, 0.9f));
+            drawSrg->Compile();
+            m_dynamicDraw2ForPass->SetSortKey(0x200);
+            m_dynamicDraw2ForPass->DrawIndexed(blackQuad, 4, quadIndics, 6, RHI::IndexFormat::Uint16, drawSrg);
+        }
     }
     }
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 8 - 2
Gem/Code/Source/DynamicDrawExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -58,6 +59,10 @@ namespace AtomSampleViewer
         AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> m_dynamicDraw;
         AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> m_dynamicDraw;
         AZ::Data::Instance<AZ::RPI::ShaderResourceGroup> m_contextSrg;
         AZ::Data::Instance<AZ::RPI::ShaderResourceGroup> m_contextSrg;
 
 
+        // Two dynamic draw for same pass to test sorting
+        AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> m_dynamicDraw1ForPass;
+        AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> m_dynamicDraw2ForPass;
+
         ImGuiSidebar m_imguiSidebar;
         ImGuiSidebar m_imguiSidebar;
 
 
         bool m_showCullModeNull = true;
         bool m_showCullModeNull = true;
@@ -67,6 +72,7 @@ namespace AtomSampleViewer
         bool m_showAlphaAdditive = true;
         bool m_showAlphaAdditive = true;
         bool m_showLineList = true;
         bool m_showLineList = true;
         bool m_showPerDrawViewport = true;
         bool m_showPerDrawViewport = true;
+        bool m_showSorting = true;
 
 
         // CommonSampleComponentBase overrides...
         // CommonSampleComponentBase overrides...
         void OnAllAssetsReadyActivate() override;
         void OnAllAssetsReadyActivate() override;

+ 4 - 2
Gem/Code/Source/DynamicMaterialTestComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -18,6 +19,7 @@
 
 
 #include <AzCore/Component/Entity.h>
 #include <AzCore/Component/Entity.h>
 #include <AzCore/Debug/EventTrace.h>
 #include <AzCore/Debug/EventTrace.h>
+#include <AzCore/Debug/Timer.h>
 #include <AzCore/Math/Random.h>
 #include <AzCore/Math/Random.h>
 
 
 #include <RHI/BasicRHIComponent.h>
 #include <RHI/BasicRHIComponent.h>

+ 3 - 2
Gem/Code/Source/DynamicMaterialTestComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 4 - 3
Gem/Code/Source/EntityLatticeTestComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -42,7 +43,7 @@ namespace AtomSampleViewer
         Debug::CameraControllerRequestBus::Event(GetCameraEntityId(), &Debug::CameraControllerRequestBus::Events::Enable,
         Debug::CameraControllerRequestBus::Event(GetCameraEntityId(), &Debug::CameraControllerRequestBus::Events::Enable,
             azrtti_typeid<Debug::NoClipControllerComponent>());
             azrtti_typeid<Debug::NoClipControllerComponent>());
 
 
-        m_defaultIbl.Init(RPI::RPISystemInterface::Get()->GetDefaultScene().get());
+        m_defaultIbl.Init(m_scene);
         BuildLattice();
         BuildLattice();
     }
     }
 
 

+ 3 - 2
Gem/Code/Source/EntityLatticeTestComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/EntityUtilityFunctions.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/EntityUtilityFunctions.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/ExampleComponentBus.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 5 - 5
Gem/Code/Source/ExposureExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -41,9 +42,8 @@ namespace AtomSampleViewer
     {
     {
         using namespace AZ;
         using namespace AZ;
 
 
-        RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
-        m_postProcessFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessorInterface>();
-        m_pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+        m_postProcessFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessorInterface>();
+        m_pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
 
 
         EnableCameraController();
         EnableCameraController();
 
 

+ 3 - 2
Gem/Code/Source/ExposureExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 20 - 24
Gem/Code/Source/LightCullingExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -31,6 +32,7 @@
 #include <Atom/RPI.Public/RenderPipeline.h>
 #include <Atom/RPI.Public/RenderPipeline.h>
 #include <Atom/RPI.Public/View.h>
 #include <Atom/RPI.Public/View.h>
 #include <Atom/RPI.Public/Pass/FullscreenTrianglePass.h>
 #include <Atom/RPI.Public/Pass/FullscreenTrianglePass.h>
+#include <Atom/RPI.Public/Pass/PassFilter.h>
 #include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
 #include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
 #include <Atom/RPI.Public/AuxGeom/AuxGeomDraw.h>
 #include <Atom/RPI.Public/AuxGeom/AuxGeomDraw.h>
 #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
 #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
@@ -212,7 +214,7 @@ namespace AtomSampleViewer
     {
     {
         m_meshChangedHandler.Disconnect();
         m_meshChangedHandler.Disconnect();
         m_worldModelAssetLoaded = true;
         m_worldModelAssetLoaded = true;
-        m_worldModelAABB = model->GetAabb();
+        m_worldModelAABB = model->GetModelAsset()->GetAabb();
 
 
         InitLightArrays();
         InitLightArrays();
         CreateLightsAndDecals();
         CreateLightsAndDecals();
@@ -629,8 +631,7 @@ namespace AtomSampleViewer
 
 
     void LightCullingExampleComponent::DrawDebuggingHelpers()
     void LightCullingExampleComponent::DrawDebuggingHelpers()
     {
     {
-        auto defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        if (auto auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(defaultScene))
+        if (auto auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(m_scene))
         {
         {
             if (m_settings[(int)LightType::Point].m_enableDebugDraws)
             if (m_settings[(int)LightType::Point].m_enableDebugDraws)
             {
             {
@@ -714,12 +715,11 @@ namespace AtomSampleViewer
 
 
     void LightCullingExampleComponent::GetFeatureProcessors()
     void LightCullingExampleComponent::GetFeatureProcessors()
     {
     {
-        AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
-        m_pointLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
-        m_diskLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
-        m_capsuleLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::CapsuleLightFeatureProcessorInterface>();
-        m_quadLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::QuadLightFeatureProcessorInterface>();
-        m_decalFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DecalFeatureProcessorInterface>();
+        m_pointLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::PointLightFeatureProcessorInterface>();
+        m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
+        m_capsuleLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::CapsuleLightFeatureProcessorInterface>();
+        m_quadLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::QuadLightFeatureProcessorInterface>();
+        m_decalFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DecalFeatureProcessorInterface>();
     }
     }
 
 
     float LightCullingExampleComponent::AutoCalculateAttenuationRadius(const AZ::Color& color, float intensity)
     float LightCullingExampleComponent::AutoCalculateAttenuationRadius(const AZ::Color& color, float intensity)
@@ -740,21 +740,17 @@ namespace AtomSampleViewer
 
 
     void LightCullingExampleComponent::UpdateHeatmapOpacity()
     void LightCullingExampleComponent::UpdateHeatmapOpacity()
     {
     {
-        if (const ScenePtr scene = RPISystemInterface::Get()->GetDefaultScene())
+        if (const RenderPipelinePtr pipeline = m_scene->GetDefaultRenderPipeline())
         {
         {
-            if (const RenderPipelinePtr pipeline = scene->GetDefaultRenderPipeline())
+            AZ::RPI::PassFilter passFilter = AZ::RPI::PassFilter::CreateWithPassName(AZ::Name("LightCullingHeatmapPass"), pipeline.get());
+            const Ptr<RenderPass> trianglePass = azrtti_cast<RenderPass*>(AZ::RPI::PassSystemInterface::Get()->FindFirstPass(passFilter));
+            if (trianglePass)
             {
             {
-                if (const Ptr<Pass> pass = pipeline->GetRootPass()->FindPassByNameRecursive(AZ::Name("LightCullingHeatmapPass")))
-                {
-                    if (const Ptr<RenderPass> trianglePass = azrtti_cast<RenderPass*>(pass))
-                    {
-                        trianglePass->SetEnabled(m_heatmapOpacity > 0.0f);
-                        Data::Instance<ShaderResourceGroup> srg = trianglePass->GetShaderResourceGroup();
-                        RHI::ShaderInputConstantIndex opacityIndex = srg->FindShaderInputConstantIndex(AZ::Name("m_heatmapOpacity"));
-                        [[maybe_unused]] bool setOk = srg->SetConstant<float>(opacityIndex, m_heatmapOpacity);
-                        AZ_Warning("LightCullingExampleComponent", setOk, "Unable to set heatmap opacity");
-                    }
-                }
+                trianglePass->SetEnabled(m_heatmapOpacity > 0.0f);
+                Data::Instance<ShaderResourceGroup> srg = trianglePass->GetShaderResourceGroup();
+                RHI::ShaderInputConstantIndex opacityIndex = srg->FindShaderInputConstantIndex(AZ::Name("m_heatmapOpacity"));
+                [[maybe_unused]] bool setOk = srg->SetConstant<float>(opacityIndex, m_heatmapOpacity);
+                AZ_Warning("LightCullingExampleComponent", setOk, "Unable to set heatmap opacity");
             }
             }
         }
         }
     }
     }

+ 3 - 2
Gem/Code/Source/LightCullingExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 74 - 86
Gem/Code/Source/MSAA_RPI_ExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -12,10 +13,12 @@
 
 
 #include <Atom/RPI.Public/View.h>
 #include <Atom/RPI.Public/View.h>
 #include <Atom/RPI.Public/Image/StreamingImage.h>
 #include <Atom/RPI.Public/Image/StreamingImage.h>
+#include <Atom/RPI.Public/Shader/ShaderSystemInterface.h>
 
 
 #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
 #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
 #include <Atom/RPI.Reflect/Model/ModelAsset.h>
 #include <Atom/RPI.Reflect/Model/ModelAsset.h>
 #include <Atom/RPI.Reflect/Material/MaterialAsset.h>
 #include <Atom/RPI.Reflect/Material/MaterialAsset.h>
+#include <Atom/RPI.Reflect/Shader/ShaderCommonTypes.h>
 
 
 #include <Utils/Utils.h>
 #include <Utils/Utils.h>
 
 
@@ -29,23 +32,6 @@
 
 
 namespace AtomSampleViewer
 namespace AtomSampleViewer
 {
 {
-    static const char* GetPipelineName(int numSamples)
-    {
-        switch (numSamples)
-        {
-        case 1:
-            return "No_MSAA_RPI_Pipeline";
-        case 2:
-            return "MSAA_2x_RPI_Pipeline";
-        case 4:
-            return "MSAA_4x_RPI_Pipeline";
-        case 8:
-            return "MSAA_8x_RPI_Pipeline";
-        }
-        AZ_Warning("MSAA_RPI_ExampleComponent", false, "Unsupported number of samples, defaulting to 1");
-        return "No_MSAA_RPI_Pipeline";
-    }
-
     void MSAA_RPI_ExampleComponent::Reflect(AZ::ReflectContext* context)
     void MSAA_RPI_ExampleComponent::Reflect(AZ::ReflectContext* context)
     {
     {
         if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
         if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
@@ -62,75 +48,87 @@ namespace AtomSampleViewer
         AZ::TickBus::Handler::BusConnect();
         AZ::TickBus::Handler::BusConnect();
         ExampleComponentRequestBus::Handler::BusConnect(GetEntityId());
         ExampleComponentRequestBus::Handler::BusConnect(GetEntityId());
         AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler::BusConnect();
         AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler::BusConnect();
-        ActivateMSAAPipeline();
-        EnableArcBallCameraController();
-        ActivateModel();
-        ActivateIbl();
-    }
 
 
-    void MSAA_RPI_ExampleComponent::Deactivate()
-    {
-        DeactivateIbl();
-        DeactivateModel();
-        DisableArcBallCameraController();
-        DeactivateMSAAPipeline();
-        AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler::BusDisconnect();
-        ExampleComponentRequestBus::Handler::BusDisconnect();
-        AZ::TickBus::Handler::BusDisconnect();
-        m_imguiSidebar.Deactivate();
-    }
+        // save the current render pipeline
+        m_originalPipeline = m_scene->GetDefaultRenderPipeline();
+        m_scene->RemoveRenderPipeline(m_originalPipeline->GetId());
 
 
-    void MSAA_RPI_ExampleComponent::EnableArcBallCameraController()
-    {
+        // switch to the sample render pipeline
+        ChangeRenderPipeline();
+  
+        // set ArcBall camera controller
         AZ::Debug::CameraControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::CameraControllerRequestBus::Events::Enable,
         AZ::Debug::CameraControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::CameraControllerRequestBus::Events::Enable,
             azrtti_typeid<AZ::Debug::ArcBallControllerComponent>());
             azrtti_typeid<AZ::Debug::ArcBallControllerComponent>());
+    
+        ActivateModel();
+        ActivateIbl();
     }
     }
 
 
-    void MSAA_RPI_ExampleComponent::DisableArcBallCameraController()
+    void MSAA_RPI_ExampleComponent::Deactivate()
     {
     {
+        GetMeshFeatureProcessor()->ReleaseMesh(m_meshHandle);
         AZ::Debug::CameraControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::CameraControllerRequestBus::Events::Disable);
         AZ::Debug::CameraControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::CameraControllerRequestBus::Events::Disable);
-    }
-
-    void MSAA_RPI_ExampleComponent::OnModelReady(AZ::Data::Instance<AZ::RPI::Model> model)
-    {
-        AZ::Data::Asset<AZ::RPI::ModelAsset> modelAsset = model->GetModelAsset();
-        m_meshChangedHandler.Disconnect();
-        ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::ResumeScript);
-    }
-
-    void MSAA_RPI_ExampleComponent::ActivateMSAAPipeline()
-    {
-        CreateMSAAPipeline(m_numSamples);
+        m_defaultIbl.Reset();
 
 
-        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        m_originalPipeline = defaultScene->GetDefaultRenderPipeline();
-        defaultScene->AddRenderPipeline(m_msaaPipeline);
-        m_msaaPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
-        defaultScene->RemoveRenderPipeline(m_originalPipeline->GetId());
+        // reset the number of MSAA samples and the RPI scene
+        SampleComponentManagerRequestBus::Broadcast(&SampleComponentManagerRequests::ResetNumMSAASamples);
+        SampleComponentManagerRequestBus::Broadcast(&SampleComponentManagerRequests::ClearRPIScene);
 
 
-        // Create an ImGuiActiveContextScope to ensure the ImGui context on the new pipeline's ImGui pass is activated.
-        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass(AZ::RPI::PassHierarchyFilter({ m_msaaPipeline->GetId().GetCStr(), "ImGuiPass" }));
+        AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler::BusDisconnect();
+        ExampleComponentRequestBus::Handler::BusDisconnect();
+        AZ::TickBus::Handler::BusDisconnect();
+        m_imguiSidebar.Deactivate();
     }
     }
 
 
-    void MSAA_RPI_ExampleComponent::DeactivateMSAAPipeline()
+    void MSAA_RPI_ExampleComponent::ChangeRenderPipeline()
     {
     {
         m_imguiScope = {}; // restores previous ImGui context.
         m_imguiScope = {}; // restores previous ImGui context.
 
 
-        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        defaultScene->AddRenderPipeline(m_originalPipeline);
-        AZ::RPI::RenderPipelineDescriptor pipelineDesc;
-        defaultScene->RemoveRenderPipeline(m_msaaPipeline->GetId());
-        DestroyMSAAPipeline();
-    }
-
-    void MSAA_RPI_ExampleComponent::CreateMSAAPipeline(int numSamples)
-    {
+        // remove currently running sample pipeline, if any
+        if (m_samplePipeline)
+        {
+            m_scene->RemoveRenderPipeline(m_samplePipeline->GetId());
+            m_samplePipeline = nullptr;
+        }
+        
+        bool isNonMsaaPipeline = (m_numSamples == 1);
+        
+        // if we are changing between the MSAA and non-MSAA pipelines we need to force a reset on the RPI scene.  This is
+        // necessary to re-initialize all of the feature processor shaders and Srgs
+        if (isNonMsaaPipeline != m_isNonMsaaPipeline)
+        {      
+            // set the number of MSAA samples and reset the RPI scene
+            SampleComponentManagerRequestBus::Broadcast(&SampleComponentManagerRequests::SetNumMSAASamples, m_numSamples);
+            SampleComponentManagerRequestBus::Broadcast(&SampleComponentManagerRequests::ResetRPIScene);
+
+            // reset internal sample scene related data
+            ResetScene();
+
+            // remove the default render pipeline
+            AZ::RPI::RenderPipelinePtr defaultPipeline = m_scene->GetDefaultRenderPipeline();
+            m_scene->RemoveRenderPipeline(defaultPipeline->GetId());
+
+            // scene IBL is cleared after the reset, re-activate it
+            ActivateIbl();
+
+            m_isNonMsaaPipeline = isNonMsaaPipeline;          
+        }
+        
+        // create the new sample pipeline
         AZ::RPI::RenderPipelineDescriptor pipelineDesc;
         AZ::RPI::RenderPipelineDescriptor pipelineDesc;
         pipelineDesc.m_mainViewTagName = "MainCamera";
         pipelineDesc.m_mainViewTagName = "MainCamera";
         pipelineDesc.m_name = "MSAA";
         pipelineDesc.m_name = "MSAA";
-        pipelineDesc.m_rootPassTemplate = GetPipelineName(numSamples);
+        pipelineDesc.m_rootPassTemplate = "MainPipeline";
+        pipelineDesc.m_renderSettings.m_multisampleState.m_samples = static_cast<uint16_t>(m_numSamples);
+        m_samplePipeline = AZ::RPI::RenderPipeline::CreateRenderPipelineForWindow(pipelineDesc, *m_windowContext);
 
 
-        m_msaaPipeline = AZ::RPI::RenderPipeline::CreateRenderPipelineForWindow(pipelineDesc, *m_windowContext);
+        // add the sample pipeline to the scene
+        m_scene->AddRenderPipeline(m_samplePipeline);
+        m_samplePipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
+        m_scene->SetDefaultRenderPipeline(m_samplePipeline->GetId());
+
+        // create an ImGuiActiveContextScope to ensure the ImGui context on the new pipeline's ImGui pass is activated.
+        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass({ m_samplePipeline->GetId().GetCStr(), "ImGuiPass" });
     }
     }
 
 
     void MSAA_RPI_ExampleComponent::ResetCamera()
     void MSAA_RPI_ExampleComponent::ResetCamera()
@@ -150,11 +148,6 @@ namespace AtomSampleViewer
         AZ::Render::Bootstrap::DefaultWindowBus::BroadcastResult(m_windowContext, &AZ::Render::Bootstrap::DefaultWindowBus::Events::GetDefaultWindowContext);
         AZ::Render::Bootstrap::DefaultWindowBus::BroadcastResult(m_windowContext, &AZ::Render::Bootstrap::DefaultWindowBus::Events::GetDefaultWindowContext);
     }
     }
 
 
-    void MSAA_RPI_ExampleComponent::DestroyMSAAPipeline()
-    {
-        m_msaaPipeline = nullptr;
-    }
-
     AZ::Data::Asset<AZ::RPI::MaterialAsset> MSAA_RPI_ExampleComponent::GetMaterialAsset()
     AZ::Data::Asset<AZ::RPI::MaterialAsset> MSAA_RPI_ExampleComponent::GetMaterialAsset()
     {
     {
         AZ::RPI::AssetUtils::TraceLevel traceLevel = AZ::RPI::AssetUtils::TraceLevel::Assert;
         AZ::RPI::AssetUtils::TraceLevel traceLevel = AZ::RPI::AssetUtils::TraceLevel::Assert;
@@ -178,7 +171,6 @@ namespace AtomSampleViewer
         return AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/cylinder.azmodel", traceLevel);
         return AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/cylinder.azmodel", traceLevel);
     }
     }
 
 
-
     void MSAA_RPI_ExampleComponent::ActivateModel()
     void MSAA_RPI_ExampleComponent::ActivateModel()
     {
     {
         m_meshHandle = GetMeshFeatureProcessor()->AcquireMesh(AZ::Render::MeshHandleDescriptor{ GetModelAsset() }, AZ::RPI::Material::FindOrCreate(GetMaterialAsset()));
         m_meshHandle = GetMeshFeatureProcessor()->AcquireMesh(AZ::Render::MeshHandleDescriptor{ GetModelAsset() }, AZ::RPI::Material::FindOrCreate(GetMaterialAsset()));
@@ -196,24 +188,21 @@ namespace AtomSampleViewer
         }
         }
     }
     }
 
 
-    void MSAA_RPI_ExampleComponent::DeactivateModel()
+    void MSAA_RPI_ExampleComponent::OnModelReady(AZ::Data::Instance<AZ::RPI::Model> model)
     {
     {
-        GetMeshFeatureProcessor()->ReleaseMesh(m_meshHandle);
+        AZ::Data::Asset<AZ::RPI::ModelAsset> modelAsset = model->GetModelAsset();
+        m_meshChangedHandler.Disconnect();
+        ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::ResumeScript);
     }
     }
 
 
     void MSAA_RPI_ExampleComponent::ActivateIbl()
     void MSAA_RPI_ExampleComponent::ActivateIbl()
     {
     {
-        m_defaultIbl.Init(AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get());
+        m_defaultIbl.Init(m_scene);
 
 
         // reduce the exposure so the model isn't overly bright
         // reduce the exposure so the model isn't overly bright
         m_defaultIbl.SetExposure(-0.5f);
         m_defaultIbl.SetExposure(-0.5f);
     }
     }
 
 
-    void MSAA_RPI_ExampleComponent::DeactivateIbl()
-    {
-        m_defaultIbl.Reset();
-    }
-
     void MSAA_RPI_ExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
     void MSAA_RPI_ExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
     {
     {
         DrawSidebar();
         DrawSidebar();
@@ -234,9 +223,8 @@ namespace AtomSampleViewer
         if (refresh)
         if (refresh)
         {
         {
             // Note that the model's have some multisample information embedded into their pipeline state, so delete and recreate the model
             // Note that the model's have some multisample information embedded into their pipeline state, so delete and recreate the model
-            DeactivateModel();
-            DeactivateMSAAPipeline();
-            ActivateMSAAPipeline();
+            GetMeshFeatureProcessor()->ReleaseMesh(m_meshHandle);
+            ChangeRenderPipeline();
             ActivateModel();
             ActivateModel();
         }
         }
     }
     }

+ 24 - 26
Gem/Code/Source/MSAA_RPI_ExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -35,43 +36,32 @@ namespace AtomSampleViewer
         static void Reflect(AZ::ReflectContext* context);
         static void Reflect(AZ::ReflectContext* context);
 
 
         void Activate() override;
         void Activate() override;
-
-
         void Deactivate() override;
         void Deactivate() override;
 
 
     private:
     private:
 
 
-        void ActivateMSAAPipeline();
-        void DeactivateMSAAPipeline();
-
-        void ActivateIbl();
-        void DeactivateIbl();
-
-        void CreateMSAAPipeline(int numSamples);
-        void DestroyMSAAPipeline();
+        // DefaultWindowNotificationBus::Handler
+        void DefaultWindowCreated() override;
 
 
-        void ActivateModel();
-        void DeactivateModel();
-        
         // AZ::TickBus::Handler
         // AZ::TickBus::Handler
         void OnTick(float deltaTime, AZ::ScriptTimePoint timePoint) override;
         void OnTick(float deltaTime, AZ::ScriptTimePoint timePoint) override;
 
 
         // ExampleComponentRequestBus::Handler
         // ExampleComponentRequestBus::Handler
         void ResetCamera() override;
         void ResetCamera() override;
 
 
-        void DefaultWindowCreated() override;
-
-        void EnableArcBallCameraController();
-        void DisableArcBallCameraController();
-
+        // helper functions
+        void ChangeRenderPipeline();
+        void ActivateIbl();
+        void ActivateModel();
         void OnModelReady(AZ::Data::Instance<AZ::RPI::Model> model);
         void OnModelReady(AZ::Data::Instance<AZ::RPI::Model> model);
         AZ::Data::Asset<AZ::RPI::MaterialAsset> GetMaterialAsset();
         AZ::Data::Asset<AZ::RPI::MaterialAsset> GetMaterialAsset();
         AZ::Data::Asset<AZ::RPI::ModelAsset> GetModelAsset();
         AZ::Data::Asset<AZ::RPI::ModelAsset> GetModelAsset();
         void DrawSidebar();
         void DrawSidebar();
-
         bool DrawSidebarModeChooser(bool refresh);
         bool DrawSidebarModeChooser(bool refresh);
         bool DrawSideBarModelChooser(bool refresh);
         bool DrawSideBarModelChooser(bool refresh);
 
 
+        // sample mesh
+        int m_modelType = 0;
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         AZ::Render::MeshFeatureProcessorInterface::ModelChangedEvent::Handler m_meshChangedHandler
         AZ::Render::MeshFeatureProcessorInterface::ModelChangedEvent::Handler m_meshChangedHandler
         {
         {
@@ -80,15 +70,23 @@ namespace AtomSampleViewer
                 OnModelReady(model);
                 OnModelReady(model);
             }
             }
         };
         };
-        
-        AZ::RPI::RenderPipelinePtr m_msaaPipeline;
+
+        // original render pipeline when the sample was started
         AZ::RPI::RenderPipelinePtr m_originalPipeline;
         AZ::RPI::RenderPipelinePtr m_originalPipeline;
+
+        // sample render pipeline, can be MSAA 2x/4x/8x or non-MSAA
+        AZ::RPI::RenderPipelinePtr m_samplePipeline;
+
+        // number of MSAA samples in the pipeline, controlled by the user
+        int m_numSamples = 1;
+
+        // flag indicating if the current pipeline is a non-MSAA pipeline
+        bool m_isNonMsaaPipeline = false;
+
+        // other state
         AZStd::shared_ptr<AZ::RPI::WindowContext> m_windowContext;
         AZStd::shared_ptr<AZ::RPI::WindowContext> m_windowContext;
         Utils::DefaultIBL m_defaultIbl;
         Utils::DefaultIBL m_defaultIbl;
         ImGuiSidebar m_imguiSidebar;
         ImGuiSidebar m_imguiSidebar;
-        int m_numSamples = 1;
-        int m_modelType = 0;
-
         AZ::Render::ImGuiActiveContextScope m_imguiScope;
         AZ::Render::ImGuiActiveContextScope m_imguiScope;
     };
     };
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 6 - 13
Gem/Code/Source/MaterialHotReloadTestComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -286,7 +287,7 @@ namespace AtomSampleViewer
 
 
         ImGui::Text("Status:");
         ImGui::Text("Status:");
         ImGui::SameLine();
         ImGui::SameLine();
-        ImGui::Text(ToString(status));
+        ImGui::Text("%s", ToString(status));
 
 
         if (includeFileName)
         if (includeFileName)
         {
         {
@@ -387,20 +388,12 @@ namespace AtomSampleViewer
                 // Any stale assets have been cleared, now we can create the new ones.
                 // Any stale assets have been cleared, now we can create the new ones.
                 // Copy a default set files into the temp folder.
                 // Copy a default set files into the temp folder.
                 CopyTestFile(TestData::AzslFileNames::HorizontalPattern, Sources::AzslFileName);
                 CopyTestFile(TestData::AzslFileNames::HorizontalPattern, Sources::AzslFileName);
-                m_initStatus = InitStatus::CopyingDefaultAzslTestFile;
-            }
-        }
-
-        if (m_initStatus == InitStatus::CopyingDefaultAzslTestFile)
-        {
-            AzFramework::AssetSystem::AssetStatus status = GetTestAssetStatus(Sources::AzslFileName);
-            if (status == AzFramework::AssetSystem::AssetStatus::AssetStatus_Compiled)
-            {
                 CopyTestFile(TestData::ShaderFileNames::BlendingOff, Sources::ShaderFileName);
                 CopyTestFile(TestData::ShaderFileNames::BlendingOff, Sources::ShaderFileName);
                 m_initStatus = InitStatus::CopyingDefaultShaderTestFile;
                 m_initStatus = InitStatus::CopyingDefaultShaderTestFile;
             }
             }
         }
         }
-        else if (m_initStatus == InitStatus::CopyingDefaultShaderTestFile)
+
+        if (m_initStatus == InitStatus::CopyingDefaultShaderTestFile)
         {
         {
             AzFramework::AssetSystem::AssetStatus status = GetTestAssetStatus(Sources::ShaderFileName);
             AzFramework::AssetSystem::AssetStatus status = GetTestAssetStatus(Sources::ShaderFileName);
             if (status == AzFramework::AssetSystem::AssetStatus::AssetStatus_Compiled)
             if (status == AzFramework::AssetSystem::AssetStatus::AssetStatus_Compiled)

+ 3 - 3
Gem/Code/Source/MaterialHotReloadTestComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -78,7 +79,6 @@ namespace AtomSampleViewer
         {
         {
             None,
             None,
             ClearingTestAssets,
             ClearingTestAssets,
-            CopyingDefaultAzslTestFile,
             CopyingDefaultShaderTestFile,
             CopyingDefaultShaderTestFile,
             CopyingDefaultMaterialTypeTestFile,
             CopyingDefaultMaterialTypeTestFile,
             WaitingForDefaultMaterialToRegister,
             WaitingForDefaultMaterialToRegister,

+ 21 - 19
Gem/Code/Source/MeshExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -99,22 +100,20 @@ namespace AtomSampleViewer
 
 
     void MeshExampleComponent::ActivateLowEndPipeline()
     void MeshExampleComponent::ActivateLowEndPipeline()
     {
     {
-        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        m_originalPipeline = defaultScene->GetDefaultRenderPipeline();
-        defaultScene->AddRenderPipeline(m_lowEndPipeline);
+        m_originalPipeline = m_scene->GetDefaultRenderPipeline();
+        m_scene->AddRenderPipeline(m_lowEndPipeline);
         m_lowEndPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
         m_lowEndPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
-        defaultScene->RemoveRenderPipeline(m_originalPipeline->GetId());
+        m_scene->RemoveRenderPipeline(m_originalPipeline->GetId());
 
 
-        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass(AZ::RPI::PassHierarchyFilter({ m_lowEndPipeline->GetId().GetCStr(), "ImGuiPass" }));
+        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass({ m_lowEndPipeline->GetId().GetCStr(), "ImGuiPass" });
     }
     }
 
 
     void MeshExampleComponent::DeactivateLowEndPipeline()
     void MeshExampleComponent::DeactivateLowEndPipeline()
     {
     {
         m_imguiScope = {}; // restores previous ImGui context.
         m_imguiScope = {}; // restores previous ImGui context.
 
 
-        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        defaultScene->AddRenderPipeline(m_originalPipeline);
-        defaultScene->RemoveRenderPipeline(m_lowEndPipeline->GetId());
+        m_scene->AddRenderPipeline(m_originalPipeline);
+        m_scene->RemoveRenderPipeline(m_lowEndPipeline->GetId());
     }
     }
 
 
     void MeshExampleComponent::Activate()
     void MeshExampleComponent::Activate()
@@ -248,7 +247,7 @@ namespace AtomSampleViewer
             if (modelChanged)
             if (modelChanged)
             {
             {
                 // Reset LOD override when the model changes.
                 // Reset LOD override when the model changes.
-                m_lodOverride = AZ::RPI::Cullable::NoLodOverride;
+                m_lodConfig.m_lodType = AZ::RPI::Cullable::LodType::Default;
             }
             }
 
 
             AZ::Data::Instance<AZ::RPI::Model> model = GetMeshFeatureProcessor()->GetModel(m_meshHandle);
             AZ::Data::Instance<AZ::RPI::Model> model = GetMeshFeatureProcessor()->GetModel(m_meshHandle);
@@ -257,23 +256,26 @@ namespace AtomSampleViewer
                 const char* NoLodOverrideText = "No LOD Override";
                 const char* NoLodOverrideText = "No LOD Override";
                 const char* LodFormatString = "LOD %i";
                 const char* LodFormatString = "LOD %i";
 
 
-                AZStd::string previewText = m_lodOverride == AZ::RPI::Cullable::NoLodOverride ? NoLodOverrideText : AZStd::string::format(LodFormatString, m_lodOverride);
+                AZStd::string previewText = m_lodConfig.m_lodType == AZ::RPI::Cullable::LodType::Default ? 
+                    NoLodOverrideText : 
+                    AZStd::string::format(LodFormatString, m_lodConfig.m_lodOverride);
 
 
                 if (ScriptableImGui::BeginCombo("", previewText.c_str()))
                 if (ScriptableImGui::BeginCombo("", previewText.c_str()))
                 {
                 {
-                    if (ScriptableImGui::Selectable(NoLodOverrideText, m_lodOverride == AZ::RPI::Cullable::NoLodOverride))
+                    if (ScriptableImGui::Selectable(NoLodOverrideText, m_lodConfig.m_lodType == AZ::RPI::Cullable::LodType::Default))
                     {
                     {
-                        m_lodOverride = AZ::RPI::Cullable::NoLodOverride;
-                        GetMeshFeatureProcessor()->SetLodOverride(m_meshHandle, m_lodOverride);
+                        m_lodConfig.m_lodType = AZ::RPI::Cullable::LodType::Default;
+                        GetMeshFeatureProcessor()->SetMeshLodConfiguration(m_meshHandle, m_lodConfig);
                     }
                     }
 
 
                     for (uint32_t i = 0; i < model->GetLodCount(); ++i)
                     for (uint32_t i = 0; i < model->GetLodCount(); ++i)
                     {
                     {
                         AZStd::string name = AZStd::string::format(LodFormatString, i);
                         AZStd::string name = AZStd::string::format(LodFormatString, i);
-                        if (ScriptableImGui::Selectable(name.c_str(), m_lodOverride == i))
+                        if (ScriptableImGui::Selectable(name.c_str(), m_lodConfig.m_lodOverride == i))
                         {
                         {
-                            m_lodOverride = i;
-                            GetMeshFeatureProcessor()->SetLodOverride(m_meshHandle, m_lodOverride);
+                            m_lodConfig.m_lodType = AZ::RPI::Cullable::LodType::SpecificLod;
+                            m_lodConfig.m_lodOverride = static_cast<AZ::RPI::Cullable::LodOverride>(i);
+                            GetMeshFeatureProcessor()->SetMeshLodConfiguration(m_meshHandle, m_lodConfig);
                         }
                         }
                     }
                     }
                     ScriptableImGui::EndCombo();
                     ScriptableImGui::EndCombo();
@@ -360,7 +362,7 @@ namespace AtomSampleViewer
             m_meshHandle = GetMeshFeatureProcessor()->AcquireMesh(AZ::Render::MeshHandleDescriptor{ m_modelAsset }, m_materialOverrideInstance);
             m_meshHandle = GetMeshFeatureProcessor()->AcquireMesh(AZ::Render::MeshHandleDescriptor{ m_modelAsset }, m_materialOverrideInstance);
             GetMeshFeatureProcessor()->SetTransform(m_meshHandle, AZ::Transform::CreateIdentity());
             GetMeshFeatureProcessor()->SetTransform(m_meshHandle, AZ::Transform::CreateIdentity());
             GetMeshFeatureProcessor()->ConnectModelChangeEventHandler(m_meshHandle, m_changedHandler);
             GetMeshFeatureProcessor()->ConnectModelChangeEventHandler(m_meshHandle, m_changedHandler);
-            GetMeshFeatureProcessor()->SetLodOverride(m_meshHandle, m_lodOverride);
+            GetMeshFeatureProcessor()->SetMeshLodConfiguration(m_meshHandle, m_lodConfig);
         }
         }
         else
         else
         {
         {

+ 4 - 3
Gem/Code/Source/MeshExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -94,7 +95,7 @@ namespace AtomSampleViewer
         static constexpr float ArcballRadiusMaxModifier = 4.0f;
         static constexpr float ArcballRadiusMaxModifier = 4.0f;
         static constexpr float ArcballRadiusDefaultModifier = 2.0f;
         static constexpr float ArcballRadiusDefaultModifier = 2.0f;
         
         
-        AZ::RPI::Cullable::LodOverride m_lodOverride = AZ::RPI::Cullable::NoLodOverride;
+        AZ::RPI::Cullable::LodConfiguration m_lodConfig;
 
 
         bool m_enableMaterialOverride = true;
         bool m_enableMaterialOverride = true;
 
 

+ 5 - 8
Gem/Code/Source/MultiRenderPipelineExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -63,8 +64,6 @@ namespace AtomSampleViewer
 
 
     void MultiRenderPipelineExampleComponent::Activate()
     void MultiRenderPipelineExampleComponent::Activate()
     {
     {
-        m_scene = RPI::RPISystemInterface::Get()->GetDefaultScene();
-
         // Save references of different feature processors
         // Save references of different feature processors
         m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DiskLightFeatureProcessorInterface>();
         m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DiskLightFeatureProcessorInterface>();
         m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DirectionalLightFeatureProcessorInterface>();
         m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DirectionalLightFeatureProcessorInterface>();
@@ -219,8 +218,6 @@ namespace AtomSampleViewer
         featureProcessor->SetShadowmapSize(handle, Render::ShadowmapSize::Size2048);
         featureProcessor->SetShadowmapSize(handle, Render::ShadowmapSize::Size2048);
         featureProcessor->SetViewFrustumCorrectionEnabled(handle, true);
         featureProcessor->SetViewFrustumCorrectionEnabled(handle, true);
         featureProcessor->SetShadowFilterMethod(handle, aznumeric_cast<Render::ShadowFilterMethod>(m_shadowFilteringMethod));
         featureProcessor->SetShadowFilterMethod(handle, aznumeric_cast<Render::ShadowFilterMethod>(m_shadowFilteringMethod));
-        featureProcessor->SetShadowBoundaryWidth(handle, 0.03f);
-        featureProcessor->SetPredictionSampleCount(handle, 4);
         featureProcessor->SetFilteringSampleCount(handle, 32);
         featureProcessor->SetFilteringSampleCount(handle, 32);
         featureProcessor->SetGroundHeight(handle, 0.f);
         featureProcessor->SetGroundHeight(handle, 0.f);
         featureProcessor->SetShadowFarClipDistance(handle, 100.f);
         featureProcessor->SetShadowFarClipDistance(handle, 100.f);
@@ -281,7 +278,7 @@ namespace AtomSampleViewer
     
     
     void MultiRenderPipelineExampleComponent::AddIBL()
     void MultiRenderPipelineExampleComponent::AddIBL()
     {
     {
-        m_ibl.Init(m_scene.get());
+        m_ibl.Init(m_scene);
     }
     }
 
 
     void MultiRenderPipelineExampleComponent::RemoveIBL()
     void MultiRenderPipelineExampleComponent::RemoveIBL()
@@ -573,7 +570,7 @@ namespace AtomSampleViewer
 
 
         if (m_secondPipeline)
         if (m_secondPipeline)
         {
         {
-            Render::ImGuiActiveContextScope contextGuard = Render::ImGuiActiveContextScope::FromPass(RPI::PassHierarchyFilter({ "SecondPipeline", "ImGuiPass"}));
+            Render::ImGuiActiveContextScope contextGuard = Render::ImGuiActiveContextScope::FromPass({ "SecondPipeline", "ImGuiPass"});
             AZ_Error("MultiRenderPipelineExampleComponent", contextGuard.IsEnabled(), "Unable to activate imgui context for second pipeline.");
             AZ_Error("MultiRenderPipelineExampleComponent", contextGuard.IsEnabled(), "Unable to activate imgui context for second pipeline.");
 
 
             if (contextGuard.IsEnabled())
             if (contextGuard.IsEnabled())

+ 3 - 5
Gem/Code/Source/MultiRenderPipelineExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -131,9 +132,6 @@ namespace AtomSampleViewer
 
 
         // camera for the second render pipeline
         // camera for the second render pipeline
         AZ::Entity* m_secondViewCameraEntity = nullptr;
         AZ::Entity* m_secondViewCameraEntity = nullptr;
-
-        // Reference to current scene
-        AZ::RPI::ScenePtr m_scene;
     };
     };
 
 
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 7 - 34
Gem/Code/Source/MultiSceneExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -69,6 +70,7 @@ namespace AtomSampleViewer
 
 
         // Create the RPI::Scene, add some feature processors
         // Create the RPI::Scene, add some feature processors
         RPI::SceneDescriptor sceneDesc;
         RPI::SceneDescriptor sceneDesc;
+        sceneDesc.m_nameId = AZ::Name("SecondScene");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimplePointLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimplePointLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimpleSpotLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimpleSpotLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::CapsuleLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::CapsuleLightFeatureProcessor");
@@ -82,34 +84,10 @@ namespace AtomSampleViewer
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::QuadLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::QuadLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("ReflectionProbeFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("ReflectionProbeFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SkyBoxFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SkyBoxFeatureProcessor");
-        sceneDesc.m_featureProcessorNames.push_back("AZ::Render::DiskLightFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::TransformServiceFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::TransformServiceFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::ProjectedShadowFeatureProcessor");
         sceneDesc.m_featureProcessorNames.push_back("AZ::Render::ProjectedShadowFeatureProcessor");
         m_scene = RPI::Scene::CreateScene(sceneDesc);
         m_scene = RPI::Scene::CreateScene(sceneDesc);
 
 
-        // Setup scene srg modification callback (to push per-frame values to the shaders)
-        RPI::ShaderResourceGroupCallback srgCallback = [this](RPI::ShaderResourceGroup* srg)
-        {
-            if (srg == nullptr)
-            {
-                return;
-            }
-
-            RHI::ShaderInputNameIndex timeIndex = "m_time";
-            RHI::ShaderInputNameIndex deltaTimeIndex = "m_deltaTime";
-
-            srg->SetConstant(timeIndex, aznumeric_cast<float>(m_simulateTime));
-            srg->SetConstant(deltaTimeIndex, m_deltaTime);
-
-            bool needCompile = timeIndex.IsValid() || deltaTimeIndex.IsValid();
-
-            if (needCompile)
-            {
-                srg->Compile();
-            }
-        };
-        m_scene->SetShaderResourceGroupCallback(srgCallback);
-
         // Link our RPI::Scene to the AzFramework::Scene
         // Link our RPI::Scene to the AzFramework::Scene
         m_frameworkScene->SetSubsystem(m_scene);
         m_frameworkScene->SetSubsystem(m_scene);
 
 
@@ -170,7 +148,7 @@ namespace AtomSampleViewer
                 m_shaderBallMeshHandles.push_back(LoadMesh(ShaderBallModelFilePath));
                 m_shaderBallMeshHandles.push_back(LoadMesh(ShaderBallModelFilePath));
                 auto updateShaderBallTransform = [this, i](Data::Instance<RPI::Model> model)
                 auto updateShaderBallTransform = [this, i](Data::Instance<RPI::Model> model)
                 {
                 {
-                    const Aabb& aabb = model->GetAabb();
+                    const Aabb& aabb = model->GetModelAsset()->GetAabb();
                     const Vector3 translation{ 0.0f, -aabb.GetMin().GetZ() * aznumeric_cast<float>(i), -aabb.GetMin().GetY() };
                     const Vector3 translation{ 0.0f, -aabb.GetMin().GetZ() * aznumeric_cast<float>(i), -aabb.GetMin().GetY() };
                     const auto transform = Transform::CreateTranslation(translation);
                     const auto transform = Transform::CreateTranslation(translation);
                     m_meshFeatureProcessor->SetTransform(m_shaderBallMeshHandles[i], transform);
                     m_meshFeatureProcessor->SetTransform(m_shaderBallMeshHandles[i], transform);
@@ -239,7 +217,6 @@ namespace AtomSampleViewer
             m_diskLightFeatureProcessor->SetShadowsEnabled(m_diskLightHandle, true);
             m_diskLightFeatureProcessor->SetShadowsEnabled(m_diskLightHandle, true);
             m_diskLightFeatureProcessor->SetShadowmapMaxResolution(m_diskLightHandle, Render::ShadowmapSize::Size512);
             m_diskLightFeatureProcessor->SetShadowmapMaxResolution(m_diskLightHandle, Render::ShadowmapSize::Size512);
             m_diskLightFeatureProcessor->SetConeAngles(m_diskLightHandle, DegToRad(22.5f), DegToRad(27.5f));
             m_diskLightFeatureProcessor->SetConeAngles(m_diskLightHandle, DegToRad(22.5f), DegToRad(27.5f));
-            m_diskLightFeatureProcessor->SetSofteningBoundaryWidthAngle(m_diskLightHandle, DegToRad(0.25f));
         }
         }
 
 
         // Create DirectionalLight
         // Create DirectionalLight
@@ -368,13 +345,10 @@ namespace AtomSampleViewer
     }
     }
 
 
     // AZ::TickBus::Handler overrides ...
     // AZ::TickBus::Handler overrides ...
-    void SecondWindowedScene::OnTick(float deltaTime, AZ::ScriptTimePoint timePoint)
+    void SecondWindowedScene::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint timePoint)
     {
     {
         using namespace AZ;
         using namespace AZ;
 
 
-        m_deltaTime = deltaTime;
-        m_simulateTime = timePoint.GetSeconds();
-
         // Move the camera a bit each frame
         // Move the camera a bit each frame
         // Note: view space in this scene is right-handed, Z-up, Y-forward
         // Note: view space in this scene is right-handed, Z-up, Y-forward
         const float dynamicOffsetScale = 4.0f;
         const float dynamicOffsetScale = 4.0f;
@@ -451,7 +425,6 @@ namespace AtomSampleViewer
     void MultiSceneExampleComponent::OnAllAssetsReadyActivate()
     void MultiSceneExampleComponent::OnAllAssetsReadyActivate()
     {
     {
         using namespace AZ;
         using namespace AZ;
-        RPI::ScenePtr scene = RPI::RPISystemInterface::Get()->GetDefaultScene();
 
 
         // Setup Main Mesh Entity
         // Setup Main Mesh Entity
         {
         {
@@ -467,7 +440,7 @@ namespace AtomSampleViewer
 
 
         // IBL
         // IBL
         {
         {
-            m_defaultIbl.Init(scene.get());
+            m_defaultIbl.Init(m_scene);
         }
         }
 
 
         if (SupportsMultipleWindows())
         if (SupportsMultipleWindows())

+ 3 - 4
Gem/Code/Source/MultiSceneExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -94,8 +95,6 @@ namespace AtomSampleViewer
         DirectionalLightHandle m_directionalLightHandle;
         DirectionalLightHandle m_directionalLightHandle;
         ReflectinoProbeHandle m_reflectionProbeHandle;
         ReflectinoProbeHandle m_reflectionProbeHandle;
 
 
-        double m_simulateTime = 0.0f;
-        float m_deltaTime = 0.0f;
         MultiSceneExampleComponent* m_parent = nullptr;
         MultiSceneExampleComponent* m_parent = nullptr;
         const AZ::Vector3 m_cameraOffset{ 0.0f, -4.0f, 2.0f };
         const AZ::Vector3 m_cameraOffset{ 0.0f, -4.0f, 2.0f };
         AZ::Vector3 m_dynamicCameraOffset{ 3.73f, 0.0f, 0.0f };
         AZ::Vector3 m_dynamicCameraOffset{ 3.73f, 0.0f, 0.0f };

+ 5 - 7
Gem/Code/Source/MultiViewSingleSceneAuxGeomExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -52,8 +53,6 @@ namespace AtomSampleViewer
         AZ::RPI::RenderPipelinePtr m_pipeline;
         AZ::RPI::RenderPipelinePtr m_pipeline;
         AZ::Entity* m_cameraEntity = nullptr;
         AZ::Entity* m_cameraEntity = nullptr;
         AZ::RPI::ViewPtr m_view;
         AZ::RPI::ViewPtr m_view;
-        double m_simulateTime = 0.0f;
-        float m_deltaTime = 0.0f;
         MultiViewSingleSceneAuxGeomExampleComponent* m_parent;
         MultiViewSingleSceneAuxGeomExampleComponent* m_parent;
 
 
     public:
     public:
@@ -69,7 +68,7 @@ namespace AtomSampleViewer
             m_windowContext = AZStd::make_shared<AZ::RPI::WindowContext>();
             m_windowContext = AZStd::make_shared<AZ::RPI::WindowContext>();
             m_windowContext->Initialize(*device, m_nativeWindow->GetWindowHandle());
             m_windowContext->Initialize(*device, m_nativeWindow->GetWindowHandle());
 
 
-            auto scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
+            auto scene = AZ::RPI::RPISystemInterface::Get()->GetSceneByName(AZ::Name("RPI"));
 
 
             // Create a custom pipeline descriptor
             // Create a custom pipeline descriptor
             AZ::RPI::RenderPipelineDescriptor pipelineDesc;
             AZ::RPI::RenderPipelineDescriptor pipelineDesc;
@@ -225,8 +224,7 @@ namespace AtomSampleViewer
 
 
     void MultiViewSingleSceneAuxGeomExampleComponent::DrawAuxGeom() const
     void MultiViewSingleSceneAuxGeomExampleComponent::DrawAuxGeom() const
     {
     {
-        auto scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
-        auto auxGeomFP = scene->GetFeatureProcessor<AZ::RPI::AuxGeomFeatureProcessorInterface>();
+        auto auxGeomFP = m_scene->GetFeatureProcessor<AZ::RPI::AuxGeomFeatureProcessorInterface>();
         if (auto auxGeom = auxGeomFP->GetDrawQueue())
         if (auto auxGeom = auxGeomFP->GetDrawQueue())
         {
         {
             DrawBackgroundBox(auxGeom);
             DrawBackgroundBox(auxGeom);

+ 3 - 2
Gem/Code/Source/MultiViewSingleSceneAuxGeomExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 5 - 7
Gem/Code/Source/ParallaxMappingExampleComponent.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -117,10 +118,9 @@ namespace AtomSampleViewer
         SetCameraConfiguration();
         SetCameraConfiguration();
 
 
         // Light
         // Light
-        AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
-        m_directionalLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
+        m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
         CreateDirectionalLight();
         CreateDirectionalLight();
-        m_diskLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
+        m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
         CreateDiskLight();
         CreateDiskLight();
 
 
         m_imguiSidebar.Activate();
         m_imguiSidebar.Activate();
@@ -171,8 +171,6 @@ namespace AtomSampleViewer
         m_directionalLightFeatureProcessor->SetShadowmapFrustumSplitSchemeRatio(handle, 0.5f);
         m_directionalLightFeatureProcessor->SetShadowmapFrustumSplitSchemeRatio(handle, 0.5f);
         m_directionalLightFeatureProcessor->SetViewFrustumCorrectionEnabled(handle, true);
         m_directionalLightFeatureProcessor->SetViewFrustumCorrectionEnabled(handle, true);
         m_directionalLightFeatureProcessor->SetShadowFilterMethod(handle, AZ::Render::ShadowFilterMethod::Esm);
         m_directionalLightFeatureProcessor->SetShadowFilterMethod(handle, AZ::Render::ShadowFilterMethod::Esm);
-        m_directionalLightFeatureProcessor->SetShadowBoundaryWidth(handle, 0.03f);
-        m_directionalLightFeatureProcessor->SetPredictionSampleCount(handle, 8);
         m_directionalLightFeatureProcessor->SetFilteringSampleCount(handle, 32);
         m_directionalLightFeatureProcessor->SetFilteringSampleCount(handle, 32);
         m_directionalLightFeatureProcessor->SetGroundHeight(handle, 0.f);
         m_directionalLightFeatureProcessor->SetGroundHeight(handle, 0.f);
 
 

+ 3 - 2
Gem/Code/Source/ParallaxMappingExampleComponent.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 4 - 8
Gem/Code/Source/Passes/RayTracingAmbientOcclusionPass.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -84,11 +85,7 @@ namespace AZ
             AZ_Assert(m_globalPipelineState, "Failed to acquire ray tracing global pipeline state");
             AZ_Assert(m_globalPipelineState, "Failed to acquire ray tracing global pipeline state");
 
 
             //Get pass srg
             //Get pass srg
-            auto srgAsset = m_rayGenerationShader->FindShaderResourceGroupAsset(Name{"RayTracingGlobalSrg"});
-            AZ_Error("RayTracingAmbientOcclusionPass", srgAsset.GetId().IsValid(), "Failed to find PassSrg asset for shader [%s]", rayGenerationShaderFilePath);
-            AZ_Error("RayTracingAmbientOcclusionPass", srgAsset.IsReady(), "RayTracingGlobalSrg asset is not loaded for shader [%s]", rayGenerationShaderFilePath);
-
-            m_shaderResourceGroup = RPI::ShaderResourceGroup::Create(srgAsset);
+            m_shaderResourceGroup = RPI::ShaderResourceGroup::Create(m_rayGenerationShader->GetAsset(), Name { "RayTracingGlobalSrg" });
             AZ_Assert(m_shaderResourceGroup, "[RayTracingAmbientOcclusionPass '%s']: Failed to create SRG from shader asset '%s'",
             AZ_Assert(m_shaderResourceGroup, "[RayTracingAmbientOcclusionPass '%s']: Failed to create SRG from shader asset '%s'",
                 GetPathName().GetCStr(), rayGenerationShaderFilePath);
                 GetPathName().GetCStr(), rayGenerationShaderFilePath);
                         
                         
@@ -161,7 +158,6 @@ namespace AZ
 
 
             // Bind others for global srg
             // Bind others for global srg
             const RHI::ShaderResourceGroupLayout* srgLayout = m_shaderResourceGroup->GetLayout();
             const RHI::ShaderResourceGroupLayout* srgLayout = m_shaderResourceGroup->GetLayout();
-            RHI::ShaderInputImageIndex imageIndex;
             RHI::ShaderInputBufferIndex bufferIndex;
             RHI::ShaderInputBufferIndex bufferIndex;
             RHI::ShaderInputConstantIndex constantIndex;
             RHI::ShaderInputConstantIndex constantIndex;
 
 

+ 5 - 4
Gem/Code/Source/Passes/RayTracingAmbientOcclusionPass.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -14,6 +15,7 @@
 #include <Atom/RHI/RayTracingShaderTable.h>
 #include <Atom/RHI/RayTracingShaderTable.h>
 #include <Atom/RPI.Public/RPIUtils.h>
 #include <Atom/RPI.Public/RPIUtils.h>
 #include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
 #include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
+#include <Atom/RPI.Public/Shader/Shader.h>
 
 
 #include <RayTracing/RayTracingFeatureProcessor.h>
 #include <RayTracing/RayTracingFeatureProcessor.h>
 
 
@@ -66,8 +68,7 @@ namespace AZ
             // ray tracing shader table
             // ray tracing shader table
             RHI::Ptr<RHI::RayTracingShaderTable> m_rayTracingShaderTable;
             RHI::Ptr<RHI::RayTracingShaderTable> m_rayTracingShaderTable;
 
 
-            // ray tracing global shader resource group asset and pipeline state
-            Data::Asset<RPI::ShaderResourceGroupAsset> m_globalSrgAsset;
+            // ray tracing global pipeline state
             RHI::ConstPtr<RHI::PipelineState> m_globalPipelineState;
             RHI::ConstPtr<RHI::PipelineState> m_globalPipelineState;
 
 
             Render::RayTracingFeatureProcessor* m_rayTracingFeatureProcessor = nullptr;
             Render::RayTracingFeatureProcessor* m_rayTracingFeatureProcessor = nullptr;

+ 3 - 2
Gem/Code/Source/Platform/Android/AtomSampleViewerOptions_Android.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/BakedShaderVariantExampleComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/EntityLatticeTestComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/MultiThreadComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/SSRExampleComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 9 - 3
Gem/Code/Source/Platform/Android/SampleComponentManager_Android.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -25,6 +26,11 @@ namespace AtomSampleViewer
 
 
     const char* SampleComponentManager::GetRootPassTemplateName()
     const char* SampleComponentManager::GetRootPassTemplateName()
     {
     {
-        return "MainPipeline_Mobile";
+        return "LowEndPipelineTemplate";
+    }
+
+    int SampleComponentManager::GetDefaultNumMSAASamples()
+    {
+        return 1;
     }
     }
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 3 - 2
Gem/Code/Source/Platform/Android/SceneReloadSoakTestComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/ScriptReporter_Android.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/StreamingImageExampleComponent_Android.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/TriangleConstantBufferExampleComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/Utils_Android.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Android/additional_android_runtime_library.cmake

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #

+ 3 - 2
Gem/Code/Source/Platform/Android/atomsampleviewer_android_files.cmake

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #

+ 3 - 2
Gem/Code/Source/Platform/Android/platform_android.cmake

@@ -1,6 +1,7 @@
 #
 #
-# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-# 
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 #
 #
 #
 #

+ 3 - 2
Gem/Code/Source/Platform/Linux/AtomSampleViewerOptions_Linux.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Linux/BakedShaderVariantExampleComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Linux/EntityLatticeTestComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Linux/MultiThreadComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 3 - 2
Gem/Code/Source/Platform/Linux/SSRExampleComponent_Traits_Platform.h

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */

+ 8 - 2
Gem/Code/Source/Platform/Linux/SampleComponentManager_Linux.cpp

@@ -1,6 +1,7 @@
 /*
 /*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- * 
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  * SPDX-License-Identifier: Apache-2.0 OR MIT
  *
  *
  */
  */
@@ -22,4 +23,9 @@ namespace AtomSampleViewer
     {
     {
         return "MainPipeline";
         return "MainPipeline";
     }
     }
+    
+    int SampleComponentManager::GetDefaultNumMSAASamples()
+    {
+        return 4;
+    }
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

Някои файлове не бяха показани, защото твърде много файлове са промени