Selaa lähdekoodia

Move part of the screenshot process to frame capture bus so it can be shared with other projects (#500)

* Move part of the screenshot process to frame capture bus so it can be shared with other projects

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

* Move path management to a new ebus

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

* Rename functions

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

* Remove unused code

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

Signed-off-by: jiaweig <[email protected]>
jiaweig 3 vuotta sitten
vanhempi
commit
be20515039
43 muutettua tiedostoa jossa 336 lisäystä ja 540 poistoa
  1. 102 38
      Gem/Code/Source/Automation/ScriptManager.cpp
  2. 10 7
      Gem/Code/Source/Automation/ScriptManager.h
  3. 53 171
      Gem/Code/Source/Automation/ScriptReporter.cpp
  4. 7 39
      Gem/Code/Source/Automation/ScriptReporter.h
  5. 0 18
      Gem/Code/Source/Platform/Android/ScriptReporter_Android.cpp
  6. 0 1
      Gem/Code/Source/Platform/Android/atomsampleviewer_android_files.cmake
  7. 0 18
      Gem/Code/Source/Platform/Linux/ScriptReporter_Linux.cpp
  8. 0 1
      Gem/Code/Source/Platform/Linux/atomsampleviewer_linux_files.cmake
  9. 0 18
      Gem/Code/Source/Platform/Mac/ScriptReporter_Mac.cpp
  10. 0 1
      Gem/Code/Source/Platform/Mac/atomsampleviewer_mac_files.cmake
  11. 0 45
      Gem/Code/Source/Platform/Windows/ScriptReporter_Windows.cpp
  12. 0 1
      Gem/Code/Source/Platform/Windows/atomsampleviewer_windows_files.cmake
  13. 0 18
      Gem/Code/Source/Platform/iOS/ScriptReporter_iOS.cpp
  14. 0 1
      Gem/Code/Source/Platform/iOS/atomsampleviewer_ios_files.cmake
  15. 3 3
      Scripts/AreaLightTest.bv.lua
  16. 4 4
      Scripts/AuxGeom.bv.lua
  17. 3 3
      Scripts/CheckerboardTest.bv.lua
  18. 3 3
      Scripts/CullingAndLod.bv.lua
  19. 3 3
      Scripts/Decals.bv.lua
  20. 3 3
      Scripts/DepthOfFieldTest.bv.lua
  21. 3 3
      Scripts/DiffuseGITest.bv.lua
  22. 3 3
      Scripts/DynamicDraw.bv.lua
  23. 4 4
      Scripts/DynamicMaterialTest.bv.lua
  24. 3 3
      Scripts/ExposureTest.bv.lua
  25. 3 3
      Scripts/EyeMaterialTest.bv.lua
  26. 8 8
      Scripts/LightCulling.bv.lua
  27. 3 3
      Scripts/MSAA_RPI_Test.bv.lua
  28. 17 17
      Scripts/MaterialHotReloadTest.bv.lua
  29. 14 14
      Scripts/MaterialScreenshotTests.bv.lua
  30. 4 4
      Scripts/MultiRenderPipeline.bv.lua
  31. 4 4
      Scripts/MultiScene.bv.lua
  32. 8 8
      Scripts/ParallaxDepthArtifacts.bv.lua
  33. 15 15
      Scripts/ParallaxTest.bv.lua
  34. 3 3
      Scripts/PassTree.bv.lua
  35. 4 4
      Scripts/ReadbackTest.bv.lua
  36. 4 4
      Scripts/RenderTargetTexture.bv.lua
  37. 3 3
      Scripts/SceneReloadSoakTest.bv.lua
  38. 17 17
      Scripts/ShadowTest.bv.lua
  39. 7 7
      Scripts/ShadowedSponzaTest.bv.lua
  40. 3 3
      Scripts/SkinnedMesh.bv.lua
  41. 5 5
      Scripts/StreamingImageTest.bv.lua
  42. 6 5
      Scripts/TestEnvironment.lua
  43. 4 4
      Scripts/TransparentTest.bv.lua

+ 102 - 38
Gem/Code/Source/Automation/ScriptManager.cpp

@@ -1089,7 +1089,10 @@ namespace AtomSampleViewer
         behaviorContext->Method("ShowTool", &Script_ShowTool);
         behaviorContext->Method("ShowTool", &Script_ShowTool);
 
 
         // Screenshots...
         // Screenshots...
+        behaviorContext->Method("SetScreenshotFolder", &Script_SetScreenshotFolder);
         behaviorContext->Method("SetTestEnvPath", &Script_SetTestEnvPath);
         behaviorContext->Method("SetTestEnvPath", &Script_SetTestEnvPath);
+        behaviorContext->Method("SetOfficialBaselineImageFolder", &Script_SetOfficialBaselineImageFolder);
+        behaviorContext->Method("SetLocalBaselineImageFolder", &Script_SetLocalBaselineImageFolder);
         behaviorContext->Method("SelectImageComparisonToleranceLevel", &Script_SelectImageComparisonToleranceLevel);
         behaviorContext->Method("SelectImageComparisonToleranceLevel", &Script_SelectImageComparisonToleranceLevel);
         behaviorContext->Method("CaptureScreenshot", &Script_CaptureScreenshot);
         behaviorContext->Method("CaptureScreenshot", &Script_CaptureScreenshot);
         behaviorContext->Method("CaptureScreenshotWithImGui", &Script_CaptureScreenshotWithImGui);
         behaviorContext->Method("CaptureScreenshotWithImGui", &Script_CaptureScreenshotWithImGui);
@@ -1406,26 +1409,22 @@ namespace AtomSampleViewer
         s_instance->m_scriptOperations.push(AZStd::move(operation));
         s_instance->m_scriptOperations.push(AZStd::move(operation));
     }
     }
 
 
-    bool ScriptManager::PrepareForScreenCapture(const AZStd::string& path, const AZStd::string& envPath)
+    bool ScriptManager::PrepareForScreenCapture(const AZStd::string& imageName)
     {
     {
-        if (!Utils::IsFileUnderFolder(Utils::ResolvePath(path), ScreenshotPaths::GetScreenshotsFolder(true)))
-        {
-            // The main reason we require screenshots to be in a specific folder is to ensure we don't delete or replace some other important file.
-            ReportScriptError(AZStd::string::format(
-                "Screenshots must be captured under the '%s' folder. Attempted to save screenshot to '%s'.",
-                ScreenshotPaths::GetScreenshotsFolder(false).c_str(), path.c_str()));
-
-            return false;
-        }
+        AZStd::string fullFilePath;
+        AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+            fullFilePath,
+            &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+            imageName, true);
 
 
         // Delete the file if it already exists because if the screen capture fails, we don't want to do a screenshot comparison test using an old screenshot.
         // Delete the file if it already exists because if the screen capture fails, we don't want to do a screenshot comparison test using an old screenshot.
-        if (AZ::IO::LocalFileIO::GetInstance()->Exists(path.c_str()) && !AZ::IO::LocalFileIO::GetInstance()->Remove(path.c_str()))
+        if (AZ::IO::LocalFileIO::GetInstance()->Exists(fullFilePath.c_str()) && !AZ::IO::LocalFileIO::GetInstance()->Remove(fullFilePath.c_str()))
         {
         {
-            ReportScriptError(AZStd::string::format("Failed to delete existing screenshot file '%s'.", path.c_str()));
+            ReportScriptError(AZStd::string::format("Failed to delete existing screenshot file '%s'.", fullFilePath.c_str()));
             return false;
             return false;
         }
         }
 
 
-        s_instance->m_scriptReporter.AddScreenshotTest(path, envPath);
+        s_instance->m_scriptReporter.AddScreenshotTest(imageName);
 
 
         s_instance->m_isCapturePending = true;
         s_instance->m_isCapturePending = true;
         s_instance->PauseScript();
         s_instance->PauseScript();
@@ -1433,9 +1432,48 @@ namespace AtomSampleViewer
         return true;
         return true;
     }
     }
 
 
+    void ScriptManager::Script_SetScreenshotFolder(const AZStd::string& screenshotFolder)
+    {
+        auto operation = [screenshotFolder]()
+        {
+            AZ::Render::FrameCaptureTestRequestBus::Broadcast(
+                &AZ::Render::FrameCaptureTestRequestBus::Events::SetScreenshotFolder, screenshotFolder);
+        };
+
+        s_instance->m_scriptOperations.push(AZStd::move(operation));
+    }
+
     void ScriptManager::Script_SetTestEnvPath(const AZStd::string& envPath)
     void ScriptManager::Script_SetTestEnvPath(const AZStd::string& envPath)
     {
     {
-        s_instance->m_envPath = envPath;
+        auto operation = [envPath]()
+        {
+            AZ::Render::FrameCaptureTestRequestBus::Broadcast(
+                &AZ::Render::FrameCaptureTestRequestBus::Events::SetTestEnvPath, envPath);
+        };
+
+        s_instance->m_scriptOperations.push(AZStd::move(operation));
+    }
+
+    void ScriptManager::Script_SetOfficialBaselineImageFolder(const AZStd::string& baselineFolder)
+    {
+        auto operation = [baselineFolder]()
+        {
+            AZ::Render::FrameCaptureTestRequestBus::Broadcast(
+                &AZ::Render::FrameCaptureTestRequestBus::Events::SetOfficialBaselineImageFolder, baselineFolder);
+        };
+
+        s_instance->m_scriptOperations.push(AZStd::move(operation));
+    }
+
+    void ScriptManager::Script_SetLocalBaselineImageFolder(const AZStd::string& baselineFolder)
+    {
+        auto operation = [baselineFolder]()
+        {
+            AZ::Render::FrameCaptureTestRequestBus::Broadcast(
+                &AZ::Render::FrameCaptureTestRequestBus::Events::SetLocalBaselineImageFolder, baselineFolder);
+        };
+
+        s_instance->m_scriptOperations.push(AZStd::move(operation));
     }
     }
 
 
     void ScriptManager::Script_SelectImageComparisonToleranceLevel(const AZStd::string& presetName)
     void ScriptManager::Script_SelectImageComparisonToleranceLevel(const AZStd::string& presetName)
@@ -1448,18 +1486,24 @@ namespace AtomSampleViewer
         s_instance->m_scriptOperations.push(AZStd::move(operation));
         s_instance->m_scriptOperations.push(AZStd::move(operation));
     }
     }
 
 
