Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 18 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -265,25 +266,40 @@ jobs:
fi
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/*

- name: Initialize Virtual Framebuffer
- 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'
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: Render Application Tests
- name: Viewer Tests
if: matrix.test_render == 'ON'
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: Graph Editor 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

Expand Down
7 changes: 7 additions & 0 deletions source/MaterialXGraphEditor/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ int main(int argc, char* const argv[])
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
#endif

// When captureFilename is specified, make window invisible
// to avoid issues with headless rendering.
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)
Expand Down