From f24a0a6c8313d88c37fd73ae120cb75b9ffc0743 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Wed, 8 Oct 2025 13:27:39 -0400 Subject: [PATCH 01/12] test render mac --- .github/workflows/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89ed88e7ef..232b5b4056 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,6 +73,7 @@ jobs: compiler_version: "16.4" python: 3.13 test_shaders: ON + test_render: ON - name: MacOS_Xcode_26_Python313 os: macos-26 @@ -82,6 +83,13 @@ jobs: static_analysis: ON cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: MacOS_Xcode_26_RenderTests + os: macos-26 + compiler: xcode + compiler_version: "26.0" + python: 3.13 + test_render: ON + - name: MacOS_Xcode_DynamicAnalysis os: macos-26 compiler: xcode @@ -247,6 +255,13 @@ jobs: echo "DISPLAY=:1" >> $GITHUB_ENV echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV + - name: Initialize Headless Rendering (macOS) + if: matrix.test_render == 'ON' && runner.os == 'macOS' + run: | + # macOS can render headlessly with Metal backend without virtual display + # Force software rendering for OpenGL backend compatibility + echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV + - name: Render Script Tests if: matrix.test_render == 'ON' run: | From 73f9878516ad295401b8c10ab495c5fc78fbdc39 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Wed, 8 Oct 2025 13:42:53 -0400 Subject: [PATCH 02/12] Test MTL not GL. --- .github/workflows/main.yml | 95 ++------------------------------------ 1 file changed, 4 insertions(+), 91 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 232b5b4056..af35cfeb33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,54 +18,6 @@ jobs: fail-fast: false matrix: include: - - name: Linux_GCC_10_Python39 - os: ubuntu-22.04 - compiler: gcc - compiler_version: "10" - python: 3.9 - cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON -DMATERIALX_BUILD_MONOLITHIC=ON - - - name: Linux_GCC_14_Python312 - os: ubuntu-24.04 - compiler: gcc - compiler_version: "14" - python: 3.12 - - - name: Linux_GCC_14_Python313 - os: ubuntu-24.04 - compiler: gcc - compiler_version: "14" - python: 3.13 - test_render: ON - - - name: Linux_GCC_CoverageAnalysis - os: ubuntu-24.04 - compiler: gcc - compiler_version: "None" - python: None - coverage_analysis: ON - cmake_config: -DMATERIALX_COVERAGE_ANALYSIS=ON -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_PYTHON=OFF - - - name: Linux_Clang_13_Python39 - os: ubuntu-22.04 - compiler: clang - compiler_version: "13" - python: 3.9 - cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON - - - name: Linux_Clang_18_Python313 - os: ubuntu-24.04 - compiler: clang - compiler_version: "18" - python: 3.13 - clang_format: ON - - - name: MacOS_Xcode_15_Python311 - os: macos-14 - compiler: xcode - compiler_version: "15.4" - cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON - python: 3.11 - name: MacOS_Xcode_16_Python313 os: macos-15 @@ -75,14 +27,6 @@ jobs: test_shaders: ON test_render: ON - - name: MacOS_Xcode_26_Python313 - os: macos-26 - compiler: xcode - compiler_version: "26.0" - python: 3.13 - static_analysis: ON - cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - name: MacOS_Xcode_26_RenderTests os: macos-26 compiler: xcode @@ -90,41 +34,6 @@ jobs: python: 3.13 test_render: ON - - name: MacOS_Xcode_DynamicAnalysis - os: macos-26 - compiler: xcode - compiler_version: "26.0" - python: None - dynamic_analysis: ON - cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON - - - name: iOS_Xcode_26 - os: macos-26 - compiler: xcode - compiler_version: "26.0" - python: None - cmake_config: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` -DCMAKE_OSX_ARCHITECTURES=arm64 - - - name: Windows_VS2022_Win32_Python39 - os: windows-2022 - architecture: x86 - python: 3.9 - cmake_config: -G "Visual Studio 17 2022" -A "Win32" - - - name: Windows_VS2022_x64_Python313 - os: windows-2025 - architecture: x64 - python: 3.13 - cmake_config: -G "Visual Studio 17 2022" -A "x64" - test_shaders: ON - - - name: Windows_VS2022_x64_SharedLibs - os: windows-2025 - architecture: x64 - python: None - cmake_config: -G "Visual Studio 17 2022" -A "x64" -DMATERIALX_BUILD_SHARED_LIBS=ON - upload_shaders: ON - steps: - name: Sync Repository uses: actions/checkout@v4 @@ -259,6 +168,10 @@ jobs: if: matrix.test_render == 'ON' && runner.os == 'macOS' run: | # macOS can render headlessly with Metal backend without virtual display + # Force software rendering for Metal backend (more reliable in CI) + echo "MTL_HARDWARE_RENDERING=0" >> $GITHUB_ENV + # Enable Metal debug layer for better debugging in CI + echo "MTL_DEBUG_LAYER=1" >> $GITHUB_ENV # Force software rendering for OpenGL backend compatibility echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV From b08e86df4fbcb636544833cdefd9199c4ea92511 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Wed, 8 Oct 2025 14:13:56 -0400 Subject: [PATCH 03/12] Try to patch graph editor for headless. --- source/MaterialXGraphEditor/Main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/MaterialXGraphEditor/Main.cpp b/source/MaterialXGraphEditor/Main.cpp index 6001f222b4..1a174dd25e 100644 --- a/source/MaterialXGraphEditor/Main.cpp +++ b/source/MaterialXGraphEditor/Main.cpp @@ -167,6 +167,12 @@ int main(int argc, char* const argv[]) glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); #endif + // For headless operation (when captureFilename is specified), make window invisible + if (!captureFilename.empty()) + { + glfwWindowHint(GLFW_VISIBLE, GL_FALSE); + } + // Create window with graphics context GLFWwindow* window = glfwCreateWindow(1280, 960, "MaterialX Graph Editor", NULL, NULL); if (!window) From 0887bf86ab20a44e81c37d669c6b24d37c1c8820 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Wed, 8 Oct 2025 14:34:20 -0400 Subject: [PATCH 04/12] Nix grap editor to see if some results come back. --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af35cfeb33..b241d596d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -187,7 +187,6 @@ jobs: run: | ../installed/bin/MaterialXView --material brass_average_baked.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_BrassAverage.png ../installed/bin/MaterialXView --material usd_preview_surface_carpaint.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_CarpaintTranslated.png - ../installed/bin/MaterialXGraphEditor --material ../../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --viewWidth 128 --viewHeight 128 --captureFilename GraphEditor_MarbleSolid.png working-directory: build/render - name: Upload Installed Package From ffa0708a7b942ab44303145e16a38586e3fbcea6 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Thu, 13 Nov 2025 10:59:22 -0500 Subject: [PATCH 05/12] Disable GraphEditor in CI for Mac since it's not running Metal. Try to main GraphEditor headless a bit more robust. --- .github/workflows/main.yml | 5 +++++ source/MaterialXGraphEditor/Main.cpp | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f999bb00e..b5586221c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -295,6 +295,11 @@ jobs: run: | ../installed/bin/MaterialXView --material brass_average_baked.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_BrassAverage.png ../installed/bin/MaterialXView --material usd_preview_surface_carpaint.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_CarpaintTranslated.png + working-directory: build/render + + - name: Render Application Tests (GraphEditor - Linux only) + if: matrix.test_render == 'ON' && runner.os == 'Linux' + run: | ../installed/bin/MaterialXGraphEditor --material ../../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --viewWidth 128 --viewHeight 128 --captureFilename GraphEditor_MarbleSolid.png working-directory: build/render diff --git a/source/MaterialXGraphEditor/Main.cpp b/source/MaterialXGraphEditor/Main.cpp index 1a174dd25e..7fbcb5c891 100644 --- a/source/MaterialXGraphEditor/Main.cpp +++ b/source/MaterialXGraphEditor/Main.cpp @@ -170,7 +170,12 @@ int main(int argc, char* const argv[]) // For headless operation (when captureFilename is specified), make window invisible if (!captureFilename.empty()) { - glfwWindowHint(GLFW_VISIBLE, GL_FALSE); + glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); +#if defined(__APPLE__) + // On macOS, when running headless we need to allow fallback to software rendering + // to avoid "Failed to find a suitable pixel format" errors in CI environments + glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE); +#endif } // Create window with graphics context From 78b0e01df0e6d8d6a0217eb835bb5bed5b4f4085 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Thu, 13 Nov 2025 11:01:41 -0500 Subject: [PATCH 06/12] Try with software GL first. --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5586221c9..e5388d413b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -297,8 +297,9 @@ jobs: ../installed/bin/MaterialXView --material usd_preview_surface_carpaint.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_CarpaintTranslated.png working-directory: build/render - - name: Render Application Tests (GraphEditor - Linux only) - if: matrix.test_render == 'ON' && runner.os == 'Linux' + - name: Render Application Tests + if: matrix.test_render == 'ON' + # && runner.os == 'Linux' run: | ../installed/bin/MaterialXGraphEditor --material ../../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --viewWidth 128 --viewHeight 128 --captureFilename GraphEditor_MarbleSolid.png working-directory: build/render From c63855d58769f82979af8f2665427b7319606c83 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Thu, 13 Nov 2025 13:26:11 -0500 Subject: [PATCH 07/12] Try runnin MSL renders in CI. --- .github/workflows/main.yml | 13 +++++++++---- CMakeLists.txt | 27 ++++++++++++++++++++++++--- source/MaterialXGraphEditor/Main.cpp | 5 ----- source/MaterialXView/CMakeLists.txt | 7 ++++++- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e5388d413b..61f623ee10 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -204,7 +204,13 @@ jobs: EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DMATERIALX_MDL_SDK_DIR=C:/vcpkg/installed/x64-windows" fi fi - cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_BUILD_TESTS=ON -DMATERIALX_TEST_RENDER=OFF -DMATERIALX_WARNINGS_AS_ERRORS=ON $EXTENDED_BUILD_CONFIG ${{matrix.cmake_config}} + TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=OFF" + if [ "${{ matrix.test_render }}" == "ON" ]; then + if [ "${{ runner.os }}" == "macOS" ]; then + TEST_RENDER_CONFIG="$TEST_RENDER_CONFIG -DMATERIALX_TEST_RENDER=ON -DMATERIALX_RENDER_MSL_ONLY=ON" + fi + fi + cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_BUILD_TESTS=ON -DMATERIALX_WARNINGS_AS_ERRORS=ON $TEST_RENDER_CONFIG $EXTENDED_BUILD_CONFIG ${{matrix.cmake_config}} - name: CMake Build run: cmake --build build --target install --config Release --parallel 2 @@ -297,9 +303,8 @@ jobs: ../installed/bin/MaterialXView --material usd_preview_surface_carpaint.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_CarpaintTranslated.png working-directory: build/render - - name: Render Application Tests - if: matrix.test_render == 'ON' - # && runner.os == 'Linux' + - name: Render Application Tests (GraphEditor - Linux only) + if: matrix.test_render == 'ON' && runner.os == 'Linux' run: | ../installed/bin/MaterialXGraphEditor --material ../../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --viewWidth 128 --viewHeight 128 --captureFilename GraphEditor_MarbleSolid.png working-directory: build/render diff --git a/CMakeLists.txt b/CMakeLists.txt index a4bba653b7..5f0d05d91f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ option(MATERIALX_BUILD_GEN_MSL "Build the MSL shader generator back-end." ON) option(MATERIALX_BUILD_GEN_SLANG "Build the Slang shader generator back-end." ON) option(MATERIALX_BUILD_RENDER "Build the MaterialX Render modules." ON) option(MATERIALX_BUILD_RENDER_PLATFORMS "Build platform-specific render modules for each shader generator." ON) +option(MATERIALX_RENDER_MSL_ONLY "On macOS, render with Metal Shading Language only (disables GLSL rendering)." OFF) option(MATERIALX_BUILD_OIIO "Build OpenImageIO support for MaterialXRender." OFF) option(MATERIALX_BUILD_OCIO "Build OpenColorIO support for shader generators." OFF) option(MATERIALX_BUILD_TESTS "Build unit tests." OFF) @@ -112,6 +113,17 @@ if (MATERIALX_BUILD_JS) set(MATERIALX_BUILD_TESTS OFF) endif() +# Validate MSL-only rendering option +if(MATERIALX_RENDER_MSL_ONLY) + if(NOT APPLE) + message(FATAL_ERROR "MATERIALX_RENDER_MSL_ONLY can only be enabled on Apple platforms") + endif() + if(NOT MATERIALX_BUILD_GEN_MSL) + message(FATAL_ERROR "MATERIALX_RENDER_MSL_ONLY requires MATERIALX_BUILD_GEN_MSL to be enabled") + endif() + message(STATUS "MSL-only rendering mode enabled - GLSL rendering will be disabled") +endif() + # All hardware shading languages currently depend on the GLSL shader generator. if(MATERIALX_BUILD_GEN_MSL) set(MATERIALX_BUILD_GEN_GLSL ON) @@ -178,6 +190,7 @@ mark_as_advanced(MATERIALX_BUILD_GEN_MSL) mark_as_advanced(MATERIALX_BUILD_OSOS) mark_as_advanced(MATERIALX_BUILD_RENDER) mark_as_advanced(MATERIALX_BUILD_RENDER_PLATFORMS) +mark_as_advanced(MATERIALX_RENDER_MSL_ONLY) mark_as_advanced(MATERIALX_BUILD_OIIO) mark_as_advanced(MATERIALX_BUILD_OCIO) mark_as_advanced(MATERIALX_BUILD_BENCHMARK_TESTS) @@ -502,8 +515,11 @@ if(MATERIALX_BUILD_RENDER) if(MATERIALX_BUILD_RENDER_PLATFORMS) set(MATERIALX_BUILD_RENDER_HW OFF) if(MATERIALX_BUILD_GEN_GLSL AND NOT MATERIALX_BUILD_APPLE_EMBEDDED) - set(MATERIALX_BUILD_RENDER_HW ON) - add_subdirectory(source/MaterialXRenderGlsl) + # Skip GLSL rendering on macOS if MSL-only mode is enabled + if(NOT (APPLE AND MATERIALX_RENDER_MSL_ONLY)) + set(MATERIALX_BUILD_RENDER_HW ON) + add_subdirectory(source/MaterialXRenderGlsl) + endif() endif() if(MATERIALX_BUILD_GEN_MSL AND APPLE) set(MATERIALX_BUILD_RENDER_HW ON) @@ -523,7 +539,12 @@ if(MATERIALX_BUILD_RENDER) add_subdirectory(source/MaterialXView) endif() if(MATERIALX_BUILD_GRAPH_EDITOR) - add_subdirectory(source/MaterialXGraphEditor) + # Graph Editor currently requires GLSL rendering + if(APPLE AND MATERIALX_RENDER_MSL_ONLY) + message(WARNING "MaterialXGraphEditor requires GLSL rendering and will not be built when MATERIALX_RENDER_MSL_ONLY is enabled on macOS") + else() + add_subdirectory(source/MaterialXGraphEditor) + endif() endif() if(MATERIALX_INSTALL_RESOURCES AND NOT SKBUILD) add_subdirectory(resources) diff --git a/source/MaterialXGraphEditor/Main.cpp b/source/MaterialXGraphEditor/Main.cpp index 7fbcb5c891..c35474c8da 100644 --- a/source/MaterialXGraphEditor/Main.cpp +++ b/source/MaterialXGraphEditor/Main.cpp @@ -171,11 +171,6 @@ int main(int argc, char* const argv[]) if (!captureFilename.empty()) { glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); -#if defined(__APPLE__) - // On macOS, when running headless we need to allow fallback to software rendering - // to avoid "Failed to find a suitable pixel format" errors in CI environments - glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE); -#endif } // Create window with graphics context diff --git a/source/MaterialXView/CMakeLists.txt b/source/MaterialXView/CMakeLists.txt index f9f9eb256c..0bbad1ebef 100644 --- a/source/MaterialXView/CMakeLists.txt +++ b/source/MaterialXView/CMakeLists.txt @@ -11,7 +11,12 @@ if(APPLE) set(USE_OPENGL_BACKEND_ON_APPLE_PLATFORM ON) endif() - if(USE_OPENGL_BACKEND_ON_APPLE_PLATFORM) + # Force Metal backend if MSL-only rendering is enabled + if(MATERIALX_RENDER_MSL_ONLY) + set(USE_OPENGL_BACKEND_ON_APPLE_PLATFORM OFF) + set(NANOGUI_PREFERRED_BACKEND Metal) + set(MATERIALXVIEW_RENDER_BACKEND_DEFINITIONS "-DMATERIALXVIEW_METAL_BACKEND=1") + elseif(USE_OPENGL_BACKEND_ON_APPLE_PLATFORM) set(NANOGUI_PREFERRED_BACKEND OpenGL) set(MATERIALXVIEW_RENDER_BACKEND_DEFINITIONS "-DMATERIALXVIEW_OPENGL_BACKEND=1") else() From c2c04ab8c1a77817dfb1b89b08d5a33be373ed3b Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Thu, 13 Nov 2025 13:51:55 -0500 Subject: [PATCH 08/12] Fix logic. --- CMakeLists.txt | 18 +++++------------- source/MaterialXTest/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f0d05d91f..357270cc89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ option(MATERIALX_BUILD_GEN_MSL "Build the MSL shader generator back-end." ON) option(MATERIALX_BUILD_GEN_SLANG "Build the Slang shader generator back-end." ON) option(MATERIALX_BUILD_RENDER "Build the MaterialX Render modules." ON) option(MATERIALX_BUILD_RENDER_PLATFORMS "Build platform-specific render modules for each shader generator." ON) -option(MATERIALX_RENDER_MSL_ONLY "On macOS, render with Metal Shading Language only (disables GLSL rendering)." OFF) +option(MATERIALX_RENDER_MSL_ONLY "On macOS, use Metal Shading Language only for tests and viewer (skips GLSL render tests)." OFF) option(MATERIALX_BUILD_OIIO "Build OpenImageIO support for MaterialXRender." OFF) option(MATERIALX_BUILD_OCIO "Build OpenColorIO support for shader generators." OFF) option(MATERIALX_BUILD_TESTS "Build unit tests." OFF) @@ -121,7 +121,7 @@ if(MATERIALX_RENDER_MSL_ONLY) if(NOT MATERIALX_BUILD_GEN_MSL) message(FATAL_ERROR "MATERIALX_RENDER_MSL_ONLY requires MATERIALX_BUILD_GEN_MSL to be enabled") endif() - message(STATUS "MSL-only rendering mode enabled - GLSL rendering will be disabled") + message(STATUS "MSL-only testing mode enabled - MaterialXTest will not link MaterialXRenderGlsl") endif() # All hardware shading languages currently depend on the GLSL shader generator. @@ -515,11 +515,8 @@ if(MATERIALX_BUILD_RENDER) if(MATERIALX_BUILD_RENDER_PLATFORMS) set(MATERIALX_BUILD_RENDER_HW OFF) if(MATERIALX_BUILD_GEN_GLSL AND NOT MATERIALX_BUILD_APPLE_EMBEDDED) - # Skip GLSL rendering on macOS if MSL-only mode is enabled - if(NOT (APPLE AND MATERIALX_RENDER_MSL_ONLY)) - set(MATERIALX_BUILD_RENDER_HW ON) - add_subdirectory(source/MaterialXRenderGlsl) - endif() + set(MATERIALX_BUILD_RENDER_HW ON) + add_subdirectory(source/MaterialXRenderGlsl) endif() if(MATERIALX_BUILD_GEN_MSL AND APPLE) set(MATERIALX_BUILD_RENDER_HW ON) @@ -539,12 +536,7 @@ if(MATERIALX_BUILD_RENDER) add_subdirectory(source/MaterialXView) endif() if(MATERIALX_BUILD_GRAPH_EDITOR) - # Graph Editor currently requires GLSL rendering - if(APPLE AND MATERIALX_RENDER_MSL_ONLY) - message(WARNING "MaterialXGraphEditor requires GLSL rendering and will not be built when MATERIALX_RENDER_MSL_ONLY is enabled on macOS") - else() - add_subdirectory(source/MaterialXGraphEditor) - endif() + add_subdirectory(source/MaterialXGraphEditor) endif() if(MATERIALX_INSTALL_RESOURCES AND NOT SKBUILD) add_subdirectory(resources) diff --git a/source/MaterialXTest/CMakeLists.txt b/source/MaterialXTest/CMakeLists.txt index 1825420d51..1da03b9060 100644 --- a/source/MaterialXTest/CMakeLists.txt +++ b/source/MaterialXTest/CMakeLists.txt @@ -69,7 +69,7 @@ endif() if(MATERIALX_BUILD_RENDER) add_subdirectory(MaterialXRender) target_link_libraries(MaterialXTest MaterialXRender) - if(MATERIALX_BUILD_GEN_GLSL) + if(MATERIALX_BUILD_GEN_GLSL AND NOT MATERIALX_RENDER_MSL_ONLY) add_subdirectory(MaterialXRenderGlsl) target_link_libraries(MaterialXTest MaterialXRenderGlsl) endif() From f5dc764a24213eadb8f96614a23eb1dab550345a Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Thu, 13 Nov 2025 14:19:51 -0500 Subject: [PATCH 09/12] Packge resources if rendering. --- .github/workflows/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61f623ee10..3edf428dea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -337,6 +337,19 @@ jobs: name: Renders_${{ matrix.name }} path: build/render/*.png + - name: Archive Resources (macOS) + if: matrix.test_render == 'ON' && runner.os == 'macOS' + run: | + mkdir -p build/artifacts + zip -r build/artifacts/resources.zip resources + + - name: Upload Resources Archive (macOS) + uses: actions/upload-artifact@v4 + if: matrix.test_render == 'ON' && runner.os == 'macOS' + with: + name: Resources_${{ matrix.name }} + path: build/artifacts/resources.zip + - name: Upload Coverage Report uses: actions/upload-artifact@v4 if: matrix.coverage_analysis == 'ON' From c2931e5dc5683ab6b768ccc5fbe96d6bff8353b3 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Thu, 13 Nov 2025 14:41:04 -0500 Subject: [PATCH 10/12] Fix archive / upload step. --- .github/workflows/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3edf428dea..8dd1f3cb33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -341,7 +341,13 @@ jobs: if: matrix.test_render == 'ON' && runner.os == 'macOS' run: | mkdir -p build/artifacts - zip -r build/artifacts/resources.zip resources + if [ ! -d build/bin/resources ]; then + echo "Missing build/bin/resources" + echo "Contents of build/bin (if present):" + ls -la build/bin || true + exit 1 + fi + zip -r build/artifacts/resources.zip build/bin/resources - name: Upload Resources Archive (macOS) uses: actions/upload-artifact@v4 From b027f4f3f7c8ed7eb79957bb8458d6cd21513dcc Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Tue, 18 Nov 2025 16:04:44 -0500 Subject: [PATCH 11/12] Simplify resources upload. --- .github/workflows/main.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07d63c2647..f1f836c5e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -337,24 +337,12 @@ jobs: name: Renders_${{ matrix.name }} path: build/render/*.png - - name: Archive Resources (macOS) - if: matrix.test_render == 'ON' && runner.os == 'macOS' - run: | - mkdir -p build/artifacts - if [ ! -d build/bin/resources ]; then - echo "Missing build/bin/resources" - echo "Contents of build/bin (if present):" - ls -la build/bin || true - exit 1 - fi - zip -r build/artifacts/resources.zip build/bin/resources - - - name: Upload Resources Archive (macOS) + - name: Upload Resources (MacOS) uses: actions/upload-artifact@v4 if: matrix.test_render == 'ON' && runner.os == 'macOS' with: name: Resources_${{ matrix.name }} - path: build/artifacts/resources.zip + path: build/bin/resources - name: Upload Coverage Report uses: actions/upload-artifact@v4 From d8df2c9b9baf9b52613aeadf16f82f822c8de5f9 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Tue, 18 Nov 2025 22:03:40 -0500 Subject: [PATCH 12/12] Combine render build flags into EXTENDED_BUILD_CONFIG list. --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f1f836c5e6..e758bfa45e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -193,6 +193,7 @@ jobs: - name: CMake Generate shell: bash run: | + EXTENDED_BUILD_CONFIG="" if [ "${{ env.IS_EXTENDED_BUILD }}" == "true" ]; then if [ "${{ runner.os }}" == "Windows" ]; then EXTENDED_BUILD_CONFIG="-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows" @@ -207,10 +208,11 @@ jobs: TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=OFF" if [ "${{ matrix.test_render }}" == "ON" ]; then if [ "${{ runner.os }}" == "macOS" ]; then - TEST_RENDER_CONFIG="$TEST_RENDER_CONFIG -DMATERIALX_TEST_RENDER=ON -DMATERIALX_RENDER_MSL_ONLY=ON" + TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=ON -DMATERIALX_RENDER_MSL_ONLY=ON" fi fi - cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_BUILD_TESTS=ON -DMATERIALX_WARNINGS_AS_ERRORS=ON $TEST_RENDER_CONFIG $EXTENDED_BUILD_CONFIG ${{matrix.cmake_config}} + EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG $TEST_RENDER_CONFIG" + cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_BUILD_TESTS=ON -DMATERIALX_WARNINGS_AS_ERRORS=ON $EXTENDED_BUILD_CONFIG ${{matrix.cmake_config}} - name: CMake Build run: cmake --build build --target install --config Release --parallel 2