From 2df831041d741ffaf6e8d8de38102198618fb2f0 Mon Sep 17 00:00:00 2001 From: Patrick Hodoul Date: Thu, 4 Dec 2025 15:43:04 -0500 Subject: [PATCH 1/2] OGSMOD-7812 - Move back MaterialUtils in Components Signed-off-by: Patrick Hodoul --- test/RenderingFramework/AndroidTestContext.cpp | 7 ++----- test/RenderingFramework/MetalTestContext.mm | 9 +++------ test/RenderingFramework/OpenGLTestContext.cpp | 13 +++---------- test/RenderingFramework/TestHelpers.h | 6 ------ test/RenderingFramework/VulkanTestContext.cpp | 12 +++--------- 5 files changed, 11 insertions(+), 36 deletions(-) diff --git a/test/RenderingFramework/AndroidTestContext.cpp b/test/RenderingFramework/AndroidTestContext.cpp index e68c5e3..3aea844 100644 --- a/test/RenderingFramework/AndroidTestContext.cpp +++ b/test/RenderingFramework/AndroidTestContext.cpp @@ -99,7 +99,7 @@ void VulkanRendererContext::waitForGPUIdle() bool VulkanRendererContext::saveImage(const std::string& fileName) { - static const std::filesystem::path filePath = TestHelpers::getOutputDataFolder(); + const std::filesystem::path filePath = TestHelpers::getOutputDataFolder(); const std::filesystem::path screenShotPath = getFilename(filePath, fileName + "_computed"); const std::filesystem::path directory = screenShotPath.parent_path(); if (!std::filesystem::exists(directory)) @@ -329,8 +329,7 @@ AndroidTestContext::AndroidTestContext(int w, int h) : TestContext(w, h) void AndroidTestContext::init() { - std::string localAppPath = getenv("HVT_TEST_ASSETS"); - _sceneFilepath = localAppPath + "/usd/test_fixed.usda"; + _sceneFilepath = (TestHelpers::getAssetsDataFolder() / "usd/test_fixed.usda").string(); // Create the renderer context required for Hydra. _backend = std::make_shared(_width, _height); @@ -338,8 +337,6 @@ void AndroidTestContext::init() { throw std::runtime_error("Failed to initialize the unit test backend!"); } - - _backend->setDataPath(localAppPath); } } // namespace TestHelpers diff --git a/test/RenderingFramework/MetalTestContext.mm b/test/RenderingFramework/MetalTestContext.mm index 6b871d5..3828f05 100644 --- a/test/RenderingFramework/MetalTestContext.mm +++ b/test/RenderingFramework/MetalTestContext.mm @@ -358,9 +358,8 @@ void composeToFrameBuffer( { // Creates the root destination path if needed. - const std::filesystem::path dirPath = documentDirectoryPath() + "/Data"; - // The fileName could contain part of the directory path. - const std::filesystem::path fullFilePath = getFilename(dirPath, fileName + "_computed"); + const std::filesystem::path filePath = TestHelpers::getOutputDataFolder(); + const std::filesystem::path fullFilePath = getFilename(filePath, fileName + "_computed"); const std::filesystem::path directory = fullFilePath.parent_path(); NSFileManager* fileManager = [[NSFileManager alloc] init]; @@ -404,7 +403,7 @@ void composeToFrameBuffer( void MetalTestContext::init() { - _sceneFilepath = mainBundlePath() + "/data/assets/usd/test_fixed.usda"; + _sceneFilepath = (TestHelpers::getAssetsDataFolder() / "usd/test_fixed.usda").string(); // Create the renderer context required for Hydra. _backend = std::make_shared(_width, _height); @@ -412,8 +411,6 @@ void composeToFrameBuffer( { throw std::runtime_error("Failed to initialize the unit test backend!"); } - - _backend->setDataPath(mainBundlePath() + "/data/"); } } // namespace TestHelpers diff --git a/test/RenderingFramework/OpenGLTestContext.cpp b/test/RenderingFramework/OpenGLTestContext.cpp index 8b8b6ac..bda58bb 100644 --- a/test/RenderingFramework/OpenGLTestContext.cpp +++ b/test/RenderingFramework/OpenGLTestContext.cpp @@ -291,8 +291,7 @@ void OpenGLRendererContext::run( bool OpenGLRendererContext::saveImage(const std::string& fileName) { - static const std::filesystem::path filePath = TestHelpers::getOutputDataFolder(); - + const std::filesystem::path filePath = TestHelpers::getOutputDataFolder(); const std::filesystem::path screenShotPath = getFilename(filePath, fileName + "_computed"); // Make sure the parent directory exists. @@ -303,6 +302,7 @@ bool OpenGLRendererContext::saveImage(const std::string& fileName) std::vector image(width() * height() * 4, 100); glReadPixels(0, 0, width(), height(), GL_RGBA, GL_UNSIGNED_BYTE, image.data()); + // Write image. std::filesystem::remove(screenShotPath); @@ -328,9 +328,7 @@ OpenGLTestContext::OpenGLTestContext(int w, int h) : TestContext(w, h) void OpenGLTestContext::init() { - namespace fs = std::filesystem; - - _sceneFilepath = TOSTRING(HVT_TEST_DATA_PATH) + "/data/assets/usd/test_fixed.usda"; + _sceneFilepath = (TestHelpers::getAssetsDataFolder() / "usd/test_fixed.usda").string(); // Create the renderer context required for Hydra. _backend = std::make_shared(_width, _height); @@ -338,11 +336,6 @@ void OpenGLTestContext::init() { throw std::runtime_error("Failed to initialize the unit test backend!"); } - - fs::path dataPath = - std::filesystem::path(TOSTRING(HVT_TEST_DATA_PATH), fs::path::native_format); - dataPath.append("data/assets"); - _backend->setDataPath(dataPath); } } // namespace TestHelpers diff --git a/test/RenderingFramework/TestHelpers.h b/test/RenderingFramework/TestHelpers.h index e652404..901f4c9 100644 --- a/test/RenderingFramework/TestHelpers.h +++ b/test/RenderingFramework/TestHelpers.h @@ -142,9 +142,6 @@ class HydraRendererContext virtual bool compareOutputImages(const std::string& fileName1, const std::string& fileName2, const uint8_t threshold = 1, const uint16_t pixelCountThreshold = 0); - virtual void setDataPath(const std::filesystem::path& path) { _dataPath = path; } - virtual const std::filesystem::path& dataPath() const { return _dataPath; } - protected: pxr::HgiUniquePtr _hgi; bool _presentationEnabled = true; @@ -168,8 +165,6 @@ class HydraRendererContext int _width = 1; int _height = 1; - std::filesystem::path _dataPath; - pxr::HdDriver _hgiDriver; }; @@ -241,7 +236,6 @@ class TestContext int width() const { return _width; } int height() const { return _height; } bool presentationEnabled() const { return _usePresentationTask; } - const std::filesystem::path& dataPath() const { return _backend->dataPath(); } std::shared_ptr& backend() { return _backend; } // Render a single frame pass. diff --git a/test/RenderingFramework/VulkanTestContext.cpp b/test/RenderingFramework/VulkanTestContext.cpp index d2ec3f3..80bd75d 100644 --- a/test/RenderingFramework/VulkanTestContext.cpp +++ b/test/RenderingFramework/VulkanTestContext.cpp @@ -356,9 +356,8 @@ void VulkanRendererContext::waitForGPUIdle() bool VulkanRendererContext::saveImage(const std::string& fileName) { static const std::filesystem::path filePath = TestHelpers::getOutputDataFolder(); - - const std::filesystem::path screenShotPath = getFilename(filePath, fileName + "_computed"); - const std::filesystem::path directory = screenShotPath.parent_path(); + const std::filesystem::path screenShotPath = getFilename(filePath, fileName + "_computed"); + const std::filesystem::path directory = screenShotPath.parent_path(); if (!std::filesystem::exists(directory)) { if (!std::filesystem::create_directories(directory)) @@ -901,9 +900,7 @@ VulkanTestContext::VulkanTestContext(int w, int h) : TestContext(w, h) void VulkanTestContext::init() { - namespace fs = std::filesystem; - - _sceneFilepath = (fs::path(TOSTRING(HVT_TEST_DATA_PATH)) / "data/assets/usd/test_fixed.usda").string(); + _sceneFilepath = (TestHelpers::getAssetsDataFolder() / "usd/test_fixed.usda").string(); // Create the renderer context required for Hydra. _backend = std::make_shared(_width, _height); @@ -912,9 +909,6 @@ void VulkanTestContext::init() throw std::runtime_error("Failed to initialize the unit test backend!"); } - fs::path dataPath = fs::path(TOSTRING(TEST_HVT_DATA_PATH)) / "Data"; - _backend->setDataPath(dataPath); - // If the presentation task is enabled, interop-present task get involved. // Which for the Vulkan backend involves copying a Vulkan image to OpenGL // before presenting to an OpenGL context. This is against the intended From ec75e9cfccbaf3cb1878ab6a1820e4935ef50939 Mon Sep 17 00:00:00 2001 From: Patrick Hodoul Date: Thu, 4 Dec 2025 15:49:54 -0500 Subject: [PATCH 2/2] Fix glfw version mismatch Signed-off-by: Patrick Hodoul --- test/RenderingFramework/OpenGLTestContext.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/RenderingFramework/OpenGLTestContext.cpp b/test/RenderingFramework/OpenGLTestContext.cpp index bda58bb..908fb31 100644 --- a/test/RenderingFramework/OpenGLTestContext.cpp +++ b/test/RenderingFramework/OpenGLTestContext.cpp @@ -115,7 +115,10 @@ OpenGLWindow::OpenGLWindow(int w, int h) glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); + +#ifdef GLFW_SCALE_FRAMEBUFFER glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE); +#endif if (isCoreProfile()) {