Przeglądaj źródła

Update AtomSampleViewer to have a new 100K Draw 10K Entity performance sample (#341)

* Work in progress on the 100K draws tests

Signed-off-by: rgba16f <[email protected]>

* First working version of the 100KDraws test

Signed-off-by: rgba16f <[email protected]>

* Make the lights more visible in the 100KDraw test, and basic lighting visible in the 100KEntity test

Signed-off-by: rgba16f <[email protected]>

* Clamp EntityLattice parameters between 0 and PAL-ified max value

Signed-off-by: rgba16f <[email protected]>

* Remove debug pragma optimize calls

Signed-off-by: rgba16f <[email protected]>

* Update Gem/Code/Source/Performance/100KDraw10KEntityExampleComponent.h

Correct lattice size comment for the 100K Draw 10K Entites test.

Co-authored-by: santorac <[email protected]>
Signed-off-by: rgba16f <[email protected]>

* Update with PR feedback

Signed-off-by: rgba16f <[email protected]>

* Rename tests Entity -> Drawable, Added new test names to the automated perf tests.

Signed-off-by: rgba16f <[email protected]>

* Update comment style

Signed-off-by: rgba16f <[email protected]>

* Updated with PR feedback, removed the HighInstanceTest platform traits as they're no longer needed

Signed-off-by: rgba16f <[email protected]>

* Fix some missing component reflection

Signed-off-by: rgba16f <[email protected]>

* Add missing comma in the Automated periodic suite script

Signed-off-by: rgba16f <[email protected]>

Co-authored-by: santorac <[email protected]>
rgba16f 3 lat temu
rodzic
commit
ca52b4efe9
30 zmienionych plików z 838 dodań i 353 usunięć
  1. 4 3
      Gem/Code/Source/AtomSampleViewerSystemComponent.cpp
  2. 10 0
      Gem/Code/Source/CommonSampleComponentBase.cpp
  3. 127 125
      Gem/Code/Source/CommonSampleComponentBase.h
  4. 58 7
      Gem/Code/Source/EntityLatticeTestComponent.cpp
  5. 21 0
      Gem/Code/Source/EntityLatticeTestComponent.h
  6. 0 103
      Gem/Code/Source/HighInstanceExampleComponent.h
  7. 60 0
      Gem/Code/Source/Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.cpp
  8. 32 0
      Gem/Code/Source/Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.h
  9. 52 0
      Gem/Code/Source/Performance/100KDrawable_SingleView_ExampleComponent.cpp
  10. 31 0
      Gem/Code/Source/Performance/100KDrawable_SingleView_ExampleComponent.h
  11. 211 47
      Gem/Code/Source/Performance/HighInstanceExampleComponent.cpp
  12. 179 0
      Gem/Code/Source/Performance/HighInstanceExampleComponent.h
  13. 5 0
      Gem/Code/Source/Platform/Android/EntityLatticeTestComponent_Traits_Platform.h
  14. 0 11
      Gem/Code/Source/Platform/Android/HighInstanceTestComponent_Traits_Platform.h
  15. 0 1
      Gem/Code/Source/Platform/Android/atomsampleviewer_android_files.cmake
  16. 6 1
      Gem/Code/Source/Platform/Linux/EntityLatticeTestComponent_Traits_Platform.h
  17. 0 11
      Gem/Code/Source/Platform/Linux/HighInstanceTestComponent_Traits_Platform.h
  18. 0 1
      Gem/Code/Source/Platform/Linux/atomsampleviewer_linux_files.cmake
  19. 6 1
      Gem/Code/Source/Platform/Mac/EntityLatticeTestComponent_Traits_Platform.h
  20. 0 11
      Gem/Code/Source/Platform/Mac/HighInstanceTestComponent_Traits_Platform.h
  21. 0 1
      Gem/Code/Source/Platform/Mac/atomsampleviewer_mac_files.cmake
  22. 6 1
      Gem/Code/Source/Platform/Windows/EntityLatticeTestComponent_Traits_Platform.h
  23. 0 11
      Gem/Code/Source/Platform/Windows/HighInstanceTestComponent_Traits_Platform.h
  24. 0 1
      Gem/Code/Source/Platform/Windows/atomsampleviewer_windows_files.cmake
  25. 5 0
      Gem/Code/Source/Platform/iOS/EntityLatticeTestComponent_Traits_Platform.h
  26. 0 11
      Gem/Code/Source/Platform/iOS/HighInstanceTestComponent_Traits_Platform.h
  27. 0 1
      Gem/Code/Source/Platform/iOS/atomsampleviewer_ios_files.cmake
  28. 17 2
      Gem/Code/Source/SampleComponentManager.cpp
  29. 6 2
      Gem/Code/atomsampleviewergem_private_files.cmake
  30. 2 1
      Scripts/_AutomatedPeriodicBenchmarkSuite_.bv.lua

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

@@ -59,6 +59,10 @@ namespace AtomSampleViewer
         StacksShaderInputFunctor::Reflect(context);
         StacksShaderInputFunctor::Reflect(context);
 
 
         ImageComparisonConfig::Reflect(context);
         ImageComparisonConfig::Reflect(context);
+
+        // Abstract base components is used by multiple components and needs to be reflected in a single location.
+        CommonSampleComponentBase::Reflect(context);
+        EntityLatticeTestComponent::Reflect(context);
     }
     }
 
 
     void AtomSampleViewerSystemComponent::PerfMetrics::Reflect(AZ::ReflectContext* context)
     void AtomSampleViewerSystemComponent::PerfMetrics::Reflect(AZ::ReflectContext* context)
@@ -72,9 +76,6 @@ namespace AtomSampleViewer
                 ->Field("SecondsToRender", &PerfMetrics::m_timeToFirstRenderSeconds)
                 ->Field("SecondsToRender", &PerfMetrics::m_timeToFirstRenderSeconds)
                 ;
                 ;
         }
         }
-
-        // Abstract base component is used by multiple components and needs to be reflected in a single location.
-        EntityLatticeTestComponent::Reflect(context);
     }
     }
 
 
 
 

+ 10 - 0
Gem/Code/Source/CommonSampleComponentBase.cpp

@@ -21,6 +21,16 @@ namespace AtomSampleViewer
     using namespace AZ;
     using namespace AZ;
     using namespace RPI;
     using namespace RPI;
 
 