-    void ScriptManager::Script_CaptureScreenshot(const AZStd::string& filePath)
+    void ScriptManager::Script_CaptureScreenshot(const AZStd::string& imageName)
     {
     {
         Script_SetShowImGui(false);
         Script_SetShowImGui(false);
 
 
-        auto operation = [filePath]()
+        auto operation = [imageName]()
         {
         {
             // Note this will pause the script until the capture is complete
             // Note this will pause the script until the capture is complete
-            if (PrepareForScreenCapture(filePath, s_instance->m_envPath))
+            if (PrepareForScreenCapture(imageName))
             {
             {
+                AZStd::string screenshotFilePath;
+                AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                    screenshotFilePath,
+                    &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+                    imageName, true);
+
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
                 AZ::Render::FrameCaptureId frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                 AZ::Render::FrameCaptureId frameCaptureId = AZ::Render::InvalidFrameCaptureId;
-                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshot, filePath);
+                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshot, screenshotFilePath);
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 {
                 {
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
@@ -1467,7 +1511,7 @@ namespace AtomSampleViewer
                 }
                 }
                 else
                 else
                 {
                 {
-                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", filePath.c_str());
+                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", screenshotFilePath.c_str());
                     s_instance->m_isCapturePending = false;
                     s_instance->m_isCapturePending = false;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->ResumeScript();
                     s_instance->ResumeScript();
@@ -1489,18 +1533,24 @@ namespace AtomSampleViewer
 
 
     }
     }
 
 
-    void ScriptManager::Script_CaptureScreenshotWithImGui(const AZStd::string& filePath)
+    void ScriptManager::Script_CaptureScreenshotWithImGui(const AZStd::string& imageName)
     {
     {
         Script_SetShowImGui(true);
         Script_SetShowImGui(true);
 
 
-        auto operation = [filePath]()
+        auto operation = [imageName]()
         {
         {
             // Note this will pause the script until the capture is complete
             // Note this will pause the script until the capture is complete
-            if (PrepareForScreenCapture(filePath, s_instance->m_envPath))
+            if (PrepareForScreenCapture(imageName))
             {
             {
+                AZStd::string screenshotFilePath;
+                AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                    screenshotFilePath,
+                    &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+                    imageName, true);
+
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
-                uint32_t frameCaptureId = AZ::Render::InvalidFrameCaptureId;
-                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshot, filePath);
+                AZ::Render::FrameCaptureId frameCaptureId = AZ::Render::InvalidFrameCaptureId;
+                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshot, screenshotFilePath);
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 {
                 {
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
@@ -1508,7 +1558,7 @@ namespace AtomSampleViewer
                 }
                 }
                 else
                 else
                 {
                 {
-                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", filePath.c_str());
+                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", screenshotFilePath.c_str());
                     s_instance->m_isCapturePending = false;
                     s_instance->m_isCapturePending = false;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->ResumeScript();
                     s_instance->ResumeScript();
@@ -1529,16 +1579,22 @@ namespace AtomSampleViewer
             });
             });
     }
     }
 
 
-    void ScriptManager::Script_CaptureScreenshotWithPreview(const AZStd::string& filePath)
+    void ScriptManager::Script_CaptureScreenshotWithPreview(const AZStd::string& imageName)
     {
     {
-        auto operation = [filePath]()
+        auto operation = [imageName]()
         {
         {
             // Note this will pause the script until the capture is complete
             // Note this will pause the script until the capture is complete
-            if (PrepareForScreenCapture(filePath, s_instance->m_envPath))
+            if (PrepareForScreenCapture(imageName))
             {
             {
+                AZStd::string screenshotFilePath;
+                AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                    screenshotFilePath,
+                    &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+                    imageName, true);
+
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
-                uint32_t frameCaptureId = AZ::Render::InvalidFrameCaptureId;
-                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshotWithPreview, filePath);
+                AZ::Render::FrameCaptureId frameCaptureId = AZ::Render::InvalidFrameCaptureId;
+                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshotWithPreview, screenshotFilePath);
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 {
                 {
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
@@ -1546,7 +1602,7 @@ namespace AtomSampleViewer
                 }
                 }
                 else
                 else
                 {
                 {
-                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", filePath.c_str());
+                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", screenshotFilePath.c_str());
                     s_instance->m_isCapturePending = false;
                     s_instance->m_isCapturePending = false;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->ResumeScript();
                     s_instance->ResumeScript();
@@ -1591,13 +1647,13 @@ namespace AtomSampleViewer
 
 
         AZStd::vector<AZStd::string> passHierarchy;
         AZStd::vector<AZStd::string> passHierarchy;
         AZStd::string slot;
         AZStd::string slot;
-        AZStd::string outputFilePath;
+        AZStd::string imageName;
 
 
         // read slot name and output file path
         // read slot name and output file path
         dc.ReadArg(1, stringValue);
         dc.ReadArg(1, stringValue);
         slot = AZStd::string(stringValue);
         slot = AZStd::string(stringValue);
         dc.ReadArg(2, stringValue);
         dc.ReadArg(2, stringValue);
-        outputFilePath = AZStd::string(stringValue);
+        imageName = AZStd::string(stringValue);
 
 
         AZ::RPI::PassAttachmentReadbackOption readbackOption = AZ::RPI::PassAttachmentReadbackOption::Output;
         AZ::RPI::PassAttachmentReadbackOption readbackOption = AZ::RPI::PassAttachmentReadbackOption::Output;
         if (dc.GetNumArguments() == 4)
         if (dc.GetNumArguments() == 4)
@@ -1636,14 +1692,20 @@ namespace AtomSampleViewer
             }
             }
         }
         }
 
 
-        auto operation = [passHierarchy, slot, outputFilePath, readbackOption]()
+        auto operation = [passHierarchy, slot, imageName, readbackOption]()
         {
         {
             // Note this will pause the script until the capture is complete
             // Note this will pause the script until the capture is complete
-            if (PrepareForScreenCapture(outputFilePath, s_instance->m_envPath))
+            if (PrepareForScreenCapture(imageName))
             {
             {
+                AZStd::string screenshotFilePath;
+                AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                    screenshotFilePath,
+                    &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+                    imageName, true);
+
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
                 AZ_Assert(s_instance->m_frameCaptureId == AZ::Render::InvalidFrameCaptureId, "Attempting to start a capture while one is in progress");
-                uint32_t frameCaptureId = AZ::Render::InvalidFrameCaptureId;
-                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CapturePassAttachment, passHierarchy, slot, outputFilePath, readbackOption);
+                AZ::Render::FrameCaptureId frameCaptureId = AZ::Render::InvalidFrameCaptureId;
+                AZ::Render::FrameCaptureRequestBus::BroadcastResult(frameCaptureId, &AZ::Render::FrameCaptureRequestBus::Events::CapturePassAttachment, passHierarchy, slot, screenshotFilePath, readbackOption);
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 if (frameCaptureId != AZ::Render::InvalidFrameCaptureId)
                 {
                 {
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
                     s_instance->AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect(frameCaptureId);
@@ -1651,7 +1713,7 @@ namespace AtomSampleViewer
                 }
                 }
                 else
                 else
                 {
                 {
-                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", outputFilePath.c_str());
+                    AZ_Error("Automation", false, "Failed to initiate frame capture for '%s'", screenshotFilePath.c_str());
                     s_instance->m_isCapturePending = false;
                     s_instance->m_isCapturePending = false;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->m_frameCaptureId = AZ::Render::InvalidFrameCaptureId;
                     s_instance->ResumeScript();
                     s_instance->ResumeScript();
@@ -2057,3 +2119,5 @@ namespace AtomSampleViewer
         s_instance->m_scriptOperations.push(AZStd::move(operation));
         s_instance->m_scriptOperations.push(AZStd::move(operation));
     }
     }
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer
+
+#pragma optimize("", on)

+ 10 - 7
Gem/Code/Source/Automation/ScriptManager.h

@@ -124,8 +124,13 @@ namespace AtomSampleViewer
         static void Script_ShowTool(const AZStd::string& toolName, bool enable);
         static void Script_ShowTool(const AZStd::string& toolName, bool enable);
 
 
         // Screenshots...
         // Screenshots...
-        // Store the test environment path of the screenshots. It will be used to figure out the baseline path.
+        // Set the path and folder that are used to find screenshots and baseline images.
+        // The full path of the screenshot consists of: screenshotFolder + envPath + imageName/testcaseName.
+        // The full path of the baseline folder consists of: baselineFolder + imageName/testcaseName.
+        static void Script_SetScreenshotFolder(const AZStd::string& screenshotFolder);
         static void Script_SetTestEnvPath(const AZStd::string& envPath);
         static void Script_SetTestEnvPath(const AZStd::string& envPath);
+        static void Script_SetOfficialBaselineImageFolder(const AZStd::string& baselineFolder);
+        static void Script_SetLocalBaselineImageFolder(const AZStd::string& baselineFolder);
 
 
         // Call this function before capturing screenshots to indicate which comparison tolerance level should be used.
         // Call this function before capturing screenshots to indicate which comparison tolerance level should be used.
         // The list of available tolerance levels can be found in "AtomSampleViewer/Config/ImageComparisonToleranceLevels.azasset".
         // The list of available tolerance levels can be found in "AtomSampleViewer/Config/ImageComparisonToleranceLevels.azasset".
@@ -138,8 +143,8 @@ namespace AtomSampleViewer
         // but with "Screenshots" replaced with "ExpectedScreenshots". For example, the expected file for
         // but with "Screenshots" replaced with "ExpectedScreenshots". For example, the expected file for
         // "Scripts/Screenshots/StandardPbr/test.ppm" should be at "Scripts/ExpectedScreenshots/StandardPbr/test.ppm".
         // "Scripts/Screenshots/StandardPbr/test.ppm" should be at "Scripts/ExpectedScreenshots/StandardPbr/test.ppm".
 
 
-        static void Script_CaptureScreenshot(const AZStd::string& filePath);
-        static void Script_CaptureScreenshotWithImGui(const AZStd::string& filePath);
+        static void Script_CaptureScreenshot(const AZStd::string& imageName);
+        static void Script_CaptureScreenshotWithImGui(const AZStd::string& imageName);
 
 
         // Capture a pass attachment and save it to a file (*.ppm or *.dds for image, *.buffer for buffer)
         // Capture a pass attachment and save it to a file (*.ppm or *.dds for image, *.buffer for buffer)
         // The order of input parameters in ScriptDataContext would be
         // The order of input parameters in ScriptDataContext would be
@@ -150,7 +155,7 @@ namespace AtomSampleViewer
         static void Script_CapturePassAttachment(AZ::ScriptDataContext& dc);
         static void Script_CapturePassAttachment(AZ::ScriptDataContext& dc);
 
 
         // Capture a screentshot with pass image attachment preview when the preview enabled.
         // Capture a screentshot with pass image attachment preview when the preview enabled.
-        static void Script_CaptureScreenshotWithPreview(const AZStd::string& filePath);
+        static void Script_CaptureScreenshotWithPreview(const AZStd::string& imageName);
 
 
         // Profiling statistics data...
         // Profiling statistics data...
         static void Script_CapturePassTimestamp(AZ::ScriptDataContext& dc);
         static void Script_CapturePassTimestamp(AZ::ScriptDataContext& dc);
@@ -235,7 +240,7 @@ namespace AtomSampleViewer
         // Validates the ScriptDataContext for ProfilingCapture script requests
         // Validates the ScriptDataContext for ProfilingCapture script requests
         static bool ValidateProfilingCaptureScripContexts(AZ::ScriptDataContext& dc, AZStd::string& outputFilePath);
         static bool ValidateProfilingCaptureScripContexts(AZ::ScriptDataContext& dc, AZStd::string& outputFilePath);
 
 
-        static bool PrepareForScreenCapture(const AZStd::string& path, const AZStd::string& envPath);
+        static bool PrepareForScreenCapture(const AZStd::string& imageName);
 
 
         // show/hide imgui
         // show/hide imgui
         void SetShowImGui(bool show);
         void SetShowImGui(bool show);
@@ -251,8 +256,6 @@ namespace AtomSampleViewer
 
 
         TestSuiteExecutionConfig m_testSuiteRunConfig;
         TestSuiteExecutionConfig m_testSuiteRunConfig;
 
 
-        AZStd::string m_envPath = "";
-
         static constexpr float DefaultPauseTimeout = 5.0f;
         static constexpr float DefaultPauseTimeout = 5.0f;
 
 
         int m_scriptIdleFrames = 0;
         int m_scriptIdleFrames = 0;

+ 53 - 171
Gem/Code/Source/Automation/ScriptReporter.cpp

@@ -29,84 +29,6 @@ namespace AtomSampleViewer
         "Sort by Script", "Sort by Official Baseline Diff Score", "Sort by Local Baseline Diff Score",
         "Sort by Script", "Sort by Official Baseline Diff Score", "Sort by Local Baseline Diff Score",
     };
     };
 
 
-    namespace ScreenshotPaths
-    {
-        AZStd::string GetScreenshotsFolder(bool resolvePath)
-        {
-            AZStd::string path = "@user@/scripts/screenshots/";
-
-            if (resolvePath)
-            {
-                path = Utils::ResolvePath(path);
-            }
-
-            return path;
-        }
-
-        AZStd::string GetLocalBaselineFolder(bool resolvePath)
-        {
-            AZStd::string path = AZStd::string::format("@user@/scripts/screenshotslocalbaseline/");
-
-            if (resolvePath)
-            {
-                path = Utils::ResolvePath(path);
-            }
-
-            return path;
-        }
-
-        AZStd::string GetOfficialBaselineFolder(bool resolvePath)
-        {
-            AZStd::string path = "scripts/expectedscreenshots/";
-
-            if (resolvePath)
-            {
-                path = Utils::ResolvePath(path);
-            }
-
-            return path;
-        }
-
-        AZStd::string GetLocalBaseline(const AZStd::string& forScreenshotFile)
-        {
-            AZStd::string localBaselineFolder = GetLocalBaselineFolder(false);
-            AzFramework::StringFunc::Replace(localBaselineFolder, "@user@/", "");
-            AZStd::string newPath = forScreenshotFile;
-            if (!AzFramework::StringFunc::Replace(newPath, "scripts/screenshots", localBaselineFolder.c_str()))
-            {
-                newPath = "";
-            }
-            return Utils::ResolvePath(newPath);
-        }
-
-        AZStd::string GetOfficialBaseline(const AZStd::string& forScreenshotFile, const AZStd::string& envPath)
-        {
-            AZStd::string path = forScreenshotFile;
-            const AZStd::string userPath = Utils::ResolvePath("@user@");
-
-            // make the path relative to the user folder
-            if (!AzFramework::StringFunc::Replace(path, userPath.c_str(), ""))
-            {
-                return "";
-            }
-
-            // After replacing "screenshots" with "expectedscreenshots", the path should be a valid asset path, relative to asset root.
-            if (!AzFramework::StringFunc::Replace(path, "scripts/screenshots", "scripts/expectedscreenshots"))
-            {
-                return "";
-            }
-
-            if (!AzFramework::StringFunc::Replace(path, envPath.c_str(), ""))
-            {
-                return "";
-            }
-            // Turn it back into a full path
-            path = Utils::ResolvePath("@projectroot@/" + path);
-
-            return path;
-        }
-    }
-
     AZStd::string ScriptReporter::ImageComparisonResult::GetSummaryString() const
     AZStd::string ScriptReporter::ImageComparisonResult::GetSummaryString() const
     {
     {
         AZStd::string resultString;
         AZStd::string resultString;
@@ -208,18 +130,31 @@ namespace AtomSampleViewer
         return !m_currentScriptIndexStack.empty();
         return !m_currentScriptIndexStack.empty();
     }
     }
 
 
-    ScriptReporter::ScreenshotTestInfo::ScreenshotTestInfo(const AZStd::string& screenshotFilePath, const AZStd::string& envPath)
-        : m_screenshotFilePath(Utils::ResolvePath(screenshotFilePath))
-    {
-        m_officialBaselineScreenshotFilePath = ScreenshotPaths::GetOfficialBaseline(m_screenshotFilePath, envPath);
-        m_localBaselineScreenshotFilePath = ScreenshotPaths::GetLocalBaseline(m_screenshotFilePath);
+    ScriptReporter::ScreenshotTestInfo::ScreenshotTestInfo(const AZStd::string& screenshotName)
+    {   
+        AZ_Assert(!screenshotName.empty(), "The screenshot file name shouldn't be empty.");
+
+        AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+            m_screenshotFilePath,
+            &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+            screenshotName, true);
+
+        AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+            m_officialBaselineScreenshotFilePath,
+            &AZ::Render::FrameCaptureTestRequestBus::Events::BuildOfficialBaselineFilePath,
+            screenshotName, false);
+
+        AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+            m_localBaselineScreenshotFilePath,
+            &AZ::Render::FrameCaptureTestRequestBus::Events::BuildLocalBaselineFilePath,
+            screenshotName, true);
     }
     }
 
 
