Skip to content

Commit c3fa446

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into slang_pybind11_bindings
2 parents 65e06db + fbb6100 commit c3fa446

5 files changed

Lines changed: 36 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
compiler_version: "16.4"
7979
python: 3.13
8080
test_shaders: ON
81+
test_render: ON
8182

8283
- name: MacOS_Xcode_26_Python313
8384
os: macos-26
@@ -266,25 +267,40 @@ jobs:
266267
fi
267268
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/*
268269
269-
- name: Initialize Virtual Framebuffer
270+
- name: Setup Rendering Environment (Linux)
270271
if: matrix.test_render == 'ON' && runner.os == 'Linux'
271272
run: |
272273
Xvfb :1 -screen 0 1280x960x24 &
273274
echo "DISPLAY=:1" >> $GITHUB_ENV
274275
echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
275276
277+
- name: Setup Rendering Environment (MacOS)
278+
if: matrix.test_render == 'ON' && runner.os == 'macOS'
279+
run: |
280+
# macOS can render headless with Metal backend without virtual display
281+
# Force software rendering for Metal backend (more reliable in CI)
282+
echo "MTL_HARDWARE_RENDERING=0" >> $GITHUB_ENV
283+
# Enable Metal debug layer for better debugging in CI
284+
echo "MTL_DEBUG_LAYER=1" >> $GITHUB_ENV
285+
echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
286+
276287
- name: Render Script Tests
277288
if: matrix.test_render == 'ON'
278289
run: |
279290
mkdir build/render
280291
python python/Scripts/baketextures.py resources/Materials/Examples/StandardSurface/standard_surface_brass_tiled.mtlx build/render/brass_average_baked.mtlx --average
281292
python python/Scripts/translateshader.py resources/Materials/Examples/StandardSurface/standard_surface_carpaint.mtlx build/render/usd_preview_surface_carpaint.mtlx UsdPreviewSurface --hdr
282293
283-
- name: Render Application Tests
294+
- name: Viewer Tests
284295
if: matrix.test_render == 'ON'
285296
run: |
286297
../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
287298
../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
299+
working-directory: build/render
300+
301+
- name: Graph Editor Tests
302+
if: matrix.test_render == 'ON' && runner.os == 'Linux'
303+
run: |
288304
../installed/bin/MaterialXGraphEditor --material ../../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --viewWidth 128 --viewHeight 128 --captureFilename GraphEditor_MarbleSolid.png
289305
working-directory: build/render
290306

source/MaterialXFormat/File.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ FilePathVec FilePath::getFilesInDirectory(const string& extension) const
185185

186186
#if defined(_WIN32)
187187
WIN32_FIND_DATAA fd;
188-
FilePath query = extension.empty() ? *this : (*this / ("*." + extension));
188+
FilePath query = extension.empty() ? (*this / "*") : (*this / ("*." + extension));
189189
HANDLE hFind = FindFirstFileA(query.asString().c_str(), &fd);
190190
if (hFind != INVALID_HANDLE_VALUE)
191191
{

source/MaterialXGenOsl/LibsToOso.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ int main(int argc, char* const argv[])
364364
}
365365

366366
// TODO: Check for the existence/validity of the `Node`?
367-
mx::NodePtr node = librariesDoc->addNodeInstance(nodeDef, nodeName);
367+
mx::NodePtr node = librariesDocGraph->addNodeInstance(nodeDef, nodeName);
368368

369369
std::string oslShaderName = node->getName();
370370
oslShaderGen->getSyntax().makeValidName(oslShaderName);

source/MaterialXGraphEditor/Main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ int main(int argc, char* const argv[])
167167
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
168168
#endif
169169

170+
// When captureFilename is specified, make window invisible
171+
// to avoid issues with headless rendering.
172+
if (!captureFilename.empty())
173+
{
174+
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
175+
}
176+
170177
// Create window with graphics context
171178
GLFWwindow* window = glfwCreateWindow(1280, 960, "MaterialX Graph Editor", NULL, NULL);
172179
if (!window)

source/MaterialXTest/MaterialXFormat/File.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,23 @@ TEST_CASE("Get all files in directory", "[file]")
185185
mx::FilePathVec results;
186186

187187
results = lightsDir.getFilesInDirectory("mtlx");
188-
for (const mx::FilePath& filename : results)
188+
REQUIRE(results.size() > 0);
189+
for (const mx::FilePath& filename : mtlxFilenames)
189190
{
190-
REQUIRE(std::find(mtlxFilenames.begin(), mtlxFilenames.end(), filename) != mtlxFilenames.end());
191+
REQUIRE(std::find(results.begin(), results.end(), filename) != results.end());
191192
}
192193

193194
results = lightsDir.getFilesInDirectory("hdr");
194-
for (const mx::FilePath& filename : results)
195+
REQUIRE(results.size() > 0);
196+
for (const mx::FilePath& filename : hdrFilenames)
195197
{
196-
REQUIRE(std::find(hdrFilenames.begin(), hdrFilenames.end(), filename) != hdrFilenames.end());
198+
REQUIRE(std::find(results.begin(), results.end(), filename) != results.end());
197199
}
198200

199201
results = lightsDir.getFilesInDirectory();
200-
for (const mx::FilePath& filename : results)
202+
REQUIRE(results.size() > 0);
203+
for (const mx::FilePath& filename : allFilesnames)
201204
{
202-
REQUIRE(std::find(allFilesnames.begin(), allFilesnames.end(), filename) != allFilesnames.end());
205+
REQUIRE(std::find(results.begin(), results.end(), filename) != results.end());
203206
}
204207
}

0 commit comments

Comments
 (0)