+    void CommonSampleComponentBase::Reflect(ReflectContext* context)
+    {
+        if (SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context))
+        {
+            serializeContext->Class<CommonSampleComponentBase, Component>()
+                ->Version(0)
+                ;
+        }
+    }
+
     bool CommonSampleComponentBase::ReadInConfig(const ComponentConfig* baseConfig)
     bool CommonSampleComponentBase::ReadInConfig(const ComponentConfig* baseConfig)
     {
     {
         m_scene = RPI::RPISystemInterface::Get()->GetSceneByName(AZ::Name("RPI"));
         m_scene = RPI::RPISystemInterface::Get()->GetSceneByName(AZ::Name("RPI"));

+ 127 - 125
Gem/Code/Source/CommonSampleComponentBase.h

@@ -1,125 +1,127 @@
-/*
- * 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
- *
- */
-
-#pragma once
-
-#include <AzCore/Component/Component.h>
-#include <AzCore/Component/TransformBus.h>
-#include <AzCore/Component/EntityBus.h>
-#include <AzFramework/Entity/EntityContextBus.h>
-#include <Atom/Feature/Mesh/MeshFeatureProcessorInterface.h>
-#include <Atom/Feature/Utils/LightingPreset.h>
-#include <Atom/Feature/SkyBox/SkyBoxFeatureProcessorInterface.h>
-#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
-#include <Atom/Feature/ImageBasedLights/ImageBasedLightFeatureProcessorInterface.h>
-#include <Atom/Feature/CoreLights/DirectionalLightFeatureProcessorInterface.h>
-#include <Atom/Utils/AssetCollectionAsyncLoader.h>
-
-#include <Utils/ImGuiProgressList.h>
-
-namespace AtomSampleViewer
-{
-    class CommonSampleComponentBase
-        : public AZ::Component
-        , public AZ::TransformNotificationBus::MultiHandler
-        , public AZ::EntityBus::MultiHandler
-    {
-    public:
-        AZ_TYPE_INFO(MaterialHotReloadTestComponent, "{7EECDF09-B774-46C1-AD6E-060CE5717C05}");
-
-        // AZ::Component overrides...
-        bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
-
-    protected:
-        //! Init and shut down should be called in derived components' Activate() and Deactivate().
-        //! @param loadDefaultLightingPresets if true, it will scan all lighting presets in the project and load them.
-        void InitLightingPresets(bool loadDefaultLightingPresets = false);
-        void ShutdownLightingPresets();
-
-        //! Add a drop down list to select lighting preset for this sample.
-        //! Lighting presets must be loaded before calling this function, otherwise the list will be hide.
-        //! It should be called between ImGui::Begin() and ImGui::End().
-        //! e.g. Calling it between ImGuiSidebar::Begin() and ImGuiSidebar::End() will embed this list into the side bar.
-        void ImGuiLightingPreset();
-
-        //! Load lighting presets from an asset.
-        //! It will clear any presets loaded previously.
-        void LoadLightingPresetsFromAsset(const AZStd::string& assetPath);
-
-        //! Load lighting presets from an asset.
-        //! Append the presets to the current existing presets.
-        void AppendLightingPresetsFromAsset(const AZStd::string& assetPath);
-
-        //! Clear all lighting presets.
-        void ClearLightingPresets();
-
-        //! Reset internal scene related data
-        void ResetScene();
-
-        //! Apply lighting presets to the scene.
-        //! Derived samples can override this function to have custom behaviors.
-        virtual void OnLightingPresetSelected(const AZ::Render::LightingPreset& preset, bool useAltSkybox);
-
-        //! Return the AtomSampleViewer EntityContextId, retrieved from the ComponentConfig
-        AzFramework::EntityContextId GetEntityContextId() const;
-
-        //! Return the AtomSampleViewer camera EntityId, retrieved from the ComponentConfig
-        AZ::EntityId GetCameraEntityId() const;
-
-        AZ::Render::MeshFeatureProcessorInterface* GetMeshFeatureProcessor() const;
-
-        void OnLightingPresetEntityShutdown(const AZ::EntityId& entityId);
-
-        // Preload assets 
-        void PreloadAssets(const AZStd::vector<AZ::AssetCollectionAsyncLoader::AssetToLoadInfo>& assetList);
-
-        //! Async asset load
-        AZ::AssetCollectionAsyncLoader m_assetLoadManager;
-
-        //! Showing the loading progress of preload assets
-        ImGuiProgressList m_imguiProgressList;
-
-        // The callback might be called more than one time if there are more than one asset are ready in one frame.
-        // Use this flag to prevent OnAllAssetsReadyActivate be called more than one time.
-        bool m_isAllAssetsReady = false;
-
-        AZStd::string m_sampleName;
-
-        AZ::RPI::Scene* m_scene = nullptr;
-
-    private:
-        // AZ::TransformNotificationBus::MultiHandler overrides...
-        void OnTransformChanged(const AZ::Transform&, const AZ::Transform&) override;
-
-        // virtual call back function which is called when all preloaded assets are loaded.
-        virtual void OnAllAssetsReadyActivate() {};
-
-        AzFramework::EntityContextId m_entityContextId;
-        AZ::EntityId m_cameraEntityId;
-        mutable AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr;
-
-        //! All loaded lighting presets.
-        AZStd::vector<AZ::Render::LightingPreset> m_lightingPresets;
-
-        //! Lights created by lighting presets.
-        AZStd::vector<AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle> m_lightHandles;
-
-        //! Post process entity to handle ExposureControlSettings.
-        AZ::Entity* m_postProcessEntity = nullptr;
-
-        //! Dirty flag is set to true when m_lightingPresets is modified.
-        bool m_lightingPresetsDirty = true;
-
-        //! Current active lighting preset.
-        constexpr static int32_t InvalidLightingPresetIndex = -1;
-        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.
-
-    };
-
-} // namespace AtomSampleViewer
+/*
+ * 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
+ *
+ */
+
+#pragma once
+
+#include <AzCore/Component/Component.h>
+#include <AzCore/Component/TransformBus.h>
+#include <AzCore/Component/EntityBus.h>
+#include <AzFramework/Entity/EntityContextBus.h>
+#include <Atom/Feature/Mesh/MeshFeatureProcessorInterface.h>
+#include <Atom/Feature/Utils/LightingPreset.h>
+#include <Atom/Feature/SkyBox/SkyBoxFeatureProcessorInterface.h>
+#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
+#include <Atom/Feature/ImageBasedLights/ImageBasedLightFeatureProcessorInterface.h>
+#include <Atom/Feature/CoreLights/DirectionalLightFeatureProcessorInterface.h>
+#include <Atom/Utils/AssetCollectionAsyncLoader.h>
+
+#include <Utils/ImGuiProgressList.h>
+
+namespace AtomSampleViewer
+{
+    class CommonSampleComponentBase
+        : public AZ::Component
+        , public AZ::TransformNotificationBus::MultiHandler
+        , public AZ::EntityBus::MultiHandler
+    {
+    public:
+        AZ_TYPE_INFO(CommonSampleComponentBase, "{7EECDF09-B774-46C1-AD6E-060CE5717C05}");
+
+        static void Reflect(AZ::ReflectContext* context);
+
+        // AZ::Component overrides...
+        bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
+
+    protected:
+        //! Init and shut down should be called in derived components' Activate() and Deactivate().
+        //! @param loadDefaultLightingPresets if true, it will scan all lighting presets in the project and load them.
+        void InitLightingPresets(bool loadDefaultLightingPresets = false);
+        void ShutdownLightingPresets();
+
+        //! Add a drop down list to select lighting preset for this sample.
+        //! Lighting presets must be loaded before calling this function, otherwise the list will be hide.
+        //! It should be called between ImGui::Begin() and ImGui::End().
+        //! e.g. Calling it between ImGuiSidebar::Begin() and ImGuiSidebar::End() will embed this list into the side bar.
+        void ImGuiLightingPreset();
+
+        //! Load lighting presets from an asset.
+        //! It will clear any presets loaded previously.
+        void LoadLightingPresetsFromAsset(const AZStd::string& assetPath);
+
+        //! Load lighting presets from an asset.
+        //! Append the presets to the current existing presets.
+        void AppendLightingPresetsFromAsset(const AZStd::string& assetPath);
+
+        //! Clear all lighting presets.
+        void ClearLightingPresets();
+
+        //! Reset internal scene related data
+        void ResetScene();
+
+        //! Apply lighting presets to the scene.
+        //! Derived samples can override this function to have custom behaviors.
+        virtual void OnLightingPresetSelected(const AZ::Render::LightingPreset& preset, bool useAltSkybox);
+
+        //! Return the AtomSampleViewer EntityContextId, retrieved from the ComponentConfig
+        AzFramework::EntityContextId GetEntityContextId() const;
+
+        //! Return the AtomSampleViewer camera EntityId, retrieved from the ComponentConfig
+        AZ::EntityId GetCameraEntityId() const;
+
+        AZ::Render::MeshFeatureProcessorInterface* GetMeshFeatureProcessor() const;
+
+        void OnLightingPresetEntityShutdown(const AZ::EntityId& entityId);
+
+        // Preload assets 
+        void PreloadAssets(const AZStd::vector<AZ::AssetCollectionAsyncLoader::AssetToLoadInfo>& assetList);
+
+        //! Async asset load
+        AZ::AssetCollectionAsyncLoader m_assetLoadManager;
+
+        //! Showing the loading progress of preload assets
+        ImGuiProgressList m_imguiProgressList;
+
+        // The callback might be called more than one time if there are more than one asset are ready in one frame.
+        // Use this flag to prevent OnAllAssetsReadyActivate be called more than one time.
+        bool m_isAllAssetsReady = false;
+
+        AZStd::string m_sampleName;
+
+        AZ::RPI::Scene* m_scene = nullptr;
+
+    private:
+        // AZ::TransformNotificationBus::MultiHandler overrides...
+        void OnTransformChanged(const AZ::Transform&, const AZ::Transform&) override;
+
+        // virtual call back function which is called when all preloaded assets are loaded.
+        virtual void OnAllAssetsReadyActivate() {};
+
+        AzFramework::EntityContextId m_entityContextId;
+        AZ::EntityId m_cameraEntityId;
+        mutable AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr;
+
+        //! All loaded lighting presets.
+        AZStd::vector<AZ::Render::LightingPreset> m_lightingPresets;
+
+        //! Lights created by lighting presets.
+        AZStd::vector<AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle> m_lightHandles;
+
+        //! Post process entity to handle ExposureControlSettings.
+        AZ::Entity* m_postProcessEntity = nullptr;
+
+        //! Dirty flag is set to true when m_lightingPresets is modified.
+        bool m_lightingPresetsDirty = true;
+
+        //! Current active lighting preset.
+        constexpr static int32_t InvalidLightingPresetIndex = -1;
+        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.
+
+    };
+
+} // namespace AtomSampleViewer

+ 58 - 7
Gem/Code/Source/EntityLatticeTestComponent.cpp

@@ -27,6 +27,8 @@ namespace AtomSampleViewer
     using namespace RPI;
     using namespace RPI;
 
 
     constexpr int32_t s_latticeSizeMax = ENTITY_LATTEST_TEST_COMPONENT_MAX;
     constexpr int32_t s_latticeSizeMax = ENTITY_LATTEST_TEST_COMPONENT_MAX;
+    constexpr float s_spacingMax = ENTITY_LATTEST_TEST_COMPONENT_SPACING_MAX;
+    constexpr float s_entityScaleMax = ENTITY_LATTEST_TEST_COMPONENT_ENTITY_SCALE_MAX;
 
 
     void EntityLatticeTestComponent::Reflect(ReflectContext* context)
     void EntityLatticeTestComponent::Reflect(ReflectContext* context)
     {
     {
@@ -68,8 +70,8 @@ namespace AtomSampleViewer
         // We first rotate the model by 180 degrees before translating it. This is to make it face the camera as it did
         // We first rotate the model by 180 degrees before translating it. This is to make it face the camera as it did
         // when the world was Y-up.
         // when the world was Y-up.
         Transform transform = Transform::CreateRotationZ(Constants::Pi);
         Transform transform = Transform::CreateRotationZ(Constants::Pi);
+        m_worldAabb = AZ::Aabb::CreateNull();
 
 
-        static Vector3 distance(5.0f, 5.0f, 5.0f);
         for (int32_t x = 0; x < m_latticeWidth; ++x)
         for (int32_t x = 0; x < m_latticeWidth; ++x)
         {
         {
             for (int32_t y = 0; y < m_latticeDepth; ++y)
             for (int32_t y = 0; y < m_latticeDepth; ++y)
@@ -77,12 +79,14 @@ namespace AtomSampleViewer
                 for (int32_t z = 0; z < m_latticeHeight; ++z)
                 for (int32_t z = 0; z < m_latticeHeight; ++z)
                 {
                 {
                     Vector3 position(
                     Vector3 position(
-                        static_cast<float>(x) * distance.GetX(),
-                        static_cast<float>(y) * distance.GetY(),
-                        static_cast<float>(z) * distance.GetZ());
+                        static_cast<float>(x) * m_spacingX,
+                        static_cast<float>(y) * m_spacingY,
+                        static_cast<float>(z) * m_spacingZ);
 
 
                     transform.SetTranslation(position);
                     transform.SetTranslation(position);
+                    transform.SetUniformScale(m_entityScale);
                     CreateLatticeInstance(transform);
                     CreateLatticeInstance(transform);
+                    m_worldAabb.AddPoint(transform.GetTranslation());
                 }
                 }
             }
             }
         }
         }
@@ -94,11 +98,33 @@ namespace AtomSampleViewer
         return m_latticeWidth * m_latticeHeight * m_latticeDepth;
         return m_latticeWidth * m_latticeHeight * m_latticeDepth;
     }
     }
 
 