-    bool ScriptReporter::AddScreenshotTest(const AZStd::string& path, const AZStd::string& envPath)
+    bool ScriptReporter::AddScreenshotTest(const AZStd::string& imageName)
     {
     {
         AZ_Assert(GetCurrentScriptReport(), "There is no active script");
         AZ_Assert(GetCurrentScriptReport(), "There is no active script");
 
 
-        ScreenshotTestInfo screenshotTestInfo(path, envPath);
+        ScreenshotTestInfo screenshotTestInfo(imageName);
         GetCurrentScriptReport()->m_screenshotTests.push_back(AZStd::move(screenshotTestInfo));
         GetCurrentScriptReport()->m_screenshotTests.push_back(AZStd::move(screenshotTestInfo));
 
 
         return true;
         return true;
@@ -911,80 +846,6 @@ namespace AtomSampleViewer
         ReportScriptIssue(fullMessage, traceLevel);
         ReportScriptIssue(fullMessage, traceLevel);
     }
     }
 
 
-    bool ScriptReporter::DiffImages(ImageComparisonResult& imageComparisonResult, const AZStd::string& expectedImageFilePath, const AZStd::string& actualImageFilePath, TraceLevel traceLevel)
-    {
-        using namespace AZ::Utils;
-
-        AZStd::vector<uint8_t> actualImageBuffer;
-        AZ::RHI::Size actualImageSize;
-        AZ::RHI::Format actualImageFormat;
-        if (!LoadPngData(imageComparisonResult, actualImageFilePath, actualImageBuffer, actualImageSize, actualImageFormat, traceLevel))
-        {
-            // Even though LoadPngData might have reported an error, we need to report our own here with the "Screenshot check failed" string
-            // because the error handler in ScriptReporter::ScriptReport is looking for that.
-            ReportScreenshotComparisonIssue("Screenshot check failed. 'Actual' file not loaded.",
-                expectedImageFilePath,
-                actualImageFilePath,
-                traceLevel);
-            return false;
-        }
-
-        AZStd::vector<uint8_t> expectedImageBuffer;
-        AZ::RHI::Size expectedImageSize;
-        AZ::RHI::Format expectedImageFormat;
-        if (!LoadPngData(imageComparisonResult, expectedImageFilePath, expectedImageBuffer, expectedImageSize, expectedImageFormat, traceLevel))
-        {
-            // Even though LoadPngData might have reported an error, we need to report our own here with the "Screenshot check failed" string
-            // because the error handler in ScriptReporter::ScriptReport is looking for that.
-            ReportScreenshotComparisonIssue("Screenshot check failed. 'Expected' file not loaded.",
-                expectedImageFilePath,
-                actualImageFilePath,
-                traceLevel);
-            return false;
-        }
-
-        float diffScore = 0.0f;
-        float filteredDiffScore = 0.0f;
-
-        static constexpr float ImperceptibleDiffFilter = 0.01;
-
-        ImageDiffResultCode rmsResult = AZ::Utils::CalcImageDiffRms(
-            actualImageBuffer, actualImageSize, actualImageFormat,
-            expectedImageBuffer, expectedImageSize, expectedImageFormat,
-            &diffScore,
-            &filteredDiffScore,
-            ImperceptibleDiffFilter);
-
-        if (rmsResult != ImageDiffResultCode::Success)
-        {
-            if(rmsResult == ImageDiffResultCode::SizeMismatch)
-            {
-                ReportScreenshotComparisonIssue(AZStd::string::format("Screenshot check failed. Sizes don't match. Expected %u x %u but was %u x %u.",
-                    expectedImageSize.m_width, expectedImageSize.m_height,
-                    actualImageSize.m_width, actualImageSize.m_height),
-                    expectedImageFilePath,
-                    actualImageFilePath,
-                    traceLevel);
-                imageComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::WrongSize;
-                return false;
-            }
-            else if (rmsResult == ImageDiffResultCode::FormatMismatch || rmsResult == ImageDiffResultCode::UnsupportedFormat)
-            {
-                ReportScreenshotComparisonIssue(AZStd::string::format("Screenshot check failed. Could not compare screenshots due to a format issue."),
-                    expectedImageFilePath,
-                    actualImageFilePath,
-                    traceLevel);
-                imageComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::WrongFormat;
-                return false;
-            }
-        }
-
-        imageComparisonResult.m_standardDiffScore = diffScore;
-        imageComparisonResult.m_filteredDiffScore = filteredDiffScore;
-        imageComparisonResult.m_finalDiffScore = diffScore; // Set the final score to the standard score just in case the filtered one is ignored
-        return true;
-    }
-
     void ScriptReporter::UpdateAllLocalBaselineImages()
     void ScriptReporter::UpdateAllLocalBaselineImages()
     {
     {
         int failureCount = 0;
         int failureCount = 0;
@@ -1134,7 +995,12 @@ namespace AtomSampleViewer
         }
         }
         else
         else
         {
         {
-            message = "Destination: " + ScreenshotPaths::GetLocalBaselineFolder(true) + "\n";
+            AZStd::string localBaselineFolder;
+            AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                localBaselineFolder,
+                &AZ::Render::FrameCaptureTestRequestBus::Events::BuildScreenshotFilePath,
+                "", true);
+            message = "Destination: " + localBaselineFolder + "\n";
 
 
             if (successCount > 0)
             if (successCount > 0)
             {
             {
@@ -1168,20 +1034,30 @@ namespace AtomSampleViewer
             return;
             return;
         }
         }
 
 
+        auto io = AZ::IO::LocalFileIO::GetInstance();
         screenshotTestInfo.m_toleranceLevel = *toleranceLevel;
         screenshotTestInfo.m_toleranceLevel = *toleranceLevel;
+        static constexpr float ImperceptibleDiffFilter = 0.01;
 
 
-        if (screenshotTestInfo.m_officialBaselineScreenshotFilePath.empty())
+        if (screenshotTestInfo.m_officialBaselineScreenshotFilePath.empty()
+            || !io->Exists(screenshotTestInfo.m_officialBaselineScreenshotFilePath.c_str()))
         {
         {
             ReportScriptError(AZStd::string::format("Screenshot check failed. Could not determine expected screenshot path for '%s'", screenshotTestInfo.m_screenshotFilePath.c_str()));
             ReportScriptError(AZStd::string::format("Screenshot check failed. Could not determine expected screenshot path for '%s'", screenshotTestInfo.m_screenshotFilePath.c_str()));
             screenshotTestInfo.m_officialComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::FileNotFound;
             screenshotTestInfo.m_officialComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::FileNotFound;
         }
         }
         else
         else
         {
         {
-            bool imagesWereCompared = DiffImages(
-                screenshotTestInfo.m_officialComparisonResult,
-                screenshotTestInfo.m_officialBaselineScreenshotFilePath,
+            bool imagesWereCompared = false;
+            AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                imagesWereCompared,
+                &AZ::Render::FrameCaptureTestRequestBus::Events::CompareScreenshots,
                 screenshotTestInfo.m_screenshotFilePath,
                 screenshotTestInfo.m_screenshotFilePath,
-                TraceLevel::Error);
+                screenshotTestInfo.m_officialBaselineScreenshotFilePath,
+                &screenshotTestInfo.m_officialComparisonResult.m_standardDiffScore,
+                &screenshotTestInfo.m_officialComparisonResult.m_filteredDiffScore,
+                ImperceptibleDiffFilter
+            );
+            // Set the final score to the standard score just in case the filtered one is ignored
+            screenshotTestInfo.m_officialComparisonResult.m_finalDiffScore = screenshotTestInfo.m_officialComparisonResult.m_standardDiffScore;
 
 
             if (imagesWereCompared)
             if (imagesWereCompared)
             {
             {
@@ -1208,7 +1084,8 @@ namespace AtomSampleViewer
             }
             }
         }
         }
 
 
