-
Notifications
You must be signed in to change notification settings - Fork 419
Enable test suite rendering on Mac #2675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
f24a0a6
73f9878
b08e86d
0887bf8
da6b5c3
ffa0708
78b0e01
c63855d
c2c04ab
f5dc764
c2931e5
d53cbed
b027f4f
d8df2c9
2971942
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ jobs: | |
| compiler_version: "16.4" | ||
| python: 3.13 | ||
| test_shaders: ON | ||
| test_render: ON | ||
|
|
||
| - name: MacOS_Xcode_26_Python313 | ||
| os: macos-26 | ||
|
|
@@ -203,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 | ||
|
|
@@ -265,13 +272,23 @@ jobs: | |
| fi | ||
| cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/* | ||
|
|
||
| - name: Initialize Virtual Framebuffer | ||
| - name: Initialize Virtual Framebuffer (Linux) | ||
| if: matrix.test_render == 'ON' && runner.os == 'Linux' | ||
| run: | | ||
| Xvfb :1 -screen 0 1280x960x24 & | ||
| 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 headless 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 | ||
| echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV | ||
|
|
||
| - name: Render Script Tests | ||
| if: matrix.test_render == 'ON' | ||
| run: | | ||
|
|
@@ -284,6 +301,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 | ||
|
|
||
|
|
@@ -315,6 +337,25 @@ jobs: | |
| name: Renders_${{ matrix.name }} | ||
| path: build/render/*.png | ||
|
|
||
| - name: Archive Resources (macOS) | ||
| if: matrix.test_render == 'ON' && runner.os == 'macOS' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Post results. |
||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the motivation for manually generating a zip archive of the folder, rather than leveraging the built-in zip functionality in Would it make sense to align this with our other upload steps (e.g. Upload Reference Shaders, Upload Renders) and use the existing system in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I had this "cherry picking" images at one point but reverted that as it's better to produce a "results" folder as part of test. Will revert this to the simpler rule. |
||
|
|
||
| - 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' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, 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) | ||
|
|
@@ -112,6 +113,17 @@ if (MATERIALX_BUILD_JS) | |
| set(MATERIALX_BUILD_TESTS OFF) | ||
| endif() | ||
|
|
||
| # Validate MSL-only rendering option | ||
| if(MATERIALX_RENDER_MSL_ONLY) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turn off GLSL rendering. For some reason there a renderGLSL module dependency for renderMSL. Not touching that dependency here. |
||
| 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 testing mode enabled - MaterialXTest will not link MaterialXRenderGlsl") | ||
| 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) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turn off GLSL rendering if want MSL only |
||
| add_subdirectory(MaterialXRenderGlsl) | ||
| target_link_libraries(MaterialXTest MaterialXRenderGlsl) | ||
| endif() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key change: Turn on test rendering for MSL but not GLSL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can merge the existing
EXTENDED_BUILD_CONFIGwith your newTEST_RENDER_CONFIG, naming the combined variableADDITIONAL_BUILD_CONFIGfor generality?That should help to keep the final
cmake buildcall as compact and clear as possible, as it's becoming a bit hard to read!