+    AZ::Aabb EntityLatticeTestComponent::GetLatticeAabb() const
+    {
+        return m_worldAabb;
+    }
+
     void EntityLatticeTestComponent::SetLatticeDimensions(uint32_t width, uint32_t depth, uint32_t height)
     void EntityLatticeTestComponent::SetLatticeDimensions(uint32_t width, uint32_t depth, uint32_t height)
     {
     {
-        m_latticeWidth = GetClamp<int32_t>(width, 1, s_latticeSizeMax);
-        m_latticeHeight = GetClamp<int32_t>(height, 1, s_latticeSizeMax);
-        m_latticeDepth = GetClamp<int32_t>(depth, 1, s_latticeSizeMax);
+        m_latticeWidth  = AZ::GetClamp<int32_t>(width, 1, s_latticeSizeMax);
+        m_latticeHeight = AZ::GetClamp<int32_t>(height, 1, s_latticeSizeMax);
+        m_latticeDepth  = AZ::GetClamp<int32_t>(depth, 1, s_latticeSizeMax);
+    }
+
+    void EntityLatticeTestComponent::SetLatticeSpacing( float spaceX, float spaceY, float spaceZ)
+    {
+        m_spacingX = AZ::GetClamp<float>(spaceX, 0.0f, s_spacingMax);
+        m_spacingY = AZ::GetClamp<float>(spaceY, 0.0f, s_spacingMax);
+        m_spacingZ = AZ::GetClamp<float>(spaceZ, 0.0f, s_spacingMax);
+    }
+
+    void EntityLatticeTestComponent::SetLatticeEntityScale(float scale)
+    {
+        m_entityScale = AZ::GetClamp<float>(scale, 0.0f, s_entityScaleMax);
+    }
+
+    void EntityLatticeTestComponent::SetIBLExposure(float exposure)
+    {
+        m_defaultIbl.SetExposure(exposure);
     }
     }
 
 
     void EntityLatticeTestComponent::RenderImGuiLatticeControls()
     void EntityLatticeTestComponent::RenderImGuiLatticeControls()
@@ -118,6 +144,31 @@ namespace AtomSampleViewer
         ImGui::Text("Lattice Depth");
         ImGui::Text("Lattice Depth");
         latticeChanged |= ScriptableImGui::SliderInt("##LatticeDepth", &m_latticeDepth, 1, s_latticeSizeMax);
         latticeChanged |= ScriptableImGui::SliderInt("##LatticeDepth", &m_latticeDepth, 1, s_latticeSizeMax);
 
 
+        ImGui::Spacing();
+        ImGui::Separator();
+        ImGui::Spacing();
+
+        ImGui::Text("Lattice Spacing X");
+        latticeChanged |= ScriptableImGui::SliderFloat("##LatticeSpaceX", &m_spacingX, 0.5, s_spacingMax);
+
+        ImGui::Spacing();
+
+        ImGui::Text("Lattice Spacing Y");
+        latticeChanged |= ScriptableImGui::SliderFloat("##LatticeSpaceY", &m_spacingY, 0.5, s_spacingMax);
+
+        ImGui::Spacing();
+
+        ImGui::Text("Lattice Spacing Z");
+        latticeChanged |= ScriptableImGui::SliderFloat("##LatticeSpaceZ", &m_spacingZ, 0.5, s_spacingMax);
+
+        ImGui::Spacing();
+        ImGui::Separator();
+        ImGui::Spacing();
+
+        ImGui::Text("Entity Scale");
+        latticeChanged |= ScriptableImGui::SliderFloat("##EntityScale", &m_entityScale, 0.01, s_entityScaleMax);
+
+
         if (latticeChanged)
         if (latticeChanged)
         {
         {
             RebuildLattice();
             RebuildLattice();

+ 21 - 0
Gem/Code/Source/EntityLatticeTestComponent.h

@@ -12,6 +12,8 @@
 #include <Utils/Utils.h>
 #include <Utils/Utils.h>
 #include <EntityLatticeTestComponent_Traits_Platform.h>
 #include <EntityLatticeTestComponent_Traits_Platform.h>
 
 
+#include <AzCore/Math/Aabb.h>
+
 struct ImGuiContext;
 struct ImGuiContext;
 
 
 namespace AtomSampleViewer
 namespace AtomSampleViewer
@@ -34,6 +36,10 @@ namespace AtomSampleViewer
         //! Returns total number of instances (width * height * depth)
         //! Returns total number of instances (width * height * depth)
         uint32_t GetInstanceCount() const;
         uint32_t GetInstanceCount() const;
         
         
+        //! Returns world space Aabb for the lattice.
+        //! The returned Aabb contains all the entity lattice positions. It does not include the mesh Aabb at each position.
+        AZ::Aabb GetLatticeAabb() const;
+
         //! Call this to render ImGui controls for controlling the size of the lattice.
         //! Call this to render ImGui controls for controlling the size of the lattice.
         void RenderImGuiLatticeControls();
         void RenderImGuiLatticeControls();
         
         
@@ -41,6 +47,10 @@ namespace AtomSampleViewer
         virtual void RebuildLattice();
         virtual void RebuildLattice();
 
 
         void SetLatticeDimensions(uint32_t width, uint32_t depth, uint32_t height);
         void SetLatticeDimensions(uint32_t width, uint32_t depth, uint32_t height);
+        void SetLatticeSpacing(float spaceX, float spaceY, float spaceZ);
+        void SetLatticeEntityScale(float scale);
+
+        void SetIBLExposure(float exposure);
 
 
     private:
     private:
 
 
@@ -59,10 +69,21 @@ namespace AtomSampleViewer
 
 
         void BuildLattice();
         void BuildLattice();
 
 
+    protected:
+        //! Contains the world space Aabb of the lattice positions. Doesn't include the mesh Aabb at each position.
+        AZ::Aabb m_worldAabb;
+
+    private:
         // These are signed to avoid casting with imgui controls.
         // These are signed to avoid casting with imgui controls.
         int32_t m_latticeWidth = ENTITY_LATTICE_TEST_COMPONENT_WIDTH;
         int32_t m_latticeWidth = ENTITY_LATTICE_TEST_COMPONENT_WIDTH;
         int32_t m_latticeHeight = ENTITY_LATTICE_TEST_COMPONENT_HEIGHT;
         int32_t m_latticeHeight = ENTITY_LATTICE_TEST_COMPONENT_HEIGHT;
         int32_t m_latticeDepth = ENTITY_LATTICE_TEST_COMPONENT_DEPTH;
         int32_t m_latticeDepth = ENTITY_LATTICE_TEST_COMPONENT_DEPTH;
+
+        float m_spacingX = ENTITY_LATTICE_TEST_COMPONENT_SPACING_X;
+        float m_spacingY = ENTITY_LATTICE_TEST_COMPONENT_SPACING_Y;
+        float m_spacingZ = ENTITY_LATTICE_TEST_COMPONENT_SPACING_Z;
+
+        float m_entityScale = 1.0f;
         
         
         Utils::DefaultIBL m_defaultIbl;
         Utils::DefaultIBL m_defaultIbl;
     };
     };

+ 0 - 103
Gem/Code/Source/HighInstanceExampleComponent.h

@@ -1,103 +0,0 @@
-/*
- * 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
- *
- */
-
-#pragma once
-
-#include <EntityLatticeTestComponent.h>
-#include <Utils/ImGuiSidebar.h>
-#include <Utils/ImGuiAssetBrowser.h>
-#include <AzCore/Component/TickBus.h>
-
-namespace AtomSampleViewer
-{
-    /*
-        This test loads a 22x22x22 lattice of entities with randomized meshes and materials. This test is used as a simple cpu performance stress test for Atom.
-
-        The assets that are applied to the entities are chosen from the 
-        "allow-list" of models and materials.
-    */
-    class HighInstanceTestComponent final
-        : public EntityLatticeTestComponent
-        , public AZ::TickBus::Handler
-    {
-        using Base = EntityLatticeTestComponent;
-
-    public:
-        AZ_COMPONENT(HighInstanceTestComponent, "{DAA2B63B-7CC0-4696-A44F-49E53C6390B9}", EntityLatticeTestComponent);
-
-        static void Reflect(AZ::ReflectContext* context);
-
-        HighInstanceTestComponent();
-        
-        //! AZ::Component overrides...
-        void Activate() override;
-        void Deactivate() override;
-
-    private:
-        AZ_DISABLE_COPY_MOVE(HighInstanceTestComponent);
-
-        // CommonSampleComponentBase overrides...
-        void OnAllAssetsReadyActivate() override;
-
-        //! EntityLatticeTestComponent overrides...
-        void PrepareCreateLatticeInstances(uint32_t instanceCount) override;
-        void CreateLatticeInstance(const AZ::Transform& transform) override;
-        void FinalizeLatticeInstances() override;
-        void DestroyLatticeInstances() override;
-
-        void DestroyHandles();
-
-        AZ::Data::AssetId GetRandomModelId() const;
-        AZ::Data::AssetId GetRandomMaterialId() const;
-
-        void OnTick(float deltaTime, AZ::ScriptTimePoint scriptTime) override;
-
-        void ResetNoClipController();
-        void SaveCameraConfiguration();
-        void RestoreCameraConfiguration();
-        
-        struct ModelInstanceData
-        {
-            AZ::Transform m_transform;
-            AZ::Data::AssetId m_modelAssetId;
-            AZ::Data::AssetId m_materialAssetId;
-            AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
-        };
-
-        ImGuiSidebar m_imguiSidebar;
-        ImGuiAssetBrowser m_materialBrowser;
-        ImGuiAssetBrowser m_modelBrowser;
-        
-        AZStd::vector<ModelInstanceData> m_modelInstanceData;
-
-        struct Compare
-        {
-            bool operator()(const AZ::Data::Asset<AZ::RPI::MaterialAsset>& lhs, const AZ::Data::Asset<AZ::RPI::MaterialAsset>& rhs) const
-            {
-                if (lhs.GetId().m_guid == rhs.GetId().m_guid)
-                {
-                    return lhs.GetId().m_subId > rhs.GetId().m_subId;
-                }
-                return lhs.GetId().m_guid > rhs.GetId().m_guid;
-            }
-        };
-
-        using MaterialAssetSet = AZStd::set<AZ::Data::Asset<AZ::RPI::MaterialAsset>, Compare>;
-        MaterialAssetSet m_cachedMaterials;
-        uint32_t m_pinnedMaterialCount = 0;
-        uint32_t m_preActivateVSyncInterval = 0;
-        
-        AZStd::vector<AZStd::string> m_expandedModelList; // has models that are more expensive on the gpu
-        AZStd::vector<AZStd::string> m_simpleModelList; // Aims to keep the test cpu bottlenecked by using trivial geometry such as a cube
-        size_t m_lastPinnedModelCount = 0;
-
-        float m_originalFarClipDistance;
-        bool m_updateTransformEnabled = false;
-        bool m_useSimpleModels = true;
-    };
-} // namespace AtomSampleViewer