-        if (screenshotTestInfo.m_localBaselineScreenshotFilePath.empty())
+        if (screenshotTestInfo.m_localBaselineScreenshotFilePath.empty()
+            || !io->Exists(screenshotTestInfo.m_localBaselineScreenshotFilePath.c_str()))
         {
         {
             ReportScriptWarning(AZStd::string::format("Screenshot check failed. Could not determine local baseline screenshot path for '%s'", screenshotTestInfo.m_screenshotFilePath.c_str()));
             ReportScriptWarning(AZStd::string::format("Screenshot check failed. Could not determine local baseline screenshot path for '%s'", screenshotTestInfo.m_screenshotFilePath.c_str()));
             screenshotTestInfo.m_localComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::FileNotFound;
             screenshotTestInfo.m_localComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::FileNotFound;
@@ -1217,12 +1094,17 @@ namespace AtomSampleViewer
         {
         {
             // Local screenshots should be expected match 100% every time, otherwise warnings are reported. This will help developers track and investigate changes,
             // Local screenshots should be expected match 100% every time, otherwise warnings are reported. This will help developers track and investigate changes,
             // for example if they make local changes that impact some unrelated AtomSampleViewer sample in an unexpected way, they will see a warning about this.
             // for example if they make local changes that impact some unrelated AtomSampleViewer sample in an unexpected way, they will see a warning about this.
-
-            bool imagesWereCompared = DiffImages(
-                screenshotTestInfo.m_localComparisonResult,
-                screenshotTestInfo.m_localBaselineScreenshotFilePath,
+            bool imagesWereCompared = false;
+            AZ::Render::FrameCaptureTestRequestBus::BroadcastResult(
+                imagesWereCompared,
+                &AZ::Render::FrameCaptureTestRequestBus::Events::CompareScreenshots,
                 screenshotTestInfo.m_screenshotFilePath,
                 screenshotTestInfo.m_screenshotFilePath,
-                TraceLevel::Warning);
+                screenshotTestInfo.m_localBaselineScreenshotFilePath,
+                &screenshotTestInfo.m_localComparisonResult.m_standardDiffScore,
+                &screenshotTestInfo.m_localComparisonResult.m_filteredDiffScore,
+                ImperceptibleDiffFilter
+            );
+            screenshotTestInfo.m_localComparisonResult.m_finalDiffScore = screenshotTestInfo.m_localComparisonResult.m_standardDiffScore;
 
 
             if (imagesWereCompared)
             if (imagesWereCompared)
             {
             {

+ 7 - 39
Gem/Code/Source/Automation/ScriptReporter.h

@@ -10,6 +10,8 @@
 
 
 #include <AzCore/Debug/TraceMessageBus.h>
 #include <AzCore/Debug/TraceMessageBus.h>
 #include <AzFramework/StringFunc/StringFunc.h>
 #include <AzFramework/StringFunc/StringFunc.h>
+#include <Atom/Feature/Utils/FrameCaptureBus.h>
+#include <Atom/Feature/Utils/FrameCaptureTestBus.h>
 #include <Atom/Utils/ImageComparison.h>
 #include <Atom/Utils/ImageComparison.h>
 #include <Automation/ImageComparisonConfig.h>
 #include <Automation/ImageComparisonConfig.h>
 #include <Utils/ImGuiMessageBox.h>
 #include <Utils/ImGuiMessageBox.h>
@@ -20,27 +22,6 @@ namespace AtomSampleViewer
 {
 {
     struct ImageComparisonToleranceLevel;
     struct ImageComparisonToleranceLevel;
 
 
-    namespace ScreenshotPaths
-    {
-        //! Returns the path to the screenshots capture folder.
-        //! @resolvePath indicates whether to call ResolvePath() which will produce a full path, or keep the shorter asset folder path.
-        AZStd::string GetScreenshotsFolder(bool resolvePath);
-
-        //! Returns the path to the local baseline folder, which stores copies of screenshots previously taken on this machine.
-        //! @resolvePath indicates whether to call ResolvePath() which will produce a full path, or keep the shorter asset folder path.
-        AZStd::string GetLocalBaselineFolder(bool resolvePath);
-
-        //! Returns the path to the official baseline folder, which stores copies of expected screenshots saved in source control.
-        //! @resolvePath indicates whether to call ResolvePath() which will produce a full path, or keep the shorter asset folder path.
-        AZStd::string GetOfficialBaselineFolder(bool resolvePath);
-
-        //! Returns the path to the local baseline image that corresponds to @forScreenshotFile
-        AZStd::string GetLocalBaseline(const AZStd::string& forScreenshotFile);
-
-        //! Returns the path to the official baseline image that corresponds to @forScreenshotFile
-        AZStd::string GetOfficialBaseline(const AZStd::string& forScreenshotFile, const AZStd::string& envPath);
-    }
-
     //! Collects data about each script run by the ScriptManager.
     //! Collects data about each script run by the ScriptManager.
     //! This includes counting errors, checking screenshots, and providing a final report dialog.
     //! This includes counting errors, checking screenshots, and providing a final report dialog.
     class ScriptReporter
     class ScriptReporter
@@ -75,7 +56,7 @@ namespace AtomSampleViewer
         bool HasActiveScript() const;
         bool HasActiveScript() const;
 
 
         //! Indicates that a new screenshot is about to be captured.
         //! Indicates that a new screenshot is about to be captured.
-        bool AddScreenshotTest(const AZStd::string& path, const AZStd::string& envPath);
+        bool AddScreenshotTest(const AZStd::string& imageName);
 
 
         //! Check the latest screenshot using default thresholds.
         //! Check the latest screenshot using default thresholds.
         void CheckLatestScreenshot(const ImageComparisonToleranceLevel* comparisonPreset);
         void CheckLatestScreenshot(const ImageComparisonToleranceLevel* comparisonPreset);
@@ -133,14 +114,14 @@ namespace AtomSampleViewer
         //! Records all the information about a screenshot comparison test.
         //! Records all the information about a screenshot comparison test.
         struct ScreenshotTestInfo
         struct ScreenshotTestInfo
         {
         {
-            AZStd::string m_screenshotFilePath;
-            AZStd::string m_officialBaselineScreenshotFilePath; //!< The path to the official baseline image that is checked into source control
-            AZStd::string m_localBaselineScreenshotFilePath;    //!< The path to a local baseline image that was established by the user
+            AZStd::string m_screenshotFilePath;                 //!< The full path where the screenshot will be generated.
+            AZStd::string m_officialBaselineScreenshotFilePath; //!< The full path to the official baseline image that is checked into source control
+            AZStd::string m_localBaselineScreenshotFilePath;    //!< The full path to a local baseline image that was established by the user
             ImageComparisonToleranceLevel m_toleranceLevel;     //!< Tolerance for checking against the official baseline image
             ImageComparisonToleranceLevel m_toleranceLevel;     //!< Tolerance for checking against the official baseline image
             ImageComparisonResult m_officialComparisonResult;   //!< Result of comparing against the official baseline image, for reporting test failure
             ImageComparisonResult m_officialComparisonResult;   //!< Result of comparing against the official baseline image, for reporting test failure
             ImageComparisonResult m_localComparisonResult;      //!< Result of comparing against a local baseline, for reporting warnings
             ImageComparisonResult m_localComparisonResult;      //!< Result of comparing against a local baseline, for reporting warnings
 
 
-            ScreenshotTestInfo(const AZStd::string& screenshotFilePath, const AZStd::string& envPath);
+            ScreenshotTestInfo(const AZStd::string& m_screenshotName);
         };
         };
 
 
         //! Records all the information about a single test script.
         //! Records all the information about a single test script.
@@ -246,19 +227,6 @@ namespace AtomSampleViewer
         static void ReportScriptIssue(const AZStd::string& message, TraceLevel traceLevel);
         static void ReportScriptIssue(const AZStd::string& message, TraceLevel traceLevel);
         static void ReportScreenshotComparisonIssue(const AZStd::string& message, const AZStd::string& expectedImageFilePath, const AZStd::string& actualImageFilePath, TraceLevel traceLevel);
         static void ReportScreenshotComparisonIssue(const AZStd::string& message, const AZStd::string& expectedImageFilePath, const AZStd::string& actualImageFilePath, TraceLevel traceLevel);
 
 
-        // Loads image data from a .png file.
-        // @param imageComparisonResult will be set to an error code if the function fails
-        // @param path the path the .png file
-        // @param buffer will be filled with the raw image data from the .png file
-        // @param size will be set to the image size of the .png file
-        // @param format will be set to the pixel format of the .png file
-        // @return true if the file was loaded successfully
-        static bool LoadPngData(ImageComparisonResult& imageComparisonResult, const AZStd::string& path, AZStd::vector<uint8_t>& buffer, AZ::RHI::Size& size, AZ::RHI::Format& format, TraceLevel traceLevel);
-
-        // Compares two image files and updates the ImageComparisonResult accordingly.
-        // Returns false if an error prevented the comparison.
-        static bool DiffImages(ImageComparisonResult& imageComparisonResult, const AZStd::string& expectedImageFilePath, const AZStd::string& actualImageFilePath, TraceLevel traceLevel);
-
         // Copies all captured screenshots to the local baseline folder. These can be used as an alternative to the central baseline for comparison.
         // Copies all captured screenshots to the local baseline folder. These can be used as an alternative to the central baseline for comparison.
         void UpdateAllLocalBaselineImages();
         void UpdateAllLocalBaselineImages();
 
 

+ 0 - 18
Gem/Code/Source/Platform/Android/ScriptReporter_Android.cpp

@@ -1,18 +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
- *
- */
-
-#include <Automation/ScriptReporter.h>
-#include <AzCore/Utils/Utils.h>
-
-namespace AtomSampleViewer
-{
-    bool ScriptReporter::LoadPngData([[maybe_unused]] ImageComparisonResult& imageComparisonResult, [[maybe_unused]] const AZStd::string& path, [[maybe_unused]] AZStd::vector<uint8_t>& buffer, [[maybe_unused]] AZ::RHI::Size& size, [[maybe_unused]] AZ::RHI::Format& format, [[maybe_unused]] TraceLevel traceLevel)
-    {
-        return false;
-    }
-} 

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

@@ -16,5 +16,4 @@ set(FILES
     SampleComponentManager_Android.cpp
     SampleComponentManager_Android.cpp
     StreamingImageExampleComponent_Android.cpp
     StreamingImageExampleComponent_Android.cpp
     Utils_Android.cpp
     Utils_Android.cpp
-    ScriptReporter_Android.cpp
 )
 )

+ 0 - 18
Gem/Code/Source/Platform/Linux/ScriptReporter_Linux.cpp

@@ -1,18 +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
- *
- */
-
-#include <Automation/ScriptReporter.h>
-#include <AzCore/Utils/Utils.h>
-
-namespace AtomSampleViewer
-{
-    bool ScriptReporter::LoadPngData([[maybe_unused]] ImageComparisonResult& imageComparisonResult, [[maybe_unused]] const AZStd::string& path, [[maybe_unused]] AZStd::vector<uint8_t>& buffer, [[maybe_unused]] AZ::RHI::Size& size, [[maybe_unused]] AZ::RHI::Format& format, [[maybe_unused]] TraceLevel traceLevel)
-    {
-        return false;
-    }
-} 

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

@@ -16,5 +16,4 @@ set(FILES
     SampleComponentManager_Linux.cpp
     SampleComponentManager_Linux.cpp
     StreamingImageExampleComponent_Linux.cpp
     StreamingImageExampleComponent_Linux.cpp
     Utils_Linux.cpp
     Utils_Linux.cpp
-    ScriptReporter_Linux.cpp
 )
 )

+ 0 - 18
Gem/Code/Source/Platform/Mac/ScriptReporter_Mac.cpp

@@ -1,18 +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
- *
- */
-
-#include <Automation/ScriptReporter.h>
-#include <AzCore/Utils/Utils.h>
-
-namespace AtomSampleViewer
-{
-    bool ScriptReporter::LoadPngData([[maybe_unused]] ImageComparisonResult& imageComparisonResult, [[maybe_unused]] const AZStd::string& path, [[maybe_unused]] AZStd::vector<uint8_t>& buffer, [[maybe_unused]] AZ::RHI::Size& size, [[maybe_unused]] AZ::RHI::Format& format, [[maybe_unused]] TraceLevel traceLevel)
-    {
-        return false;
-    }
-}

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

@@ -17,7 +17,6 @@ set(FILES
     SampleComponentManager_Mac.cpp
     SampleComponentManager_Mac.cpp
     StreamingImageExampleComponent_Mac.cpp
     StreamingImageExampleComponent_Mac.cpp
     Utils_Mac.cpp
     Utils_Mac.cpp
-    ScriptReporter_Mac.cpp
 )
 )
 
 
 set(LY_COMPILE_OPTIONS
 set(LY_COMPILE_OPTIONS

+ 0 - 45
Gem/Code/Source/Platform/Windows/ScriptReporter_Windows.cpp

@@ -1,45 +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
- *
- */
-
-#include <Automation/ScriptReporter.h>
-#include <AzCore/Utils/Utils.h>
-#include <Atom/Utils/PngFile.h>
-
-namespace AtomSampleViewer
-{
-    bool ScriptReporter::LoadPngData(ImageComparisonResult& imageComparisonResult, const AZStd::string& path, AZStd::vector<uint8_t>& buffer, AZ::RHI::Size& size, AZ::RHI::Format& format, TraceLevel traceLevel)
-    {
-        using namespace AZ;
-        using namespace AZ::Utils;
-
-        const auto errorHandler = [path, traceLevel, &imageComparisonResult](const char* errorMessage)
-        {
-            ReportScriptIssue(AZStd::string::format("Failed to load PNG file '%s' with error '%s'", path.c_str(), errorMessage),
-            traceLevel);
-
-            imageComparisonResult.m_resultCode = ImageComparisonResult::ResultCode::FileNotLoaded;
-        };
-
-        PngFile::LoadSettings loadSettings;
-        loadSettings.m_stripAlpha = false;
-        loadSettings.m_errorHandler = errorHandler;
-
-        PngFile file = PngFile::Load(path.c_str(), loadSettings);
-        if (file.IsValid())
-        {
-            size = RHI::Size(file.GetWidth(), file.GetHeight(), 1);
-            format = AZ::RHI::Format::R8G8B8A8_UNORM;
-            buffer = file.TakeBuffer();
-            return true;
-        }
-        else
-        {
-            return false;                
-        }
-    }
-}

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

@@ -15,5 +15,4 @@ set(FILES
     SampleComponentManager_Windows.cpp
     SampleComponentManager_Windows.cpp
     StreamingImageExampleComponent_Windows.cpp
     StreamingImageExampleComponent_Windows.cpp
     Utils_Windows.cpp
     Utils_Windows.cpp
-    ScriptReporter_Windows.cpp
 )
 )

+ 0 - 18
Gem/Code/Source/Platform/iOS/ScriptReporter_iOS.cpp

@@ -1,18 +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
- *
- */
-
-#include <Automation/ScriptReporter.h>
-#include <AzCore/Utils/Utils.h>
-
-namespace AtomSampleViewer
-{
-    bool ScriptReporter::LoadPngData([[maybe_unused]] ImageComparisonResult& imageComparisonResult, [[maybe_unused]] const AZStd::string& path, [[maybe_unused]] AZStd::vector<uint8_t>& buffer, [[maybe_unused]] AZ::RHI::Size& size, [[maybe_unused]] AZ::RHI::Format& format, [[maybe_unused]] TraceLevel traceLevel)
-    {
-        return false;
-    }
-} 

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

@@ -17,7 +17,6 @@ set(FILES
     SampleComponentManager_iOS.cpp
     SampleComponentManager_iOS.cpp
     StreamingImageExampleComponent_iOS.cpp
     StreamingImageExampleComponent_iOS.cpp
     Utils_iOS.cpp
     Utils_iOS.cpp
-    ScriptReporter_iOS.cpp
 )
 )
 
 
 set(LY_COMPILE_OPTIONS
 set(LY_COMPILE_OPTIONS

+ 3 - 3
Scripts/AreaLightTest.bv.lua

@@ -111,8 +111,8 @@ function VaryMetallicOnly()
     SetImguiValue('AreaLightSample/Min Max Metallic', Vector2(0.0, 1.0))
     SetImguiValue('AreaLightSample/Min Max Metallic', Vector2(0.0, 1.0))
 end
 end
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/AreaLights/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'AreaLights'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 SelectImageComparisonToleranceLevel("Level E")
 SelectImageComparisonToleranceLevel("Level E")
 
 
 OpenSample('Features/AreaLight')
 OpenSample('Features/AreaLight')
@@ -154,7 +154,7 @@ do
         materialSetupFunction()
         materialSetupFunction()
         
         
         IdleFrames(1) 
         IdleFrames(1) 
-        CaptureScreenshot(g_screenshotOutputFolder .. '/' .. lightName .. '_' .. materialName ..'.png')
+        CaptureScreenshot(g_testCaseFolder .. '/' .. lightName .. '_' .. materialName ..'.png')
     end
     end
 end
 end
 
 

+ 4 - 4
Scripts/AuxGeom.bv.lua

@@ -18,7 +18,7 @@ function TakeScreenShotBoxes()
     NoClipCameraController_SetPitch(DegToRad(20))
     NoClipCameraController_SetPitch(DegToRad(20))
 
 
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/auxgeom_boxes.png')
+    CaptureScreenshot(g_testCaseFolder .. '/auxgeom_boxes.png')
 end
 end
 
 
 function TakeScreenShotShapes()
 function TakeScreenShotShapes()
@@ -28,11 +28,11 @@ function TakeScreenShotShapes()
     NoClipCameraController_SetPitch(DegToRad(30))
     NoClipCameraController_SetPitch(DegToRad(30))
 
 
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/auxgeom_shapes.png')
+    CaptureScreenshot(g_testCaseFolder .. '/auxgeom_shapes.png')
 end
 end
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/AuxGeom/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'AuxGeom'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/AuxGeom')
 OpenSample('RPI/AuxGeom')
 ResizeViewport(800, 600)
 ResizeViewport(800, 600)

+ 3 - 3
Scripts/CheckerboardTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/Checkerboard/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'Checkerboard'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/Checkerboard')
 OpenSample('Features/Checkerboard')
 ResizeViewport(600, 600)
 ResizeViewport(600, 600)
@@ -21,6 +21,6 @@ SelectImageComparisonToleranceLevel("Level F")
 
 
 IdleFrames(10) 
 IdleFrames(10) 
 
 
-CaptureScreenshot(g_screenshotOutputFolder .. 'frame1.png')
+CaptureScreenshot(g_testCaseFolder .. 'frame1.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 3 - 3
Scripts/CullingAndLod.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/CullingAndLod/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'CullingAndLod'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/CullingAndLod')
 OpenSample('RPI/CullingAndLod')
 ResizeViewport(500, 500)
 ResizeViewport(500, 500)
@@ -21,7 +21,7 @@ SelectImageComparisonToleranceLevel("Level G")
 
 
 SetImguiValue("Begin Verification", true)
 SetImguiValue("Begin Verification", true)
 IdleFrames(5)
 IdleFrames(5)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_1.png')
 IdleFrames(1)
 IdleFrames(1)
 SetImguiValue("End Verification", true)
 SetImguiValue("End Verification", true)
 IdleFrames(1) -- make sure all outstanding imgui comamnds are processed before closing sample.
 IdleFrames(1) -- make sure all outstanding imgui comamnds are processed before closing sample.

+ 3 - 3
Scripts/Decals.bv.lua

@@ -12,11 +12,11 @@
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
 function TakeScreenshots()
 function TakeScreenshots()
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_decals.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_decals.png')
 end
 end
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/Decals/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'Decals';
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/Decals')
 OpenSample('RPI/Decals')
 ResizeViewport(1600, 900)
 ResizeViewport(1600, 900)

+ 3 - 3
Scripts/DepthOfFieldTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/DepthOfFieldTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'DepthOfFieldTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/DepthOfField')
 OpenSample('Features/DepthOfField')
 ResizeViewport(800, 600)
 ResizeViewport(800, 600)
@@ -20,6 +20,6 @@ SelectImageComparisonToleranceLevel("Level D")
 
 
 IdleSeconds(5)
 IdleSeconds(5)
 
 
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_depth_of_field.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_depth_of_field.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 3 - 3
Scripts/DiffuseGITest.bv.lua

@@ -14,8 +14,8 @@ RunScript("scripts/TestEnvironment.luac")
 if GetRenderApiName() == "vulkan" or GetRenderApiName() == "metal" then
 if GetRenderApiName() == "vulkan" or GetRenderApiName() == "metal" then
     Warning("Vulkan or metal is not supported by this test.")
     Warning("Vulkan or metal is not supported by this test.")
 else
 else
-    g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/DiffuseGITest/')
-    Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+    g_testCaseFolder = 'DiffuseGITest'
+    Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
     OpenSample('Features/DiffuseGI')
     OpenSample('Features/DiffuseGI')
     ResizeViewport(800, 600)
     ResizeViewport(800, 600)
@@ -23,7 +23,7 @@ else
 
 
     IdleSeconds(5)
     IdleSeconds(5)
 
 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_cornellbox.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_cornellbox.png')
 end
 end
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 3 - 3
Scripts/DynamicDraw.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/DynamicDraw/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'DynamicDraw'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/DynamicDraw')
 OpenSample('RPI/DynamicDraw')
 ResizeViewport(800, 500)
 ResizeViewport(800, 500)
@@ -20,6 +20,6 @@ ResizeViewport(800, 500)
 -- Vulkan's line width is different than dx12's 
 -- Vulkan's line width is different than dx12's 
 SelectImageComparisonToleranceLevel("Level F") 
 SelectImageComparisonToleranceLevel("Level F") 
 
 
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_1.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 4 - 4
Scripts/DynamicMaterialTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/DynamicMaterialTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'DynamicMaterialTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/DynamicMaterialTest')
 OpenSample('RPI/DynamicMaterialTest')
 ResizeViewport(1024, 768)
 ResizeViewport(1024, 768)
@@ -40,7 +40,7 @@ function TakeScreenshotSeries(filenamePrefix)
 
 
     SetImguiValue("Pause", true)
     SetImguiValue("Pause", true)
     IdleFrames(1) -- Give extra time to make sure any material changes are applied, especially in case an asset hot-load causes the material to reinitialize itself.
     IdleFrames(1) -- Give extra time to make sure any material changes are applied, especially in case an asset hot-load causes the material to reinitialize itself.
-    CaptureScreenshot(g_screenshotOutputFolder .. filenamePrefix .. '_A.png')
+    CaptureScreenshot(g_testCaseFolder .. '/' .. filenamePrefix .. '_A.png')
     SetImguiValue("Pause", false)
     SetImguiValue("Pause", false)
 
 
     -- Let the animation run for 1 second
     -- Let the animation run for 1 second
@@ -48,7 +48,7 @@ function TakeScreenshotSeries(filenamePrefix)
 
 
     SetImguiValue("Pause", true)
     SetImguiValue("Pause", true)
     IdleFrames(1) -- Give extra time to make sure any material changes are applied, especially in case an asset hot-load causes the material to reinitialize itself.
     IdleFrames(1) -- Give extra time to make sure any material changes are applied, especially in case an asset hot-load causes the material to reinitialize itself.
-    CaptureScreenshot(g_screenshotOutputFolder .. filenamePrefix .. '_B.png')
+    CaptureScreenshot(g_testCaseFolder .. '/' .. filenamePrefix .. '_B.png')
     SetImguiValue("Pause", false)
     SetImguiValue("Pause", false)
 end
 end
 
 

+ 3 - 3
Scripts/ExposureTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/ExposureTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'ExposureTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/Exposure')
 OpenSample('Features/Exposure')
 ResizeViewport(800, 600)
 ResizeViewport(800, 600)
@@ -21,6 +21,6 @@ SelectImageComparisonToleranceLevel("Level E")
 -- eye adaptation has a default speed. we are waiting 9 seconds for the sample to reach stable state
 -- eye adaptation has a default speed. we are waiting 9 seconds for the sample to reach stable state
 IdleSeconds(9)
 IdleSeconds(9)
 
 
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_exposure.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_exposure.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 3 - 3
Scripts/EyeMaterialTest.bv.lua

@@ -11,12 +11,12 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/EyeMaterial/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'EyeMaterial'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/EyeMaterial')
 OpenSample('Features/EyeMaterial')
 ResizeViewport(1600, 900)
 ResizeViewport(1600, 900)
 SelectImageComparisonToleranceLevel("Level F")
 SelectImageComparisonToleranceLevel("Level F")
 
 
 -- Test with default values
 -- Test with default values
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_eye.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_eye.png')

+ 8 - 8
Scripts/LightCulling.bv.lua

@@ -33,7 +33,7 @@ function TakeScreenshotPointLights()
 
 
     IdleFrames(1) 
     IdleFrames(1) 
 
 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_pointlights.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_pointlights.png')
 end
 end
 
 
 function TakeScreenshotDiskLights()
 function TakeScreenshotDiskLights()
@@ -44,7 +44,7 @@ function TakeScreenshotDiskLights()
     SetImguiValue('Disk Lights/Disk light count', 200)
     SetImguiValue('Disk Lights/Disk light count', 200)
     
     
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_disklights.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_disklights.png')
 end
 end
 
 
 function TakeScreenshotCapsuleLights()
 function TakeScreenshotCapsuleLights()
@@ -55,7 +55,7 @@ function TakeScreenshotCapsuleLights()
     SetImguiValue('Capsule Lights/Capsule light count', 200)
     SetImguiValue('Capsule Lights/Capsule light count', 200)
     
     
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_capsulelights.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_capsulelights.png')
 end
 end
 
 
 function TakeScreenshotQuadLights()
 function TakeScreenshotQuadLights()
@@ -69,7 +69,7 @@ function TakeScreenshotQuadLights()
     SetImguiValue('Quad Lights/Quad light height', 5)
     SetImguiValue('Quad Lights/Quad light height', 5)
     
     
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_quadlights.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_quadlights.png')
 end
 end
 
 
 
 
@@ -81,7 +81,7 @@ function TakeScreenshotDecals()
     SetImguiValue('Decals/Decal count', 200)
     SetImguiValue('Decals/Decal count', 200)
     
     
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_decals.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_decals.png')
 end
 end
 
 
 function TakeScreenShotLookingStraightDown()
 function TakeScreenShotLookingStraightDown()
@@ -96,7 +96,7 @@ function TakeScreenShotLookingStraightDown()
     SetImguiValue('Point Lights/Point Intensity', 200)
     SetImguiValue('Point Lights/Point Intensity', 200)
 
 
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_lookingdown.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_lookingdown.png')
 end
 end
 
 
 function EnableOnlyTestHeatmap()
 function EnableOnlyTestHeatmap()
@@ -105,8 +105,8 @@ function EnableOnlyTestHeatmap()
     SetImguiValue('Heatmap/Opacity', 1.0)
     SetImguiValue('Heatmap/Opacity', 1.0)
 end
 end
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/LightCulling/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'LightCulling'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 SelectImageComparisonToleranceLevel("Level E")
 SelectImageComparisonToleranceLevel("Level E")
 
 
 OpenSample('Features/LightCulling')
 OpenSample('Features/LightCulling')

+ 3 - 3
Scripts/MSAA_RPI_Test.bv.lua

@@ -17,11 +17,11 @@ function TakeScreenShot4xCylinder()
     SetImguiValue('Model/ShaderBall', true)
     SetImguiValue('Model/ShaderBall', true)
     ArcBallCameraController_SetDistance(4.0)
     ArcBallCameraController_SetDistance(4.0)
     IdleFrames(10) -- Need a few frames to let all Ibl mip levels load in 
     IdleFrames(10) -- Need a few frames to let all Ibl mip levels load in 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_msaa4x_cylinder.png')
+    CaptureScreenshot(g_testCaseFolder .. '/screenshot_msaa4x_cylinder.png')
 end
 end
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/MSAA_RPI/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'MSAA_RPI'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/MSAA')
 OpenSample('RPI/MSAA')
 ResizeViewport(800, 600)
 ResizeViewport(800, 600)

+ 17 - 17
Scripts/MaterialHotReloadTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/MaterialHotReloadTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'MaterialHotReloadTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 g_assetFolder = "materials/hotreloadtest/temp/";
 g_assetFolder = "materials/hotreloadtest/temp/";
 
 
@@ -59,31 +59,31 @@ function SetBlendingOff()
     IdleForReload()
     IdleForReload()
 end
 end
 
 
-CaptureScreenshot(g_screenshotOutputFolder .. '/01_Default.png')
+CaptureScreenshot(g_testCaseFolder .. '/01_Default.png')
 
 
 SetColorRed()
 SetColorRed()
-CaptureScreenshot(g_screenshotOutputFolder .. '/02_Red.png')
+CaptureScreenshot(g_testCaseFolder .. '/02_Red.png')
 
 
 AssetTracking_Start()
 AssetTracking_Start()
 SetImguiValue('ColorA = Blue', true)
 SetImguiValue('ColorA = Blue', true)
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.material")
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.material")
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/03_Blue.png')
+CaptureScreenshot(g_testCaseFolder .. '/03_Blue.png')
 
 
 AssetTracking_Start()
 AssetTracking_Start()
 SetImguiValue('Default Colors', true)
 SetImguiValue('Default Colors', true)
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.material")
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.material")
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/04_DefaultAgain.png')
+CaptureScreenshot(g_testCaseFolder .. '/04_DefaultAgain.png')
 
 
 AssetTracking_Start()
 AssetTracking_Start()
 SetImguiValue('Wavy Lines', true)
 SetImguiValue('Wavy Lines', true)
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.materialtype")
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.materialtype")
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/05_WavyLines.png')
+CaptureScreenshot(g_testCaseFolder .. '/05_WavyLines.png')
 
 
 AssetTracking_Start()
 AssetTracking_Start()
 SetImguiValue('Vertical Pattern', true)
 SetImguiValue('Vertical Pattern', true)
@@ -91,10 +91,10 @@ AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.materialtype")
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shader")
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shader")
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/06_VerticalPattern.png')
+CaptureScreenshot(g_testCaseFolder .. '/06_VerticalPattern.png')
 
 
 SetBlendingOn()
 SetBlendingOn()
-CaptureScreenshot(g_screenshotOutputFolder .. '/07_BlendingOn.png')
+CaptureScreenshot(g_testCaseFolder .. '/07_BlendingOn.png')
 
 
 -- This will switch to showing the "Shader Variant: Fully Baked" message
 -- This will switch to showing the "Shader Variant: Fully Baked" message
 AssetTracking_Start()
 AssetTracking_Start()
@@ -102,7 +102,7 @@ SetImguiValue('ShaderVariantList/All', true)
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 3) -- Waiting for 3 products, the list asset and two variant assets
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 3) -- Waiting for 3 products, the list asset and two variant assets
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/08_Variants_All.png')
+CaptureScreenshot(g_testCaseFolder .. '/08_Variants_All.png')
 
 
 -- This will switch to showing the "Shader Variant: Root" message
 -- This will switch to showing the "Shader Variant: Root" message
 AssetTracking_Start()
 AssetTracking_Start()
@@ -110,7 +110,7 @@ SetImguiValue('ShaderVariantList/Only Straight Lines', true)
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 2) -- Waiting for 2 products, the list asset and one variant assets
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 2) -- Waiting for 2 products, the list asset and one variant assets
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/09_Variants_OnlyStraightLines.png')
+CaptureScreenshot(g_testCaseFolder .. '/09_Variants_OnlyStraightLines.png')
 
 
 -- This will switch to showing the "Shader Variant: Fully Baked" message again
 -- This will switch to showing the "Shader Variant: Fully Baked" message again
 AssetTracking_Start()
 AssetTracking_Start()
@@ -118,7 +118,7 @@ SetImguiValue('ShaderVariantList/Only Wavy Lines', true)
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 2) -- Waiting for 2 products, the list asset and one variant assets
 AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 2) -- Waiting for 2 products, the list asset and one variant assets
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/10_Variants_OnlyWavyLines.png')
+CaptureScreenshot(g_testCaseFolder .. '/10_Variants_OnlyWavyLines.png')
 
 
 -- This screenshot will be identical to the one above because the variants
 -- This screenshot will be identical to the one above because the variants
 -- are still loaded in memory even though they have been removed from disk
 -- are still loaded in memory even though they have been removed from disk
