Browse Source

Add HighInstanceTest to the jenkins benchmark runs (#295)

Additionally modify HighInstanceTest starting camera state to be looking at the entity lattice. 

Signed-off-by: rgba16f <[email protected]>
rgba16f 3 years ago
parent
commit
72e659c069

+ 23 - 0
Gem/Code/Source/HighInstanceExampleComponent.cpp

@@ -10,6 +10,8 @@
 #include <SampleComponentManager.h>
 #include <SampleComponentConfig.h>
 
+#include <Atom/Component/DebugCamera/NoClipControllerBus.h>
+
 #include <Atom/RPI.Reflect/Model/ModelAsset.h>
 #include <Atom/RPI.Reflect/Material/MaterialAsset.h>
 #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
@@ -150,10 +152,13 @@ namespace AtomSampleViewer
             &AzFramework::WindowRequestBus::Events::SetSyncInterval,
             0);
 
+            SaveCameraConfiguration();
+            ResetNoClipController();
     }
 
     void HighInstanceTestComponent::Deactivate()
     {
+        RestoreCameraConfiguration();
         AzFramework::NativeWindowHandle windowHandle = nullptr;
         AzFramework::WindowSystemRequestBus::BroadcastResult(
             windowHandle,
@@ -333,4 +338,22 @@ namespace AtomSampleViewer
         }
     }
 
+    void HighInstanceTestComponent::ResetNoClipController()
+    {
+        using namespace AZ;
+        using namespace AZ::Debug;
+        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));
+    }
+
+    void HighInstanceTestComponent::SaveCameraConfiguration()
+    {
+        Camera::CameraRequestBus::EventResult(m_originalFarClipDistance, GetCameraEntityId(), &Camera::CameraRequestBus::Events::GetFarClipDistance);
+    }
+
+    void HighInstanceTestComponent::RestoreCameraConfiguration()
+    {
+        Camera::CameraRequestBus::Event(GetCameraEntityId(), &Camera::CameraRequestBus::Events::SetFarClipDistance, m_originalFarClipDistance);
+    }
 } // namespace AtomSampleViewer

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

@@ -57,6 +57,10 @@ namespace AtomSampleViewer
 
         void OnTick(float deltaTime, AZ::ScriptTimePoint scriptTime) override;
 
+        void ResetNoClipController();
+        void SaveCameraConfiguration();
+        void RestoreCameraConfiguration();
+        
         struct ModelInstanceData
         {
             AZ::Transform m_transform;
@@ -89,6 +93,8 @@ namespace AtomSampleViewer
         uint32_t m_preActivateVSyncInterval = 0;
         
         size_t m_lastPinnedModelCount = 0;
+
+        float m_originalFarClipDistance;
         bool m_updateTransformEnabled = false;
     };
 } // namespace AtomSampleViewer

+ 2 - 1
Scripts/_AutomatedPeriodicBenchmarkSuite_.bv.lua

@@ -13,7 +13,8 @@ IDLE_COUNT = 100
 FRAME_COUNT = 100
 SAMPLES_TO_RUN = {
     {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}
 }
 
 Print('Capturing data for ' .. tostring(#SAMPLES_TO_RUN) .. ' benchmarks')