+ 60 - 0
Gem/Code/Source/Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.cpp

@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
+ */
+
+#include <Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.h>
+#include <SampleComponentManager.h>
+#include <SampleComponentConfig.h>
+
+#include <AzCore/Serialization/SerializeContext.h>
+
+AZ_DECLARE_BUDGET(AtomSampleViewer);
+
+namespace AtomSampleViewer
+{
+    using namespace AZ;
+
+    void _100KDraw10KDrawableExampleComponent::Reflect(AZ::ReflectContext* context)
+    {
+        Base::Reflect(context);
+        if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
+        {
+            serializeContext->Class<_100KDraw10KDrawableExampleComponent, HighInstanceTestComponent>()
+                ->Version(0)
+                ;
+        }
+    }
+
+
+    _100KDraw10KDrawableExampleComponent::_100KDraw10KDrawableExampleComponent() 
+    {
+        m_sampleName = "100KDraw10KEntityTest";
+
+        for (int index = 0; index < 3; ++index)
+        {
+            m_testParameters.m_latticeSize[index] = 22;
+            m_testParameters.m_latticeSpacing[index] = 3.0f;
+        }
+        m_testParameters.m_numShadowCastingSpotLights = 7;
+        m_testParameters.m_shadowSpotlightInnerAngleDeg = 30.0f;
+        m_testParameters.m_shadowSpotlightOuterAngleDeg = 30.0f;
+        m_testParameters.m_shadowSpotlightMaxDistance = 200.0f;
+        m_testParameters.m_shadowSpotlightIntensity = 50000.f;
+
+        m_testParameters.m_activateDirectionalLight = true;
+        m_testParameters.m_directionalLightIntensity = 5.0f;
+
+        m_testParameters.m_cameraPosition[0] = -81.0f;
+        m_testParameters.m_cameraPosition[1] = 31.0f;
+        m_testParameters.m_cameraPosition[2] = 32.0f;
+        m_testParameters.m_cameraHeadingDeg = -90.0f;
+        m_testParameters.m_cameraPitchDeg = 0.0f;
+        m_testParameters.m_iblExposure = -10.0f;
+    }
+
+    
+} // namespace AtomSampleViewer

+ 32 - 0
Gem/Code/Source/Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.h

@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
+ */
+
+#pragma once
+
+#include <Performance/HighInstanceExampleComponent.h>
+
+namespace AtomSampleViewer
+{
+    //! This test loads a 22x22x22 (~10K) lattice of cubes with a white material, shadowed lights are added to the scene until 100K draws are required. 
+    //! This test benchmarks how well atom scales cpu time with the number of draws. 
+    class _100KDraw10KDrawableExampleComponent
+        : public HighInstanceTestComponent
+    {
+        using Base = HighInstanceTestComponent;
+
+    public:
+        AZ_COMPONENT(_100KDraw10KDrawableExampleComponent, "{85C4BEE0-9FBC-4E9A-8425-12555703CC61}", HighInstanceTestComponent);
+
+        static void Reflect(AZ::ReflectContext* context);
+
+        _100KDraw10KDrawableExampleComponent();
+
+    private:
+        AZ_DISABLE_COPY_MOVE(_100KDraw10KDrawableExampleComponent);
+    };
+} // namespace AtomSampleViewer

+ 52 - 0
Gem/Code/Source/Performance/100KDrawable_SingleView_ExampleComponent.cpp

@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
+ */
+
+#include <Performance/100KDrawable_SingleView_ExampleComponent.h>
+#include <SampleComponentManager.h>
+#include <SampleComponentConfig.h>
+
+#include <AzCore/Serialization/SerializeContext.h>
+
+AZ_DECLARE_BUDGET(AtomSampleViewer);
+
+namespace AtomSampleViewer
+{
+    using namespace AZ;
+
+    void _100KDrawableExampleComponent::Reflect(AZ::ReflectContext* context)
+    {
+        if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
+        {
+            serializeContext->Class<_100KDrawableExampleComponent, HighInstanceTestComponent>()
+                ->Version(0)
+                ;
+        }
+    }
+
+
+    _100KDrawableExampleComponent::_100KDrawableExampleComponent() 
+    {
+        m_sampleName = "100KEntityTest";
+
+        for (int index = 0; index < 3; ++index)
+        {
+            m_testParameters.m_latticeSize[index] = 46;
+            m_testParameters.m_latticeSpacing[index] = 3.0f;
+        }
+        m_testParameters.m_numShadowCastingSpotLights = 0;
+        m_testParameters.m_activateDirectionalLight = false;
+
+        m_testParameters.m_cameraPosition[0] = -173.0f;
+        m_testParameters.m_cameraPosition[1] = 66.0f;
+        m_testParameters.m_cameraPosition[2] = 68.0f;
+        m_testParameters.m_cameraHeadingDeg = -90.0f;
+        m_testParameters.m_cameraPitchDeg = 0.0f;
+        m_testParameters.m_iblExposure = 0.0f;
+    }
+    
+} // namespace AtomSampleViewer

+ 31 - 0
Gem/Code/Source/Performance/100KDrawable_SingleView_ExampleComponent.h

@@ -0,0 +1,31 @@
+/*
+ * 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
+ *
+ */
+
+#pragma once
+
+#include <Performance/HighInstanceExampleComponent.h>
+
+namespace AtomSampleViewer
+{
+    //! This test loads a 46x46x46 lattice of cubes with a white material. This test is used as a simple cpu performance stress test for Atom.
+    class _100KDrawableExampleComponent
+        : public HighInstanceTestComponent
+    {
+        using Base = HighInstanceTestComponent;
+
+    public:
+        AZ_COMPONENT(_100KDrawableExampleComponent, "{A373EDC7-399F-49BB-A3A9-D81FA7E05E60}", HighInstanceTestComponent);
+
+        static void Reflect(AZ::ReflectContext* context);
+
+        _100KDrawableExampleComponent();
+
+    private:
+        AZ_DISABLE_COPY_MOVE(_100KDrawableExampleComponent);
+    };
+} // namespace AtomSampleViewer

+ 211 - 47
Gem/Code/Source/HighInstanceExampleComponent.cpp → Gem/Code/Source/Performance/HighInstanceExampleComponent.cpp

@@ -6,7 +6,7 @@
  *
  *
  */
  */
 
 
-#include <HighInstanceExampleComponent.h>
+#include <Performance/HighInstanceExampleComponent.h>
 #include <SampleComponentManager.h>
 #include <SampleComponentManager.h>
 #include <SampleComponentConfig.h>
 #include <SampleComponentConfig.h>
 
 
@@ -15,6 +15,8 @@
 #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/Asset/AssetUtils.h>
 #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
+#include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
+#include <Atom/RPI.Public/AuxGeom/AuxGeomDraw.h>
 
 
 #include <Automation/ScriptRunnerBus.h>
 #include <Automation/ScriptRunnerBus.h>
 
 
@@ -23,8 +25,6 @@
 
 
 #include <RHI/BasicRHIComponent.h>
 #include <RHI/BasicRHIComponent.h>
 
 
-#include <HighInstanceTestComponent_Traits_Platform.h>
-
 AZ_DECLARE_BUDGET(AtomSampleViewer);
 AZ_DECLARE_BUDGET(AtomSampleViewer);
 
 
 namespace AtomSampleViewer
 namespace AtomSampleViewer
@@ -47,8 +47,6 @@ namespace AtomSampleViewer
         , m_modelBrowser("@user@/HighInstanceTestComponent/model_browser.xml")
         , m_modelBrowser("@user@/HighInstanceTestComponent/model_browser.xml")
         , m_imguiSidebar("@user@/HighInstanceTestComponent/sidebar.xml")
         , m_imguiSidebar("@user@/HighInstanceTestComponent/sidebar.xml")
     {
     {
-        m_sampleName = "HighInstanceTest";
-
         m_materialBrowser.SetFilter([](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>();
@@ -59,45 +57,10 @@ namespace AtomSampleViewer
             return assetInfo.m_assetType == azrtti_typeid<AZ::RPI::ModelAsset>();
             return assetInfo.m_assetType == azrtti_typeid<AZ::RPI::ModelAsset>();
         });
         });
 
 