@@ -126,14 +126,14 @@ AssetTracking_Start()
 SetImguiValue('ShaderVariantList/None', true)
 SetImguiValue('ShaderVariantList/None', true)
 IdleSeconds(1.0) -- Idle for a bit to give time for the assets to disappear
 IdleSeconds(1.0) -- Idle for a bit to give time for the assets to disappear
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/11_Variants_None.png')
+CaptureScreenshot(g_testCaseFolder .. '/11_Variants_None.png')
 
 
 -- Now, changing the .shader file will force the shader to reload and will not find
 -- Now, changing the .shader file will force the shader to reload and will not find
 -- any baked variants, since we switched to "None" above, and so this screenshot will 
 -- any baked variants, since we switched to "None" above, and so this screenshot will 
 -- switch back to showing the "Shader Variant: Root" message.
 -- switch back to showing the "Shader Variant: Root" message.
 SetBlendingOff()
 SetBlendingOff()
 --[GFX TODO] This test is consistently failing due to an Asset Processor bug. Re-enable this test once that is fixed.
 --[GFX TODO] This test is consistently failing due to an Asset Processor bug. Re-enable this test once that is fixed.
---CaptureScreenshot(g_screenshotOutputFolder .. '/12_Variants_None_AfterUpdatingShader.png')
+--CaptureScreenshot(g_testCaseFolder .. '/12_Variants_None_AfterUpdatingShader.png')
 
 
 -- Here we prepare to test a specific edge case. First, the material should be using a full baked shader variant, so we set up that precondition and verify with a screenshot.
 -- Here we prepare to test a specific edge case. First, the material should be using a full baked shader variant, so we set up that precondition and verify with a screenshot.
 AssetTracking_Start()
 AssetTracking_Start()
