Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 37 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
architecture: x64
python: 3.13
cmake_config: -G "Visual Studio 17 2022" -A "x64"
test_render: ON
extended_build_mdl_sdk: ON

- name: Windows_VS2022_x64_Python314
Expand Down Expand Up @@ -216,8 +217,9 @@ jobs:
fi
TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=OFF"
if [ "${{ matrix.test_render }}" == "ON" ]; then
TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=ON"
if [ "${{ runner.os }}" == "macOS" ]; then
TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=ON -DMATERIALX_RENDER_MSL_ONLY=ON"
TEST_RENDER_CONFIG="$TEST_RENDER_CONFIG -DMATERIALX_RENDER_MSL_ONLY=ON"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at our existing approach for platform-specific render tests, I'd probably recommend following the existing pattern of MATERIALX_RENDER_MSL_ONLY, which was added by @kwokcb to support render tests in MSL without activating all shading languages.

Taking this approach, we could simplify this new MDL-only render test in GitHub CI with a corresponding MATERIALX_RENDER_MDL_ONLY flag, which would be enabled in our nightly builds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I started I still had the impression that they ran originally (my MR back then also installed the required dependencies) and got disabled by accident, but with more and more CI runs and subsequent changes I also got to the conclusion that his was never the case. I'll look into your suggestion with MATERIALX_RENDER_MSL_ONLY.

fi
fi
EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG $TEST_RENDER_CONFIG"
Expand All @@ -226,8 +228,32 @@ jobs:
- name: CMake Build
run: cmake --build build --target install --config Release --parallel 2

- name: Setup Rendering Environment (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: Setup Rendering Environment (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: CMake Unit Tests
run: ctest -VV --output-on-failure --build-config Release
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
# Exclude renderglsl on Windows since there are no GPUs avilable in CI
ctest -VV --output-on-failure --build-config Release -E Render_GLSL
else
ctest -VV --output-on-failure --build-config Release
fi
working-directory: build

- name: Python Tests
Expand Down Expand Up @@ -286,32 +312,15 @@ jobs:
fi
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/* --suppress=*:*perfetto*

- name: Setup Rendering Environment (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: Setup Rendering Environment (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'
if: matrix.test_render == 'ON' && runner.os != 'Windows'
run: |
mkdir build/render
python python/Scripts/baketextures.py resources/Materials/Examples/StandardSurface/standard_surface_brass_tiled.mtlx build/render/brass_average_baked.mtlx --average
python python/Scripts/translateshader.py resources/Materials/Examples/StandardSurface/standard_surface_carpaint.mtlx build/render/usd_preview_surface_carpaint.mtlx UsdPreviewSurface --hdr

- name: Viewer Tests
if: matrix.test_render == 'ON'
if: matrix.test_render == 'ON' && runner.os != 'Windows'
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
Expand Down Expand Up @@ -373,6 +382,13 @@ jobs:
path: build/**/*.perfetto-trace
if-no-files-found: ignore

- name: Upload Log Files
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: Log_files_${{ matrix.name }}
path: build/**/*.txt

javascript:
name: JavaScript
runs-on: ubuntu-latest
Expand Down
Loading