+        // Only use a diffuse white material so light colors are easily visible.
         const AZStd::vector<AZStd::string> materialAllowlist =
         const AZStd::vector<AZStd::string> materialAllowlist =
         {
         {
-            "materials/presets/pbr/metal_aluminum.azmaterial",
-            "materials/presets/pbr/metal_aluminum_matte.azmaterial",
-            "materials/presets/pbr/metal_aluminum_polished.azmaterial",
-            "materials/presets/pbr/metal_brass.azmaterial",
-            "materials/presets/pbr/metal_brass_matte.azmaterial",
-            "materials/presets/pbr/metal_brass_polished.azmaterial",
-            "materials/presets/pbr/metal_chrome.azmaterial",
-            "materials/presets/pbr/metal_chrome_matte.azmaterial",
-            "materials/presets/pbr/metal_chrome_polished.azmaterial",
-            "materials/presets/pbr/metal_cobalt.azmaterial",
-            "materials/presets/pbr/metal_cobalt_matte.azmaterial",
-            "materials/presets/pbr/metal_cobalt_polished.azmaterial",
-            "materials/presets/pbr/metal_copper.azmaterial",
-            "materials/presets/pbr/metal_copper_matte.azmaterial",
-            "materials/presets/pbr/metal_copper_polished.azmaterial",
-            "materials/presets/pbr/metal_gold.azmaterial",
-            "materials/presets/pbr/metal_gold_matte.azmaterial",
-            "materials/presets/pbr/metal_gold_polished.azmaterial",
-            "materials/presets/pbr/metal_iron.azmaterial",
-            "materials/presets/pbr/metal_iron_matte.azmaterial",
-            "materials/presets/pbr/metal_iron_polished.azmaterial",
-            "materials/presets/pbr/metal_mercury.azmaterial",
-            "materials/presets/pbr/metal_nickel.azmaterial",
-            "materials/presets/pbr/metal_nickel_matte.azmaterial",
-            "materials/presets/pbr/metal_nickel_polished.azmaterial",
-            "materials/presets/pbr/metal_palladium.azmaterial",
-            "materials/presets/pbr/metal_palladium_matte.azmaterial",
-            "materials/presets/pbr/metal_palladium_polished.azmaterial",
-            "materials/presets/pbr/metal_platinum.azmaterial",
-            "materials/presets/pbr/metal_platinum_matte.azmaterial",
-            "materials/presets/pbr/metal_platinum_polished.azmaterial",
-            "materials/presets/pbr/metal_silver.azmaterial",
-            "materials/presets/pbr/metal_silver_matte.azmaterial",
-            "materials/presets/pbr/metal_silver_polished.azmaterial",
-            "materials/presets/pbr/metal_titanium.azmaterial",
-            "materials/presets/pbr/metal_titanium_matte.azmaterial",
-            "materials/presets/pbr/metal_titanium_polished.azmaterial",
+            "materials/presets/macbeth/19_white_9-5_0-05d.azmaterial",
         };
         };
         m_materialBrowser.SetDefaultPinnedAssets(materialAllowlist);
         m_materialBrowser.SetDefaultPinnedAssets(materialAllowlist);
 
 
@@ -124,6 +87,11 @@ namespace AtomSampleViewer
 
 
     void HighInstanceTestComponent::Activate()
     void HighInstanceTestComponent::Activate()
     {
     {
+        BuildDiskLightParameters();
+
+        m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DirectionalLightFeatureProcessorInterface>();
+        m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<Render::DiskLightFeatureProcessorInterface>();
+
         AZ::TickBus::Handler::BusConnect();
         AZ::TickBus::Handler::BusConnect();
 
 
         m_imguiSidebar.Activate();
         m_imguiSidebar.Activate();
@@ -136,9 +104,15 @@ namespace AtomSampleViewer
         m_modelBrowser.ResetPinnedAssetsToDefault();
         m_modelBrowser.ResetPinnedAssetsToDefault();
 
 
         SetLatticeDimensions(
         SetLatticeDimensions(
-            ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_X, 
-            ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Y, 
-            ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Z);
+            m_testParameters.m_latticeSize[0], 
+            m_testParameters.m_latticeSize[1], 
+            m_testParameters.m_latticeSize[2]);
+        SetLatticeSpacing(
+            m_testParameters.m_latticeSpacing[0],
+            m_testParameters.m_latticeSpacing[1],
+            m_testParameters.m_latticeSpacing[2]);
+        SetLatticeEntityScale(m_testParameters.m_entityScale);
+
         Base::Activate();
         Base::Activate();
 
 
         AzFramework::NativeWindowHandle windowHandle = nullptr;
         AzFramework::NativeWindowHandle windowHandle = nullptr;
@@ -158,10 +132,13 @@ namespace AtomSampleViewer
 
 
             SaveCameraConfiguration();
             SaveCameraConfiguration();
             ResetNoClipController();
             ResetNoClipController();
+
+            SetIBLExposure(m_testParameters.m_iblExposure);
     }
     }
 
 
     void HighInstanceTestComponent::Deactivate()
     void HighInstanceTestComponent::Deactivate()
     {
     {
+        DestroyLights();
         RestoreCameraConfiguration();
         RestoreCameraConfiguration();
         AzFramework::NativeWindowHandle windowHandle = nullptr;
         AzFramework::NativeWindowHandle windowHandle = nullptr;
         AzFramework::WindowSystemRequestBus::BroadcastResult(
         AzFramework::WindowSystemRequestBus::BroadcastResult(
@@ -184,6 +161,7 @@ namespace AtomSampleViewer
     void HighInstanceTestComponent::PrepareCreateLatticeInstances(uint32_t instanceCount)
     void HighInstanceTestComponent::PrepareCreateLatticeInstances(uint32_t instanceCount)
     {
     {
         m_modelInstanceData.reserve(instanceCount);
         m_modelInstanceData.reserve(instanceCount);
+        DestroyLights();
     }
     }
 
 
     void HighInstanceTestComponent::CreateLatticeInstance(const AZ::Transform& transform)
     void HighInstanceTestComponent::CreateLatticeInstance(const AZ::Transform& transform)
@@ -232,6 +210,16 @@ namespace AtomSampleViewer
         // pause script and tick until assets are ready
         // pause script and tick until assets are ready
         ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::PauseScriptWithTimeout, 120.0f);
         ScriptRunnerRequestBus::Broadcast(&ScriptRunnerRequests::PauseScriptWithTimeout, 120.0f);
         AZ::TickBus::Handler::BusDisconnect();
         AZ::TickBus::Handler::BusDisconnect();
+
+        if (m_testParameters.m_numShadowCastingSpotLights > 0 && m_diskLightsEnabled)
+        {
+            CreateSpotLights();
+        }
+
+        if (m_testParameters.m_activateDirectionalLight && m_directionalLightEnabled)
+        {
+            CreateDirectionalLight();
+        }
     }
     }
 
 
     void HighInstanceTestComponent::OnAllAssetsReadyActivate()
     void HighInstanceTestComponent::OnAllAssetsReadyActivate()
@@ -271,6 +259,18 @@ namespace AtomSampleViewer
         m_modelInstanceData.clear();
         m_modelInstanceData.clear();
     }
     }
 
 
+    void HighInstanceTestComponent::DestroyLights()
+    {
+        m_directionalLightFeatureProcessor->ReleaseLight(m_directionalLightHandle);
+        m_directionalLightHandle = {};
+        for (int index = 0; index < m_diskLights.size(); ++index)
+        {
+            DiskLightHandle& handle = m_diskLights[index].m_handle;
+            m_diskLightFeatureProcessor->ReleaseLight(handle);
+            handle = {};
+        }
+    }
+
     void HighInstanceTestComponent::DestroyHandles()
     void HighInstanceTestComponent::DestroyHandles()
     {
     {
         for (ModelInstanceData& instanceData : m_modelInstanceData)
         for (ModelInstanceData& instanceData : m_modelInstanceData)
@@ -329,6 +329,8 @@ namespace AtomSampleViewer
         }
         }
 
 
         bool currentUseSimpleModels = m_useSimpleModels;
         bool currentUseSimpleModels = m_useSimpleModels;
+        bool diskLightsEnabled = m_diskLightsEnabled;
+        bool directionalLightEnabled = m_directionalLightEnabled;
         if (m_imguiSidebar.Begin())
         if (m_imguiSidebar.Begin())
         {
         {
             ImGui::Checkbox("Update Transforms Every Frame", &m_updateTransformEnabled);
             ImGui::Checkbox("Update Transforms Every Frame", &m_updateTransformEnabled);
@@ -345,9 +347,41 @@ namespace AtomSampleViewer
 
 
             ImGui::Checkbox("Use simple models", &m_useSimpleModels);
             ImGui::Checkbox("Use simple models", &m_useSimpleModels);
 
 
+            ImGui::Spacing();
+            ImGui::Separator();
+            ImGui::Spacing();
+
+            ImGui::Checkbox("Display SpotLight Debug", &m_drawDiskLightDebug);
+
+            ImGui::Spacing();
+            ImGui::Separator();
+            ImGui::Spacing();
+
+            if (m_testParameters.m_numShadowCastingSpotLights > 0)
+            {
+                ImGui::Checkbox("Enable SpotLights", &m_diskLightsEnabled);
+            }
+            if (m_testParameters.m_activateDirectionalLight)
+            {
+                ImGui::Checkbox("Enable Directional Light", &m_directionalLightEnabled);
+            }
+
             m_imguiSidebar.End();
             m_imguiSidebar.End();
         }
         }
 
 
+        if(diskLightsEnabled != m_diskLightsEnabled || directionalLightEnabled != m_directionalLightEnabled)
+        {
+            DestroyLights();
+            if (m_testParameters.m_numShadowCastingSpotLights > 0 && m_diskLightsEnabled)
+            {
+                CreateSpotLights();
+            }
+            if(m_testParameters.m_activateDirectionalLight && m_directionalLightEnabled)
+            {
+                CreateDirectionalLight();
+            }
+        }
+
         if (currentUseSimpleModels != m_useSimpleModels)
         if (currentUseSimpleModels != m_useSimpleModels)
         {
         {
             m_modelBrowser.SetPinnedAssets(m_useSimpleModels?m_simpleModelList:m_expandedModelList);
             m_modelBrowser.SetPinnedAssets(m_useSimpleModels?m_simpleModelList:m_expandedModelList);
@@ -356,17 +390,22 @@ namespace AtomSampleViewer
                 instanceData.m_modelAssetId = GetRandomModelId();
                 instanceData.m_modelAssetId = GetRandomModelId();
             }
             }
             DestroyHandles();
             DestroyHandles();
+            DestroyLights();
             FinalizeLatticeInstances();
             FinalizeLatticeInstances();
         }
         }