@@ -142,7 +142,7 @@ AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 3)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleSeconds(3.0)
 IdleSeconds(3.0)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/13_Variants_All.png')
+CaptureScreenshot(g_testCaseFolder .. '/13_Variants_All.png')
 -- Now that the material is using a fully-baked variant, modify the .azsl file to force *everything* to rebuild. In the failure case, the runtime
 -- Now that the material is using a fully-baked variant, modify the .azsl file to force *everything* to rebuild. In the failure case, the runtime
 -- holds onto the old fully-baked variant even though a new root variant is available. In the correct case, the root variant should take priority
 -- holds onto the old fully-baked variant even though a new root variant is available. In the correct case, the root variant should take priority
 -- over the fully-baked variant because it is more recent.
 -- over the fully-baked variant because it is more recent.
@@ -154,7 +154,7 @@ AssetTracking_ExpectAsset(g_assetFolder .. "HotReloadTest.shadervariantlist", 3)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 AssetTracking_IdleUntilExpectedAssetsFinish(10)
 IdleSeconds(4.0)
 IdleSeconds(4.0)
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/14_HorizontalPattern.png')
+CaptureScreenshot(g_testCaseFolder .. '/14_HorizontalPattern.png')
 
 
 -- Test a specific scenario that was failing, where color changes fail to reload after making a shader change.
 -- Test a specific scenario that was failing, where color changes fail to reload after making a shader change.
 SetBlendingOn()
 SetBlendingOn()
@@ -163,7 +163,7 @@ SetBlendingOff()
 IdleForReload()
 IdleForReload()
 SetColorRed()
 SetColorRed()
 IdleForReload()
 IdleForReload()
-CaptureScreenshot(g_screenshotOutputFolder .. '/15_Red_AfterShaderReload.png')
+CaptureScreenshot(g_testCaseFolder .. '/15_Red_AfterShaderReload.png')
 
 
 -- Clear the service loop override back to the default delay
 -- Clear the service loop override back to the default delay
 ExecuteConsoleCommand("r_ShaderVariantAsyncLoader_ServiceLoopDelayOverride_ms 0")
 ExecuteConsoleCommand("r_ShaderVariantAsyncLoader_ServiceLoopDelayOverride_ms 0")

+ 14 - 14
Scripts/MaterialScreenshotTests.bv.lua