+
+        DrawDiskLightDebugObjects();
     }
     }
 
 
     void HighInstanceTestComponent::ResetNoClipController()
     void HighInstanceTestComponent::ResetNoClipController()
     {
     {
         using namespace AZ;
         using namespace AZ;
         using namespace AZ::Debug;
         using namespace AZ::Debug;
+        AZ::Vector3 camPos = AZ::Vector3::CreateFromFloat3(m_testParameters.m_cameraPosition);
         Camera::CameraRequestBus::Event(GetCameraEntityId(), &Camera::CameraRequestBus::Events::SetFarClipDistance, 2000.0f);
         Camera::CameraRequestBus::Event(GetCameraEntityId(), &Camera::CameraRequestBus::Events::SetFarClipDistance, 2000.0f);
-        NoClipControllerRequestBus::Event(GetCameraEntityId(), &NoClipControllerRequestBus::Events::SetHeading, AZ::DegToRad(-44.722542));
-        NoClipControllerRequestBus::Event(GetCameraEntityId(), &NoClipControllerRequestBus::Events::SetPitch, AZ::DegToRad(24.987326));
+        NoClipControllerRequestBus::Event(GetCameraEntityId(), &NoClipControllerRequestBus::Events::SetPosition, camPos);
+        NoClipControllerRequestBus::Event(GetCameraEntityId(), &NoClipControllerRequestBus::Events::SetHeading, AZ::DegToRad(m_testParameters.m_cameraHeadingDeg));
+        NoClipControllerRequestBus::Event(GetCameraEntityId(), &NoClipControllerRequestBus::Events::SetPitch, AZ::DegToRad(m_testParameters.m_cameraPitchDeg));
     }
     }
 
 
     void HighInstanceTestComponent::SaveCameraConfiguration()
     void HighInstanceTestComponent::SaveCameraConfiguration()
@@ -378,4 +417,129 @@ namespace AtomSampleViewer
     {
     {
         Camera::CameraRequestBus::Event(GetCameraEntityId(), &Camera::CameraRequestBus::Events::SetFarClipDistance, m_originalFarClipDistance);
         Camera::CameraRequestBus::Event(GetCameraEntityId(), &Camera::CameraRequestBus::Events::SetFarClipDistance, m_originalFarClipDistance);
     }
     }
+
+    void HighInstanceTestComponent::CreateSpotLights()
+    {
+        for (int index = 0; index < m_testParameters.m_numShadowCastingSpotLights; ++index)
+        {
+            CreateSpotLight(index);
+        }
+   }
+
+    void HighInstanceTestComponent::CreateSpotLight(int index)
+    {
+        Render::DiskLightFeatureProcessorInterface* const featureProcessor = m_diskLightFeatureProcessor;
+        const DiskLightHandle handle = featureProcessor->AcquireLight();
+
+        AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela> lightColor(m_diskLights[index].m_color * m_testParameters.m_shadowSpotlightIntensity);
+        featureProcessor->SetRgbIntensity(handle, lightColor);
+        featureProcessor->SetAttenuationRadius(handle, m_testParameters.m_shadowSpotlightMaxDistance);
+        featureProcessor->SetConeAngles(
+            handle, 
+            DegToRad(m_testParameters.m_shadowSpotlightInnerAngleDeg), 
+            DegToRad(m_testParameters.m_shadowSpotlightOuterAngleDeg));
+        featureProcessor->SetShadowsEnabled(handle, true);
+        featureProcessor->SetShadowmapMaxResolution(handle, m_testParameters.m_shadowmapSize);
+        featureProcessor->SetShadowFilterMethod(handle, m_testParameters.m_shadowFilterMethod);
+        featureProcessor->SetFilteringSampleCount(handle, 1);
+
+        const Vector3 aabbOffset = m_diskLights[index].m_relativePosition.GetNormalized() * (0.5f * m_testParameters.m_shadowSpotlightMaxDistance);
+        const Vector3 position = m_worldAabb.GetCenter() + aabbOffset;
+
+        featureProcessor->SetPosition(handle, position);
+        featureProcessor->SetDirection(handle, (-aabbOffset).GetNormalized());
+
+        m_diskLights[index].m_handle = handle;
+    }
+
+    const AZ::Color& HighInstanceTestComponent::GetNextLightColor()
+    {
+        static uint16_t colorIndex = 0;
+        static const AZStd::vector<AZ::Color> colors =
+        {
+            AZ::Colors::Red,
+            AZ::Colors::Green,
+            AZ::Colors::Blue,
+            AZ::Colors::Cyan,
+            AZ::Colors::Fuchsia,
+            AZ::Colors::Yellow,
+            AZ::Colors::SpringGreen
+        };
+
+        const AZ::Color& result = colors[colorIndex];
+        colorIndex = (colorIndex + 1) % colors.size();
+        return result;
+    }
+
+    AZ::Vector3 HighInstanceTestComponent::GetRandomDirection()
+    {
+        return AZ::Vector3(
+            m_random.GetRandomFloat() - 0.5f,
+            m_random.GetRandomFloat() - 0.5f,
+            m_random.GetRandomFloat() - 0.5f).GetNormalized();
+    }
+
+    void HighInstanceTestComponent::BuildDiskLightParameters()
+    {
+        m_random.SetSeed(0);
+        m_diskLights.clear();
+        m_diskLights.reserve(m_testParameters.m_numShadowCastingSpotLights);
+        for (int index = 0; index < m_testParameters.m_numShadowCastingSpotLights; ++index)
+        {
+            m_diskLights.emplace_back(
+                GetNextLightColor(),
+                GetRandomDirection(),
+                m_testParameters.m_shadowmapSize);
+        }
+    }
+
+    void HighInstanceTestComponent::CreateDirectionalLight()
+    {
+        Render::DirectionalLightFeatureProcessorInterface* featureProcessor = m_directionalLightFeatureProcessor;
+        const DirectionalLightHandle handle = featureProcessor->AcquireLight();
+
+        const auto lightTransform = Transform::CreateLookAt(
+            -m_worldAabb.GetMax(),
+            Vector3::CreateZero());
+        featureProcessor->SetDirection(
+            handle,
+            lightTransform.GetBasis(1));
+
+        featureProcessor->SetRgbIntensity(handle, AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Lux>(AZ::Color::CreateOne() * m_testParameters.m_directionalLightIntensity));
+        featureProcessor->SetCascadeCount(handle, m_testParameters.m_numDirectionalLightShadowCascades);
+        featureProcessor->SetShadowmapSize(handle, m_testParameters.m_shadowmapSize);
+        featureProcessor->SetViewFrustumCorrectionEnabled(handle, false);
+        featureProcessor->SetShadowFilterMethod(handle, m_testParameters.m_shadowFilterMethod);
+        featureProcessor->SetFilteringSampleCount(handle, 1);
+        featureProcessor->SetGroundHeight(handle, 0.f);
+
+        m_directionalLightHandle = handle;
+    }
+
+
+
+    void HighInstanceTestComponent::DrawDiskLightDebugObjects()
+    {
+        if (auto auxGeom = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(m_scene); 
+            m_drawDiskLightDebug && auxGeom)
+        {
+            for (int i = 0; i < m_diskLights.size(); ++i)
+            {
+                const auto& light = m_diskLights[i];
+                if (light.m_handle.IsValid())
+                {
+                    const Render::DiskLightData& lightData = m_diskLightFeatureProcessor->GetDiskData(light.m_handle);
+                    const float lightDistance = sqrt(1.0f/lightData.m_invAttenuationRadiusSquared);
+                    AZ::Vector3 position = AZ::Vector3::CreateFromFloat3(lightData.m_position.data());
+                    AZ::Vector3 direction = AZ::Vector3::CreateFromFloat3(lightData.m_direction.data()).GetNormalized();
+                    position += direction * lightDistance;
+                    direction *= -1.0f;
+                    float coneSlantLength = lightDistance / lightData.m_cosOuterConeAngle;
+                    float farEndCapRadius = sqrt(coneSlantLength * coneSlantLength - lightDistance * lightDistance);
+                    auxGeom->DrawCone(position, direction, farEndCapRadius, lightDistance, light.m_color, AZ::RPI::AuxGeomDraw::DrawStyle::Line);
+                }
+            }
+        }
+    }
+
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 179 - 0
Gem/Code/Source/Performance/HighInstanceExampleComponent.h

@@ -0,0 +1,179 @@
+/*
+ * 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
+ *
+ */
+
+#pragma once
+
+#include <EntityLatticeTestComponent.h>
+#include <Utils/ImGuiSidebar.h>
+#include <Utils/ImGuiAssetBrowser.h>
+#include <AzCore/Component/TickBus.h>
+#include <AzCore/Math/Random.h>
+#include <AzCore/Math/Vector3.h>
+#include <AzCore/Math/Color.h>
+#include <AzCore/std/containers/vector.h>
+
+#include <Atom/Feature/CoreLights/DirectionalLightFeatureProcessorInterface.h>
+#include <Atom/Feature/CoreLights/ShadowConstants.h>
+#include <Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h>
+
+namespace AtomSampleViewer
+{
+    //! This class is used as base of a set of simple cpu performance stress test for Atom.
+    //! This test loads a X*Y*Z lattice of entities with randomized meshes and materials and creates N shadow casting spotlights plus 0-1 Directional lights
+   struct HighInstanceTestParameters
+   {
+       int m_latticeSize[3] = {22, 22, 22};
+       float m_latticeSpacing[3] = {5.0f, 5.0f, 5.0f};
+       float m_entityScale = 1.0f;
+
+       AZ::Render::ShadowmapSize m_shadowmapSize = AZ::Render::ShadowmapSize::Size256;
+       AZ::Render::ShadowFilterMethod m_shadowFilterMethod = AZ::Render::ShadowFilterMethod::None;
+       int m_numShadowCastingSpotLights = 0;
+       float m_shadowSpotlightInnerAngleDeg = 10.0f;
+       float m_shadowSpotlightOuterAngleDeg = 30.0f;
+       float m_shadowSpotlightMaxDistance = 200.0f;
+       float m_shadowSpotlightIntensity = 500.f; // Value in Candela
+
+       bool m_activateDirectionalLight = false;
+       uint16_t m_numDirectionalLightShadowCascades = 4;
+       float m_directionalLightIntensity = 5.0f; // Value in Lux
+
+       float m_cameraPosition[3] = {0.0f, 0.0f, 0.0f};
+       float m_cameraHeadingDeg = -44.7f;
+       float m_cameraPitchDeg = 25.0f;
+       float m_iblExposure = 0.0f;
+   };
+    class HighInstanceTestComponent
+        : public EntityLatticeTestComponent
+        , public AZ::TickBus::Handler
+    {
+        using Base = EntityLatticeTestComponent;
+
+    public:
+        AZ_RTTI(HighInstanceTestComponent, "{DAA2B63B-7CC0-4696-A44F-49E53C6390B9}", EntityLatticeTestComponent);
+
+        static void Reflect(AZ::ReflectContext* context);
+
+        HighInstanceTestComponent();
+        
+        //! AZ::Component overrides...
+        void Activate() override;
+        void Deactivate() override;
+
+    private:
+        AZ_DISABLE_COPY_MOVE(HighInstanceTestComponent);
+
+        // CommonSampleComponentBase overrides...
+        void OnAllAssetsReadyActivate() override;
+
+        //! EntityLatticeTestComponent overrides...
+        void PrepareCreateLatticeInstances(uint32_t instanceCount) override;
+        void CreateLatticeInstance(const AZ::Transform& transform) override;
+        void FinalizeLatticeInstances() override;
+        void DestroyLatticeInstances() override;
+        void DestroyLights();
+
+        void DestroyHandles();
+
+        AZ::Data::AssetId GetRandomModelId() const;
+        AZ::Data::AssetId GetRandomMaterialId() const;
+
+        void OnTick(float deltaTime, AZ::ScriptTimePoint scriptTime) override;
+
+        void ResetNoClipController();
+        void SaveCameraConfiguration();
+        void RestoreCameraConfiguration();
+
+        const AZ::Color& GetNextLightColor();
+        AZ::Vector3 GetRandomDirection();
+        void BuildDiskLightParameters();
+        void CreateSpotLights();
+        void CreateSpotLight(int index);
+        void DrawDiskLightDebugObjects();
+
+        void CreateDirectionalLight();
+
+    protected:
+        HighInstanceTestParameters m_testParameters;
+
+    private:
+        struct ModelInstanceData
+        {
+            AZ::Transform m_transform;
+            AZ::Data::AssetId m_modelAssetId;
+            AZ::Data::AssetId m_materialAssetId;
+            AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
+        };
+
+        ImGuiSidebar m_imguiSidebar;
+        ImGuiAssetBrowser m_materialBrowser;
+        ImGuiAssetBrowser m_modelBrowser;
+        
+        AZStd::vector<ModelInstanceData> m_modelInstanceData;
+
+        struct Compare
+        {
+            bool operator()(const AZ::Data::Asset<AZ::RPI::MaterialAsset>& lhs, const AZ::Data::Asset<AZ::RPI::MaterialAsset>& rhs) const
+            {
+                if (lhs.GetId().m_guid == rhs.GetId().m_guid)
+                {
+                    return lhs.GetId().m_subId > rhs.GetId().m_subId;
+                }
+                return lhs.GetId().m_guid > rhs.GetId().m_guid;
+            }
+        };
+
+        using MaterialAssetSet = AZStd::set<AZ::Data::Asset<AZ::RPI::MaterialAsset>, Compare>;
+        MaterialAssetSet m_cachedMaterials;
+        uint32_t m_pinnedMaterialCount = 0;
+        uint32_t m_preActivateVSyncInterval = 0;
+        AZ::SimpleLcgRandom m_random;
+
+        AZStd::vector<AZStd::string> m_expandedModelList; // has models that are more expensive on the gpu
+        AZStd::vector<AZStd::string> m_simpleModelList; // Aims to keep the test cpu bottlenecked by using trivial geometry such as a cube
+        size_t m_lastPinnedModelCount = 0;
+
+        float m_originalFarClipDistance;
+        bool m_updateTransformEnabled = false;
+        bool m_useSimpleModels = true;
+
+        // light settings
+        using DirectionalLightHandle = AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle;
+        using DiskLightHandle = AZ::Render::DiskLightFeatureProcessorInterface::LightHandle;
+
+        class DiskLight
+        {
+        public:
+            DiskLight() = delete;
+            explicit DiskLight(
+                const AZ::Color& color,
+                const AZ::Vector3& relativePosition,
+                AZ::Render::ShadowmapSize shadowmapSize)
+                : m_color{ color }
+                , m_relativePosition{ relativePosition }
+                , m_shadowmapSize{ shadowmapSize }
+            {}
+            ~DiskLight() = default;
+
+            const AZ::Color m_color;
+            const AZ::Vector3 m_relativePosition;
+            const AZ::Render::ShadowmapSize m_shadowmapSize;
+            DiskLightHandle m_handle;
+        };
+
+        static constexpr float CutoffIntensity = 0.1f;
+
+        AZ::Render::DirectionalLightFeatureProcessorInterface* m_directionalLightFeatureProcessor = nullptr;
+        AZ::Render::DiskLightFeatureProcessorInterface* m_diskLightFeatureProcessor = nullptr;
+        DirectionalLightHandle m_directionalLightHandle;
+        AZStd::vector<DiskLight> m_diskLights;
+        bool m_drawDiskLightDebug = false;
+        bool m_diskLightsEnabled = true; // combined with test parameters to determine final state.
+        bool m_directionalLightEnabled = true; // combined with test parameters to determine final state.
+    };
+} // namespace AtomSampleViewer

+ 5 - 0
Gem/Code/Source/Platform/Android/EntityLatticeTestComponent_Traits_Platform.h

@@ -12,3 +12,8 @@
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    2
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    2
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     2
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     2
 #define ENTITY_LATTEST_TEST_COMPONENT_MAX                       4
 #define ENTITY_LATTEST_TEST_COMPONENT_MAX                       4
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_X                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Y                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Z                 5.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_SPACING_MAX               100.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_ENTITY_SCALE_MAX          10.0f

+ 0 - 11
Gem/Code/Source/Platform/Android/HighInstanceTestComponent_Traits_Platform.h

@@ -1,11 +0,0 @@
-/*
- * 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
- *
- */
-
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_X       12
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Y       12
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Z       12

+ 0 - 1
Gem/Code/Source/Platform/Android/atomsampleviewer_android_files.cmake