@@ -72,9 +72,9 @@ function GenerateMaterialScreenshot(imageComparisonThresholdLevel, materialName,
 
 
     options.screenshotFilename = string.lower(options.screenshotFilename)
     options.screenshotFilename = string.lower(options.screenshotFilename)
     if type(options.uniqueSuffix) == "string" then
     if type(options.uniqueSuffix) == "string" then
-        filename = g_screenshotOutputFolder .. options.screenshotFilename .. '.' .. options.uniqueSuffix .. '.png'
+        filename = g_testCaseFolder .. '/' .. options.screenshotFilename .. '.' .. options.uniqueSuffix .. '.png'
     else
     else
-        filename = g_screenshotOutputFolder .. options.screenshotFilename .. '.png'
+        filename = g_testCaseFolder .. '/' .. options.screenshotFilename .. '.png'
     end
     end
     
     
     SelectImageComparisonToleranceLevel(imageComparisonThresholdLevel)
     SelectImageComparisonToleranceLevel(imageComparisonThresholdLevel)
@@ -93,8 +93,8 @@ SetImguiValue('Show Ground Plane', false)
 -- StandardPBR Materials...
 -- StandardPBR Materials...
 
 
 g_testMaterialsFolder = 'testdata/materials/standardpbrtestcases/'
 g_testMaterialsFolder = 'testdata/materials/standardpbrtestcases/'
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/StandardPBR/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'StandardPBR'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 GenerateMaterialScreenshot('Level C', '001_DefaultWhite')
 GenerateMaterialScreenshot('Level C', '001_DefaultWhite')
 GenerateMaterialScreenshot('Level G', '002_BaseColorLerp')
 GenerateMaterialScreenshot('Level G', '002_BaseColorLerp')
@@ -162,8 +162,8 @@ GenerateMaterialScreenshot('Level H', '105_DetailMaps_BlendMaskUsingDetailUVs',
 -- StandardMultilayerPBR Materials...
 -- StandardMultilayerPBR Materials...
 
 
 g_testMaterialsFolder = 'testdata/materials/standardmultilayerpbrtestcases/'
 g_testMaterialsFolder = 'testdata/materials/standardmultilayerpbrtestcases/'
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/StandardMultilayerPBR/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'StandardMultilayerPBR'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 GenerateMaterialScreenshot('Level I', '001_ManyFeatures', {model=g_cubeModel, cameraHeading=-125.0, cameraPitch=-16.0, cameraZ=0.12})
 GenerateMaterialScreenshot('Level I', '001_ManyFeatures', {model=g_cubeModel, cameraHeading=-125.0, cameraPitch=-16.0, cameraZ=0.12})
 GenerateMaterialScreenshot('Level I', '001_ManyFeatures_Layer2Off', {model=g_cubeModel, cameraHeading=-125.0, cameraPitch=-16.0, cameraZ=0.12})
 GenerateMaterialScreenshot('Level I', '001_ManyFeatures_Layer2Off', {model=g_cubeModel, cameraHeading=-125.0, cameraPitch=-16.0, cameraZ=0.12})
@@ -186,8 +186,8 @@ GenerateMaterialScreenshot('Level I', '005_UseDisplacement_With_BlendMaskTexture
 -- Skin Materials...
 -- Skin Materials...
 
 
 g_testMaterialsFolder = 'testdata/materials/skintestcases/'
 g_testMaterialsFolder = 'testdata/materials/skintestcases/'
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/Skin/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'Skin'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 -- We should eventually replace this with realistic skin test cases, these are just placeholders for regression testing
 -- We should eventually replace this with realistic skin test cases, these are just placeholders for regression testing
 GenerateMaterialScreenshot('Level D', '001_hermanubis_regression_test',    {model=g_modelHermanubis, cameraHeading=-26.0, cameraPitch=15.0, cameraDistance=2.0, cameraZ=0.7})
 GenerateMaterialScreenshot('Level D', '001_hermanubis_regression_test',    {model=g_modelHermanubis, cameraHeading=-26.0, cameraPitch=15.0, cameraDistance=2.0, cameraZ=0.7})
@@ -197,8 +197,8 @@ GenerateMaterialScreenshot('Level G', '002_wrinkle_regression_test', {model=g_mo
 -- MinimalPBR Materials...
 -- MinimalPBR Materials...
 
 
 g_testMaterialsFolder = 'materials/minimalpbr/'
 g_testMaterialsFolder = 'materials/minimalpbr/'
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/MinimalPBR/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'MinimalPBR'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 GenerateMaterialScreenshot('Level B', 'MinimalPbr_Default')
 GenerateMaterialScreenshot('Level B', 'MinimalPbr_Default')
 GenerateMaterialScreenshot('Level F', 'MinimalPbr_BlueMetal')
 GenerateMaterialScreenshot('Level F', 'MinimalPbr_BlueMetal')
@@ -209,16 +209,16 @@ GenerateMaterialScreenshot('Level D', 'MinimalPbr_RedDielectric')
 -- This test is here only temporarily for regression testing until StandardMultilayerPBR is refactored to use reused nested property groups.
 -- This test is here only temporarily for regression testing until StandardMultilayerPBR is refactored to use reused nested property groups.
 
 
 g_testMaterialsFolder = 'materials/types/'
 g_testMaterialsFolder = 'materials/types/'
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/MinimalPBR/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'MinimalPBR'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 GenerateMaterialScreenshot('Level G', 'MinimalMultilayerExample')
 GenerateMaterialScreenshot('Level G', 'MinimalMultilayerExample')
 
 
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 -- AutoBrick Materials...
 -- AutoBrick Materials...
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/AutoBrick/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'AutoBrick'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 g_testMaterialsFolder = 'testdata/materials/autobrick/'
 g_testMaterialsFolder = 'testdata/materials/autobrick/'
 
 

+ 4 - 4
Scripts/MultiRenderPipeline.bv.lua

@@ -11,18 +11,18 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/MultiRenderPipeline/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'MultiRenderPipeline'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 function TakeScreenShotForWindow1(fileName)
 function TakeScreenShotForWindow1(fileName)
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. fileName)
+    CaptureScreenshot(g_testCaseFolder .. '/' .. fileName)
 end
 end
 
 
 function TakeScreenShotForWindow2(fileName)
 function TakeScreenShotForWindow2(fileName)
     IdleFrames(1) 
     IdleFrames(1) 
     SetShowImGui(false)
     SetShowImGui(false)
-    CapturePassAttachment({"SecondPipeline", "CopyToSwapChain"}, "Output", g_screenshotOutputFolder .. fileName)
+    CapturePassAttachment({"SecondPipeline", "CopyToSwapChain"}, "Output", g_testCaseFolder .. '/' .. fileName)
     SetShowImGui(true)
     SetShowImGui(true)
 end
 end
 
 

+ 4 - 4
Scripts/MultiScene.bv.lua

@@ -11,17 +11,17 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/MultiScene/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'MultiScene'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 function TakeScreenShotFromPrimaryWindow(fileName)
 function TakeScreenShotFromPrimaryWindow(fileName)
     IdleFrames(1) 
     IdleFrames(1) 
-    CaptureScreenshot(g_screenshotOutputFolder .. fileName)
+    CaptureScreenshot(g_testCaseFolder .. '/' .. fileName)
 end
 end
 
 
 function TakeScreenShotFromSecondaryWindow(fileName)
 function TakeScreenShotFromSecondaryWindow(fileName)
     IdleFrames(1) 
     IdleFrames(1) 
-    CapturePassAttachment({"SecondPipeline", "CopyToSwapChain"}, "Output", g_screenshotOutputFolder .. fileName)
+    CapturePassAttachment({"SecondPipeline", "CopyToSwapChain"}, "Output", g_testCaseFolder .. '/' .. fileName)
 end
 end
 
 
 function WaitForDepthOfFieldFocus()
 function WaitForDepthOfFieldFocus()

+ 8 - 8
Scripts/ParallaxDepthArtifacts.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/ParallaxDepthArtifacts/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'ParallaxDepthArtifacts'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/Parallax')
 OpenSample('Features/Parallax')
 ResizeViewport(512, 512)
 ResizeViewport(512, 512)
@@ -37,31 +37,31 @@ ArcBallCameraController_SetDistance(3.000000)
 ArcBallCameraController_SetHeading(DegToRad(-38.356312))
 ArcBallCameraController_SetHeading(DegToRad(-38.356312))
 ArcBallCameraController_SetPitch(DegToRad(-2.705635))
 ArcBallCameraController_SetPitch(DegToRad(-2.705635))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_1.png')
 
 
 ArcBallCameraController_SetHeading(DegToRad(-66.861877))
 ArcBallCameraController_SetHeading(DegToRad(-66.861877))
 ArcBallCameraController_SetPitch(DegToRad(-4.933800))
 ArcBallCameraController_SetPitch(DegToRad(-4.933800))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_2.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_2.png')
 
 
 ArcBallCameraController_SetHeading(DegToRad(30.230936))
 ArcBallCameraController_SetHeading(DegToRad(30.230936))
 ArcBallCameraController_SetPitch(DegToRad(-3.819724))
 ArcBallCameraController_SetPitch(DegToRad(-3.819724))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_3.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_3.png')
 
 
 ArcBallCameraController_SetHeading(DegToRad(-140.709763))
 ArcBallCameraController_SetHeading(DegToRad(-140.709763))
 ArcBallCameraController_SetPitch(DegToRad(-3.501410))
 ArcBallCameraController_SetPitch(DegToRad(-3.501410))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_4.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_4.png')
 
 
 ArcBallCameraController_SetHeading(DegToRad(135.264740))
 ArcBallCameraController_SetHeading(DegToRad(135.264740))
 ArcBallCameraController_SetPitch(DegToRad(-2.387333))
 ArcBallCameraController_SetPitch(DegToRad(-2.387333))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_5.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_5.png')
 
 
 ArcBallCameraController_SetHeading(DegToRad(20.355005))
 ArcBallCameraController_SetHeading(DegToRad(20.355005))
 ArcBallCameraController_SetPitch(DegToRad(-4.456343))
 ArcBallCameraController_SetPitch(DegToRad(-4.456343))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_6.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_6.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 15 - 15
Scripts/ParallaxTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/ParallaxTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'ParallaxTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/Parallax')
 OpenSample('Features/Parallax')
 ResizeViewport(1600, 900)
 ResizeViewport(1600, 900)
@@ -24,7 +24,7 @@ SetImguiValue('Lighting/Direction', DegToRad(110))
 SetImguiValue('Parallax Setting/Heightmap Scale', 0.05)
 SetImguiValue('Parallax Setting/Heightmap Scale', 0.05)
 SetImguiValue('Parallax Setting/Enable Pdo', false)
 SetImguiValue('Parallax Setting/Enable Pdo', false)
 IdleFrames(2)
 IdleFrames(2)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_1.png')
 
 
 -- Test alternate UV streams...
 -- Test alternate UV streams...
 -- Purpose of 2 shots
 -- Purpose of 2 shots
@@ -34,15 +34,15 @@ CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
 -- the expected image of the second test is copied from screenshot_1.png
 -- the expected image of the second test is copied from screenshot_1.png
 SetImguiValue('Parallax Setting/UV', "UV1")
 SetImguiValue('Parallax Setting/UV', "UV1")
 IdleFrames(2)
 IdleFrames(2)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_2ndUv_1.png')
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_2ndUv_2.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_2ndUv_1.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_2ndUv_2.png')
 SetImguiValue('Parallax Setting/UV', "UV0")
 SetImguiValue('Parallax Setting/UV', "UV0")
 
 
 -- Test with PDO on, also Plane rotated...
 -- Test with PDO on, also Plane rotated...
 SetImguiValue('Parallax Setting/Enable Pdo', true)
 SetImguiValue('Parallax Setting/Enable Pdo', true)
 SetImguiValue('Plane Setting/Rotation', DegToRad(45))
 SetImguiValue('Plane Setting/Rotation', DegToRad(45))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_2.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_2.png')
 
 
 -- Algorithm "Relief", also Directional Light at 120 degrees and uv parameters changed
 -- Algorithm "Relief", also Directional Light at 120 degrees and uv parameters changed
 ArcBallCameraController_SetHeading(DegToRad(120))
 ArcBallCameraController_SetHeading(DegToRad(120))
@@ -56,7 +56,7 @@ SetImguiValue('Plane Setting/Offset V', 0.6)
 SetImguiValue('Plane Setting/Rotation UV', 275)
 SetImguiValue('Plane Setting/Rotation UV', 275)
 SetImguiValue('Plane Setting/Scale UV', 0.6)
 SetImguiValue('Plane Setting/Scale UV', 0.6)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_3.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_3.png')
 
 
 -- Algorithm Contact Refinement, also Directional Light at 240 degrees with uv parameters changed again 
 -- Algorithm Contact Refinement, also Directional Light at 240 degrees with uv parameters changed again 
 ArcBallCameraController_SetHeading(DegToRad(240))
 ArcBallCameraController_SetHeading(DegToRad(240))
@@ -70,7 +70,7 @@ SetImguiValue('Plane Setting/Offset V', -0.6)
 SetImguiValue('Plane Setting/Rotation UV', 138)
 SetImguiValue('Plane Setting/Rotation UV', 138)
 SetImguiValue('Plane Setting/Scale UV', 1.6)
 SetImguiValue('Plane Setting/Scale UV', 1.6)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_4.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_4.png')
 
 
 -- Algorithm "POM", switch to Spot Light 0 degree, also Plate rotated again 
 -- Algorithm "POM", switch to Spot Light 0 degree, also Plate rotated again 
 ArcBallCameraController_SetHeading(DegToRad(0))
 ArcBallCameraController_SetHeading(DegToRad(0))
@@ -78,7 +78,7 @@ SetImguiValue('Lighting/Spot Light', true)
 SetImguiValue('Parallax Setting/Algorithm', "POM")
 SetImguiValue('Parallax Setting/Algorithm', "POM")
 SetImguiValue('Plane Setting/Rotation', DegToRad(135))
 SetImguiValue('Plane Setting/Rotation', DegToRad(135))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_5.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_5.png')
 
 
 -- Algorithm "Relief", also Spot Light rotated with uv parameters changed again
 -- Algorithm "Relief", also Spot Light rotated with uv parameters changed again
 ArcBallCameraController_SetHeading(DegToRad(120))
 ArcBallCameraController_SetHeading(DegToRad(120))
@@ -92,7 +92,7 @@ SetImguiValue('Plane Setting/Offset V', 0.2)
 SetImguiValue('Plane Setting/Rotation UV', 125)
 SetImguiValue('Plane Setting/Rotation UV', 125)
 SetImguiValue('Plane Setting/Scale UV', 0.3)
 SetImguiValue('Plane Setting/Scale UV', 0.3)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_6.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_6.png')
 
 
 -- Algorithm "Contact Refinement" Spot Light rotated again, with uv parameter changed again
 -- Algorithm "Contact Refinement" Spot Light rotated again, with uv parameter changed again
 ArcBallCameraController_SetHeading(DegToRad(240))
 ArcBallCameraController_SetHeading(DegToRad(240))
@@ -106,7 +106,7 @@ SetImguiValue('Plane Setting/Offset V', -0.3)
 SetImguiValue('Plane Setting/Rotation UV', 74)
 SetImguiValue('Plane Setting/Rotation UV', 74)
 SetImguiValue('Plane Setting/Scale UV', 1.3)
 SetImguiValue('Plane Setting/Scale UV', 1.3)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_7.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_7.png')
 
 
 -- Test offset
 -- Test offset
 ArcBallCameraController_SetHeading(DegToRad(-135))
 ArcBallCameraController_SetHeading(DegToRad(-135))
@@ -116,21 +116,21 @@ SetImguiValue('Lighting/Direction', DegToRad(350))
 SetImguiValue('Parallax Setting/Heightmap Scale', 0.1)
 SetImguiValue('Parallax Setting/Heightmap Scale', 0.1)
 SetImguiValue('Parallax Setting/Offset', -0.1)
 SetImguiValue('Parallax Setting/Offset', -0.1)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_8_offset.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_8_offset.png')
 
 
 -- Test offset clipping
 -- Test offset clipping
 ArcBallCameraController_SetPitch(DegToRad(-15)) -- Use a harsh angle as that could reveal artifacts we've seen in the past and fixed.
 ArcBallCameraController_SetPitch(DegToRad(-15)) -- Use a harsh angle as that could reveal artifacts we've seen in the past and fixed.
 SetImguiValue('Parallax Setting/Offset', 0.05)
 SetImguiValue('Parallax Setting/Offset', 0.05)
 SetImguiValue('Parallax Setting/Show Clipping', true)
 SetImguiValue('Parallax Setting/Show Clipping', true)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_9_offsetClipping.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_9_offsetClipping.png')
 
 
 -- Testing a specific case where offset clamping was not calculated correctly, and clamped a bit below the surface instead of right on the surface.
 -- Testing a specific case where offset clamping was not calculated correctly, and clamped a bit below the surface instead of right on the surface.
 SetImguiValue('Parallax Setting/Offset', 0.06)
 SetImguiValue('Parallax Setting/Offset', 0.06)
 SetImguiValue('Parallax Setting/Heightmap Scale', 0.1)
 SetImguiValue('Parallax Setting/Heightmap Scale', 0.1)
 SetImguiValue('Parallax Setting/Algorithm', "Steep")
 SetImguiValue('Parallax Setting/Algorithm', "Steep")
 SetImguiValue('Parallax Setting/Show Clipping', true)
 SetImguiValue('Parallax Setting/Show Clipping', true)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_10_offsetClippingSteep.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_10_offsetClippingSteep.png')
 
 
 -- Test some different combinations that might result in divide-by-0 related crashes (which did happen at one point)
 -- Test some different combinations that might result in divide-by-0 related crashes (which did happen at one point)
 SetImguiValue('Parallax Setting/Offset', 0.0)
 SetImguiValue('Parallax Setting/Offset', 0.0)
@@ -154,6 +154,6 @@ ArcBallCameraController_SetHeading(1.95481825)
 ArcBallCameraController_SetPitch(-0.169443831)
 ArcBallCameraController_SetPitch(-0.169443831)
 ArcBallCameraController_SetDistance(6.000000)
 ArcBallCameraController_SetDistance(6.000000)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_11_problematicAngle.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_11_problematicAngle.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 3 - 3
Scripts/PassTree.bv.lua

@@ -11,15 +11,15 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/PassTree/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'PassTree'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 -- Select an attachment; take a screenshot with preview output (used for screenshot comparison); capture and save the attachment.
 -- Select an attachment; take a screenshot with preview output (used for screenshot comparison); capture and save the attachment.
 -- Note: each imgui value need 1 frame to apply the value. 
 -- Note: each imgui value need 1 frame to apply the value. 
 function TestAttachment(attachmentName, screenshotFileName)
 function TestAttachment(attachmentName, screenshotFileName)
     SetImguiValue(attachmentName, true)
     SetImguiValue(attachmentName, true)
     IdleFrames(2)
     IdleFrames(2)
-    CaptureScreenshotWithPreview(g_screenshotOutputFolder .. screenshotFileName)
+    CaptureScreenshotWithPreview(g_testCaseFolder .. '/' .. screenshotFileName)
     IdleFrames(1)
     IdleFrames(1)
     SetImguiValue('Save Attachment', true)
     SetImguiValue('Save Attachment', true)
     IdleFrames(3)
     IdleFrames(3)

+ 4 - 4
Scripts/ReadbackTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/Readback')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'Readback'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/Readback')
 OpenSample('RPI/Readback')
 
 
@@ -26,7 +26,7 @@ SetImguiValue('Height', 512)
 IdleFrames(1)
 IdleFrames(1)
 SetImguiValue('Readback', true)
 SetImguiValue('Readback', true)
 IdleFrames(5)
 IdleFrames(5)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_1.png')
 IdleFrames(1)
 IdleFrames(1)
 
 
 -- Then at 1024x1024
 -- Then at 1024x1024
@@ -36,7 +36,7 @@ SetImguiValue('Height', 1024)
 IdleFrames(1)
 IdleFrames(1)
 SetImguiValue('Readback', true)
 SetImguiValue('Readback', true)
 IdleFrames(5)
 IdleFrames(5)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_2.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_2.png')
 IdleFrames(1)
 IdleFrames(1)
 
 
 
 

+ 4 - 4
Scripts/RenderTargetTexture.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/RenderTargetTexture/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'RenderTargetTexture'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/RenderTargetTexture')
 OpenSample('RPI/RenderTargetTexture')
 SelectImageComparisonToleranceLevel("Level F") 
 SelectImageComparisonToleranceLevel("Level F") 
@@ -30,11 +30,11 @@ SetShowImGui(false)
 SetImguiValue('Show Preview', true)
 SetImguiValue('Show Preview', true)
 SetImguiValue('Next Frame', true)
 SetImguiValue('Next Frame', true)
 IdleFrames(1) 
 IdleFrames(1) 
-CaptureScreenshotWithPreview(g_screenshotOutputFolder .. '/screenshot_1.png')
+CaptureScreenshotWithPreview(g_testCaseFolder .. '/screenshot_1.png')
 
 
 SetImguiValue('Next Frame', true)
 SetImguiValue('Next Frame', true)
 IdleFrames(2) 
 IdleFrames(2) 
-CaptureScreenshotWithPreview(g_screenshotOutputFolder .. '/screenshot_2.png')
+CaptureScreenshotWithPreview(g_testCaseFolder .. '/screenshot_2.png')
 
 
 SetShowImGui(false)
 SetShowImGui(false)
 
 

+ 3 - 3
Scripts/SceneReloadSoakTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/SceneReloadSoakTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'SceneReloadSoakTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 -- First we capture a screenshot to make sure everything is rendering correctly...
 -- First we capture a screenshot to make sure everything is rendering correctly...
 LockFrameTime(1/30) -- frame lock on to get a consistent result
 LockFrameTime(1/30) -- frame lock on to get a consistent result
@@ -21,7 +21,7 @@ ResizeViewport(500, 500)
 NoClipCameraController_SetFov(DegToRad(90))
 NoClipCameraController_SetFov(DegToRad(90))
 IdleSeconds(1.0)
 IdleSeconds(1.0)
 SelectImageComparisonToleranceLevel("Level G")
 SelectImageComparisonToleranceLevel("Level G")
-CaptureScreenshot(g_screenshotOutputFolder .. 'screenshot.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot.png')
 
 
 -- Unlock the frame time now that we have our screen capture, so the actual "soaking" can happen at a natural rate
 -- Unlock the frame time now that we have our screen capture, so the actual "soaking" can happen at a natural rate
 UnlockFrameTime()
 UnlockFrameTime()

+ 17 - 17
Scripts/ShadowTest.bv.lua

@@ -47,7 +47,7 @@ function TestDirectionalLight()
     SetImguiValue('Size##Directional', '2048')
     SetImguiValue('Size##Directional', '2048')
     SetImguiValue('4', true) -- cascade count
     SetImguiValue('4', true) -- cascade count
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_initial.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_initial.png')
 
 
     -- Directional Light Manual Cascade Split
     -- Directional Light Manual Cascade Split
     SetImguiValue('Debug Coloring', true)
     SetImguiValue('Debug Coloring', true)
@@ -59,25 +59,25 @@ function TestDirectionalLight()
     IdleFrames(1)
     IdleFrames(1)
     SetImguiValue('FarDepth 2', 6.0)
     SetImguiValue('FarDepth 2', 6.0)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_manual_cascade.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_manual_cascade.png')
 
 
     -- Directional Light Automatic Cascade Split
     -- Directional Light Automatic Cascade Split
     SetImguiValue('Automatic Cascade Split', true)
     SetImguiValue('Automatic Cascade Split', true)
     IdleFrames(1)
     IdleFrames(1)
     SetImguiValue('Ratio', 0.25)
     SetImguiValue('Ratio', 0.25)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_auto_cascade.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_auto_cascade.png')
 
 
     -- Directional Light Cascade Position Correction
     -- Directional Light Cascade Position Correction
     SetImguiValue('Cascade Position Correction', true)
     SetImguiValue('Cascade Position Correction', true)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_cascade_correction.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_cascade_correction.png')
     SetImguiValue('Cascade Position Correction', false)
     SetImguiValue('Cascade Position Correction', false)
 
 
     -- Directional Light Cascade Position Correction
     -- Directional Light Cascade Position Correction
     SetImguiValue('Use Fullscreen Blur', true)
     SetImguiValue('Use Fullscreen Blur', true)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_fullscreen_blur.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_fullscreen_blur.png')
     SetImguiValue('Use Fullscreen Blur', false)
     SetImguiValue('Use Fullscreen Blur', false)
 
 
     -- Directional Light PCF low
     -- Directional Light PCF low
@@ -85,22 +85,22 @@ function TestDirectionalLight()
     SetImguiValue('Filter Method##Directional', 'PCF')
     SetImguiValue('Filter Method##Directional', 'PCF')
     SetImguiValue('Filtering # ##Directional', 4)
     SetImguiValue('Filtering # ##Directional', 4)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_pcf_low.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_pcf_low.png')
 
 
     -- Directional Light PCF high
     -- Directional Light PCF high
     SetImguiValue('Filtering # ##Directional', 64)
     SetImguiValue('Filtering # ##Directional', 64)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_pcf_high.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_pcf_high.png')
 
 
     -- Directional Light ESM
     -- Directional Light ESM
     SetImguiValue('Filter Method##Directional', 'ESM')
     SetImguiValue('Filter Method##Directional', 'ESM')
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_esm.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_esm.png')
 
 
     -- Directional Light ESM+PCF
     -- Directional Light ESM+PCF
     SetImguiValue('Filter Method##Directional', 'ESM+PCF')
     SetImguiValue('Filter Method##Directional', 'ESM+PCF')
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/directional_esm_pcf.png')
+    CaptureScreenshot(g_testCaseFolder .. '/directional_esm_pcf.png')
 end
 end
 
 
 function TestDiskLights()
 function TestDiskLights()
@@ -111,13 +111,13 @@ function TestDiskLights()
     -- Disabling directional light
     -- Disabling directional light
     SetImguiValue('Intensity##Directional', 0.0)
     SetImguiValue('Intensity##Directional', 0.0)
     EnablePositionalLights()
     EnablePositionalLights()
-    CaptureScreenshot(g_screenshotOutputFolder .. '/spot_initial.png')
+    CaptureScreenshot(g_testCaseFolder .. '/spot_initial.png')
 
 
     -- Positional Light Disabling Shadow for Red
     -- Positional Light Disabling Shadow for Red
     SetImguiValue('Red', true)
     SetImguiValue('Red', true)
     SetImguiValue('Enable Shadow', false)
     SetImguiValue('Enable Shadow', false)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/spot_no_red_shadow.png')
+    CaptureScreenshot(g_testCaseFolder .. '/spot_no_red_shadow.png')
 
 
     -- Positional Light Various Shadowmap Sizes
     -- Positional Light Various Shadowmap Sizes
     SetImguiValue('Red', true)
     SetImguiValue('Red', true)
@@ -131,7 +131,7 @@ function TestDiskLights()
     SetImguiValue('Blue', true)
     SetImguiValue('Blue', true)
     SetImguiValue('Size##Positional', '512')
     SetImguiValue('Size##Positional', '512')
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/spot_shadowmap_size.png')
+    CaptureScreenshot(g_testCaseFolder .. '/spot_shadowmap_size.png')
 
 
     -- Positional Light Various Filter Methods
     -- Positional Light Various Filter Methods
     SetImguiValue('Red', true)
     SetImguiValue('Red', true)
@@ -148,7 +148,7 @@ function TestDiskLights()
     IdleFrames(1)
     IdleFrames(1)
     SetImguiValue('Filtering # ##Positional', 64)
     SetImguiValue('Filtering # ##Positional', 64)
     IdleFrames(1)
     IdleFrames(1)
-    CaptureScreenshot(g_screenshotOutputFolder .. '/spot_filter_method.png')
+    CaptureScreenshot(g_testCaseFolder .. '/spot_filter_method.png')
 end
 end
 
 
 function TestPointLights()
 function TestPointLights()
@@ -160,11 +160,11 @@ function TestPointLights()
 
 
     EnablePositionalLights()
     EnablePositionalLights()
 
 
-    CaptureScreenshot(g_screenshotOutputFolder .. '/point_lights.png')
+    CaptureScreenshot(g_testCaseFolder .. '/point_lights.png')
 end
 end
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/Shadow/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'Shadow'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/Shadow')
 OpenSample('Features/Shadow')
 ResizeViewport(800, 600)
 ResizeViewport(800, 600)
@@ -177,7 +177,7 @@ SetImguiValue('Auto Rotation##Positional', false)
 SetImguiValue('Direction##Directional', 0.0)
 SetImguiValue('Direction##Directional', 0.0)
 SetImguiValue('Base Direction##Positional', 0.0)
 SetImguiValue('Base Direction##Positional', 0.0)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/initial.png')
+CaptureScreenshot(g_testCaseFolder .. '/initial.png')
 
 
 TestDirectionalLight()
 TestDirectionalLight()
 TestPointLights()
 TestPointLights()

+ 7 - 7
Scripts/ShadowedSponzaTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/ShadowedSponza/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'ShadowedSponza'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 
 
 function SetNumSpotlightsActive(num)
 function SetNumSpotlightsActive(num)
@@ -57,7 +57,7 @@ SelectImageComparisonToleranceLevel("Level H")
 
 
 -- Initial
 -- Initial
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/initial.png')
+CaptureScreenshot(g_testCaseFolder .. '/initial.png')
 
 
 SetNumSpotlightsActive(0)
 SetNumSpotlightsActive(0)
 SetDirectionalLightOrientation(-45, 95)
 SetDirectionalLightOrientation(-45, 95)
@@ -65,12 +65,12 @@ SetDirectionalLightOrientation(-45, 95)
 -- Directional Light None-filtering 
 -- Directional Light None-filtering 
 SetDirectionalNoneFiltering()
 SetDirectionalNoneFiltering()
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/directional_nofilter.png')
+CaptureScreenshot(g_testCaseFolder .. '/directional_nofilter.png')
 
 
 -- Directional Light Filtering 
 -- Directional Light Filtering 
 SetDirectionalFiltering()
 SetDirectionalFiltering()
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/directional_filter.png')
+CaptureScreenshot(g_testCaseFolder .. '/directional_filter.png')
 
 
 SetNumSpotlightsActive(17)
 SetNumSpotlightsActive(17)
 
 
@@ -78,11 +78,11 @@ SetNumSpotlightsActive(17)
 SetSpotNoneFiltering()
 SetSpotNoneFiltering()
 SetImguiValue('Intensity##directional', 0.0)
 SetImguiValue('Intensity##directional', 0.0)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/spot_nofilter.png')
+CaptureScreenshot(g_testCaseFolder .. '/spot_nofilter.png')
 
 
 -- Spot Light Filtering 
 -- Spot Light Filtering 
 SetSpotFiltering()
 SetSpotFiltering()
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/spot_filter.png')
+CaptureScreenshot(g_testCaseFolder .. '/spot_filter.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 3 - 3
Scripts/SkinnedMesh.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/SkinnedMesh/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'SkinnedMesh'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/SkinnedMesh')
 OpenSample('Features/SkinnedMesh')
 ResizeViewport(1600, 900)
 ResizeViewport(1600, 900)
@@ -29,6 +29,6 @@ SetImguiValue('Draw bones', false)
 NoClipCameraController_SetPosition(Vector3(-0.125466, -2.129441, 1.728536))
 NoClipCameraController_SetPosition(Vector3(-0.125466, -2.129441, 1.728536))
 NoClipCameraController_SetHeading(DegToRad(-8.116900))
 NoClipCameraController_SetHeading(DegToRad(-8.116900))
 NoClipCameraController_SetPitch(DegToRad(-31.035244))
 NoClipCameraController_SetPitch(DegToRad(-31.035244))
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_skinnedmesh.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_skinnedmesh.png')
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 5 - 5
Scripts/StreamingImageTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/StreamingImage/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'StreamingImage'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('RPI/StreamingImage')
 OpenSample('RPI/StreamingImage')
 ResizeViewport(900, 900)
 ResizeViewport(900, 900)
@@ -20,18 +20,18 @@ ResizeViewport(900, 900)
 SelectImageComparisonToleranceLevel("Level H")
 SelectImageComparisonToleranceLevel("Level H")
 
 
 -- capture screenshot with all 2d images
 -- capture screenshot with all 2d images
-CaptureScreenshot(g_screenshotOutputFolder .. 'Streaming2dImages.png')
+CaptureScreenshot(g_testCaseFolder .. '/Streaming2dImages.png')
 
 
 -- capture screenshot for hot loading
 -- capture screenshot for hot loading
 SetImguiValue('Switch texture', true)
 SetImguiValue('Switch texture', true)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. 'HotReloading.png')
+CaptureScreenshot(g_testCaseFolder .. '/HotReloading.png')
 
 
 
 
 -- capture screenshot for 3d images
 -- capture screenshot for 3d images
 SetImguiValue('View 3D Images', true)
 SetImguiValue('View 3D Images', true)
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. 'Streaming3dImage.png')
+CaptureScreenshot(g_testCaseFolder .. '/Streaming3dImage.png')
 
 
 
 
 OpenSample(nil)
 OpenSample(nil)

+ 6 - 5
Scripts/TestEnvironment.lua

@@ -1,8 +1,9 @@
 g_renderApiName = GetRenderApiName()
 g_renderApiName = GetRenderApiName()
 
 
--- surround the actual env so that it won't match other part of the path when IO is operating the file path.
-stringCollisionProtector = '___'
+g_screenshotOutputFolder = '@user@/Scripts/Screenshots/'
+testEnv = GetRenderApiName()
 
 
-g_testEnv = stringCollisionProtector .. g_renderApiName .. stringCollisionProtector;
-
-SetTestEnvPath(g_testEnv)
+SetScreenshotFolder(g_screenshotOutputFolder)
+SetTestEnvPath(testEnv)
+SetLocalBaselineImageFolder('@user@/Scripts/Screenshotslocalbaseline/')
+SetOfficialBaselineImageFolder('@projectroot@/Scripts/Expectedscreenshots/')

+ 4 - 4
Scripts/TransparentTest.bv.lua

@@ -11,8 +11,8 @@
 
 
 RunScript("scripts/TestEnvironment.luac")
 RunScript("scripts/TestEnvironment.luac")
 
 
-g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/TransparentTest/')
-Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
+g_testCaseFolder = 'TransparentTest'
+Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
 
 
 OpenSample('Features/Transparency')
 OpenSample('Features/Transparency')
 ResizeViewport(500, 500)
 ResizeViewport(500, 500)
@@ -22,10 +22,10 @@ ArcBallCameraController_SetDistance(2.0)
 ArcBallCameraController_SetHeading(DegToRad(45))
 ArcBallCameraController_SetHeading(DegToRad(45))
 ArcBallCameraController_SetPitch(DegToRad(-35))
 ArcBallCameraController_SetPitch(DegToRad(-35))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_front.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_front.png')
 
 
 ArcBallCameraController_SetHeading(DegToRad(135))
 ArcBallCameraController_SetHeading(DegToRad(135))
 IdleFrames(1)
 IdleFrames(1)
-CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_back.png')
+CaptureScreenshot(g_testCaseFolder .. '/screenshot_back.png')
 
 
 OpenSample(nil)
 OpenSample(nil)