@@ -13,7 +13,6 @@ set(FILES
     SceneReloadSoakTestComponent_Traits_Platform.h
     SceneReloadSoakTestComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
-    HighInstanceTestComponent_Traits_Platform.h
     SampleComponentManager_Android.cpp
     SampleComponentManager_Android.cpp
     StreamingImageExampleComponent_Android.cpp
     StreamingImageExampleComponent_Android.cpp
     Utils_Android.cpp
     Utils_Android.cpp

+ 6 - 1
Gem/Code/Source/Platform/Linux/EntityLatticeTestComponent_Traits_Platform.h

@@ -9,4 +9,9 @@
 #define ENTITY_LATTICE_TEST_COMPONENT_WIDTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_WIDTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
-#define ENTITY_LATTEST_TEST_COMPONENT_MAX                       25
+#define ENTITY_LATTEST_TEST_COMPONENT_MAX                       100
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_X                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Y                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Z                 5.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_SPACING_MAX               100.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_ENTITY_SCALE_MAX          10.0f

+ 0 - 11
Gem/Code/Source/Platform/Linux/HighInstanceTestComponent_Traits_Platform.h

@@ -1,11 +0,0 @@
-/*
- * 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
- *
- */
-
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_X       22
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Y       22
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Z       22

+ 0 - 1
Gem/Code/Source/Platform/Linux/atomsampleviewer_linux_files.cmake

@@ -13,7 +13,6 @@ set(FILES
     SceneReloadSoakTestComponent_Traits_Platform.h
     SceneReloadSoakTestComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
-    HighInstanceTestComponent_Traits_Platform.h
     SampleComponentManager_Linux.cpp
     SampleComponentManager_Linux.cpp
     StreamingImageExampleComponent_Linux.cpp
     StreamingImageExampleComponent_Linux.cpp
     Utils_Linux.cpp
     Utils_Linux.cpp

+ 6 - 1
Gem/Code/Source/Platform/Mac/EntityLatticeTestComponent_Traits_Platform.h

@@ -9,4 +9,9 @@
 #define ENTITY_LATTICE_TEST_COMPONENT_WIDTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_WIDTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
-#define ENTITY_LATTEST_TEST_COMPONENT_MAX                       25
+#define ENTITY_LATTEST_TEST_COMPONENT_MAX                       100
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_X                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Y                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Z                 5.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_SPACING_MAX               100.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_ENTITY_SCALE_MAX          10.0f

+ 0 - 11
Gem/Code/Source/Platform/Mac/HighInstanceTestComponent_Traits_Platform.h

@@ -1,11 +0,0 @@
-/*
- * 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
- *
- */
-
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_X       22
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Y       22
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Z       22

+ 0 - 1
Gem/Code/Source/Platform/Mac/atomsampleviewer_mac_files.cmake

@@ -14,7 +14,6 @@ set(FILES
     SceneReloadSoakTestComponent_Traits_Platform.h
     SceneReloadSoakTestComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
-    HighInstanceTestComponent_Traits_Platform.h
     SampleComponentManager_Mac.cpp
     SampleComponentManager_Mac.cpp
     StreamingImageExampleComponent_Mac.cpp
     StreamingImageExampleComponent_Mac.cpp
     Utils_Mac.cpp
     Utils_Mac.cpp

+ 6 - 1
Gem/Code/Source/Platform/Windows/EntityLatticeTestComponent_Traits_Platform.h

@@ -9,4 +9,9 @@
 #define ENTITY_LATTICE_TEST_COMPONENT_WIDTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_WIDTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
-#define ENTITY_LATTEST_TEST_COMPONENT_MAX                       25
+#define ENTITY_LATTEST_TEST_COMPONENT_MAX                       100
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_X                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Y                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Z                 5.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_SPACING_MAX               100.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_ENTITY_SCALE_MAX          10.0f

+ 0 - 11
Gem/Code/Source/Platform/Windows/HighInstanceTestComponent_Traits_Platform.h

@@ -1,11 +0,0 @@
-/*
- * 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
- *
- */
-
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_X       22
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Y       22
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Z       22

+ 0 - 1
Gem/Code/Source/Platform/Windows/atomsampleviewer_windows_files.cmake

@@ -12,7 +12,6 @@ set(FILES
     MultiThreadComponent_Traits_Platform.h
     MultiThreadComponent_Traits_Platform.h
     SceneReloadSoakTestComponent_Traits_Platform.h
     SceneReloadSoakTestComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
-    HighInstanceTestComponent_Traits_Platform.h
     SampleComponentManager_Windows.cpp
     SampleComponentManager_Windows.cpp
     StreamingImageExampleComponent_Windows.cpp
     StreamingImageExampleComponent_Windows.cpp
     Utils_Windows.cpp
     Utils_Windows.cpp

+ 5 - 0
Gem/Code/Source/Platform/iOS/EntityLatticeTestComponent_Traits_Platform.h

@@ -10,3 +10,8 @@
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_HEIGHT                    5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
 #define ENTITY_LATTICE_TEST_COMPONENT_DEPTH                     5
 #define ENTITY_LATTEST_TEST_COMPONENT_MAX                       20
 #define ENTITY_LATTEST_TEST_COMPONENT_MAX                       20
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_X                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Y                 5.0f
+#define ENTITY_LATTICE_TEST_COMPONENT_SPACING_Z                 5.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_SPACING_MAX               100.0f
+#define ENTITY_LATTEST_TEST_COMPONENT_ENTITY_SCALE_MAX          10.0f

+ 0 - 11
Gem/Code/Source/Platform/iOS/HighInstanceTestComponent_Traits_Platform.h

@@ -1,11 +0,0 @@
-/*
- * 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
- *
- */
-
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_X       12
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Y       12
-#define ATOMSAMPLEVIEWER_TRAIT_HIGH_INSTANCE_COUNT_TEST_COMPONENT_LATTICE_SIZE_Z       12

+ 0 - 1
Gem/Code/Source/Platform/iOS/atomsampleviewer_ios_files.cmake

@@ -14,7 +14,6 @@ set(FILES
     SceneReloadSoakTestComponent_Traits_Platform.h
     SceneReloadSoakTestComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     SSRExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
     TriangleConstantBufferExampleComponent_Traits_Platform.h
-    HighInstanceTestComponent_Traits_Platform.h
     SampleComponentManager_iOS.cpp
     SampleComponentManager_iOS.cpp
     StreamingImageExampleComponent_iOS.cpp
     StreamingImageExampleComponent_iOS.cpp
     Utils_iOS.cpp
     Utils_iOS.cpp

+ 17 - 2
Gem/Code/Source/SampleComponentManager.cpp

@@ -65,6 +65,9 @@
 #include <RHI/RayTracingExampleComponent.h>
 #include <RHI/RayTracingExampleComponent.h>
 #include <RHI/MatrixAlignmentTestExampleComponent.h>
 #include <RHI/MatrixAlignmentTestExampleComponent.h>
 
 
+#include <Performance/100KDrawable_SingleView_ExampleComponent.h>
+#include <Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.h>
+
 #include <AreaLightExampleComponent.h>
 #include <AreaLightExampleComponent.h>
 #include <AssetLoadTestComponent.h>
 #include <AssetLoadTestComponent.h>
 #include <AuxGeomExampleComponent.h>
 #include <AuxGeomExampleComponent.h>
@@ -100,7 +103,6 @@
 #include <DiffuseGIExampleComponent.h>
 #include <DiffuseGIExampleComponent.h>
 #include <SSRExampleComponent.h>
 #include <SSRExampleComponent.h>
 #include <ShaderReloadTestComponent.h>
 #include <ShaderReloadTestComponent.h>
-#include <HighInstanceExampleComponent.h>
 
 
 #include <Atom/Bootstrap/DefaultWindowBus.h>
 #include <Atom/Bootstrap/DefaultWindowBus.h>
 
 
@@ -209,6 +211,18 @@ namespace AtomSampleViewer
         return NewSample<T>(SamplePipelineType::RPI, "Features", name, isSupportedFunction);
         return NewSample<T>(SamplePipelineType::RPI, "Features", name, isSupportedFunction);
     }
     }
 
 
+    template <typename T>
+    static SampleEntry NewPerfSample(const AZStd::string& name)
+    {
+        return NewSample<T>(SamplePipelineType::RPI, "Performance", name);
+    }
+
+    template <typename T>
+    static SampleEntry NewPerfSample(const AZStd::string& name, AZStd::function<bool()> isSupportedFunction)
+    {
+        return NewSample<T>(SamplePipelineType::RPI, "Performance", name, isSupportedFunction);
+    }
+
     void SampleComponentManager::Reflect(AZ::ReflectContext* context)
     void SampleComponentManager::Reflect(AZ::ReflectContext* context)
     {
     {
         if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
         if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
@@ -266,7 +280,6 @@ namespace AtomSampleViewer
             NewRPISample<DecalExampleComponent>("Decals"),
             NewRPISample<DecalExampleComponent>("Decals"),
             NewRPISample<DynamicDrawExampleComponent>("DynamicDraw"),
             NewRPISample<DynamicDrawExampleComponent>("DynamicDraw"),
             NewRPISample<DynamicMaterialTestComponent>("DynamicMaterialTest"),
             NewRPISample<DynamicMaterialTestComponent>("DynamicMaterialTest"),
-            NewRPISample<HighInstanceTestComponent>("HighInstanceTest"),
             NewRPISample<MaterialHotReloadTestComponent>("MaterialHotReloadTest"),
             NewRPISample<MaterialHotReloadTestComponent>("MaterialHotReloadTest"),
             NewRPISample<MeshExampleComponent>("Mesh"),
             NewRPISample<MeshExampleComponent>("Mesh"),
             NewRPISample<MSAA_RPI_ExampleComponent>("MSAA"),
             NewRPISample<MSAA_RPI_ExampleComponent>("MSAA"),
@@ -292,6 +305,8 @@ namespace AtomSampleViewer
             NewFeaturesSample<SSRExampleComponent>("SSR"),
             NewFeaturesSample<SSRExampleComponent>("SSR"),
             NewFeaturesSample<TonemappingExampleComponent>("Tonemapping"),
             NewFeaturesSample<TonemappingExampleComponent>("Tonemapping"),
             NewFeaturesSample<TransparencyExampleComponent>("Transparency"),
             NewFeaturesSample<TransparencyExampleComponent>("Transparency"),
+            NewPerfSample<_100KDrawableExampleComponent>("100KDrawable_SingleView"),
+            NewPerfSample<_100KDraw10KDrawableExampleComponent>("100KDraw_10KDrawable_MultiView"),
         };
         };
     }
     }
 
 

+ 6 - 2
Gem/Code/atomsampleviewergem_private_files.cmake

@@ -82,6 +82,12 @@ set(FILES
     Source/RHI/RayTracingExampleComponent.h
     Source/RHI/RayTracingExampleComponent.h
     Source/RHI/MatrixAlignmentTestExampleComponent.cpp
     Source/RHI/MatrixAlignmentTestExampleComponent.cpp
     Source/RHI/MatrixAlignmentTestExampleComponent.h
     Source/RHI/MatrixAlignmentTestExampleComponent.h
+    Source/Performance/HighInstanceExampleComponent.cpp
+    Source/Performance/HighInstanceExampleComponent.h
+    Source/Performance/100KDrawable_SingleView_ExampleComponent.cpp
+    Source/Performance/100KDrawable_SingleView_ExampleComponent.h
+    Source/Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.cpp
+    Source/Performance/100KDraw_10KDrawable_MultiView_ExampleComponent.h
     Source/AreaLightExampleComponent.cpp
     Source/AreaLightExampleComponent.cpp
     Source/AreaLightExampleComponent.h
     Source/AreaLightExampleComponent.h
     Source/AssetLoadTestComponent.cpp
     Source/AssetLoadTestComponent.cpp
@@ -120,8 +126,6 @@ set(FILES
     Source/EntityUtilityFunctions.h
     Source/EntityUtilityFunctions.h
     Source/ExposureExampleComponent.cpp
     Source/ExposureExampleComponent.cpp
     Source/ExposureExampleComponent.h
     Source/ExposureExampleComponent.h
-    Source/HighInstanceExampleComponent.cpp
-    Source/HighInstanceExampleComponent.h
     Source/LightCullingExampleComponent.cpp
     Source/LightCullingExampleComponent.cpp
     Source/LightCullingExampleComponent.h
     Source/LightCullingExampleComponent.h
     Source/MaterialHotReloadTestComponent.cpp
     Source/MaterialHotReloadTestComponent.cpp

+ 2 - 1
Scripts/_AutomatedPeriodicBenchmarkSuite_.bv.lua

@@ -14,7 +14,8 @@ FRAME_COUNT = 100
 SAMPLES_TO_RUN = {
 SAMPLES_TO_RUN = {
     {prefix = 'RPI', name = 'CullingAndLod', width = 1400, height = 800},
     {prefix = 'RPI', name = 'CullingAndLod', width = 1400, height = 800},
     {prefix = 'RPI', name = 'SponzaBenchmark', width = 1400, height = 800},
     {prefix = 'RPI', name = 'SponzaBenchmark', width = 1400, height = 800},
-    {prefix = 'RPI', name = 'HighInstanceTest', width = 800, height = 600}
+    {prefix = 'Performance', name = '100KDrawable_SingleView', width = 800, height = 600},
+    {prefix = 'Performance', name = '100KDraw_10KDrawable_MultiView', width = 800, height = 600}
 }
 }
 
 
 Print('Capturing data for ' .. tostring(#SAMPLES_TO_RUN) .. ' benchmarks')
 Print('Capturing data for ' .. tostring(#SAMPLES_TO_RUN) .. ' benchmarks')