osmesa: Enable Mesa/OSMesa rendering for mac

This commit enables local running of the renderdiff tests and also
for github workflows.
This commit is contained in:
Powei Feng
2025-03-03 14:04:52 -08:00
parent b64548267e
commit 94cdc79ce3
11 changed files with 219 additions and 84 deletions

View File

@@ -46,7 +46,12 @@ def render_test(gltf_viewer, test_config, output_dir,
for backend in test_config.backends:
env = None
if backend == 'opengl' and opengl_lib and os.path.isdir(opengl_lib):
env = {'LD_LIBRARY_PATH': opengl_lib}
env = {
'LD_LIBRARY_PATH': opengl_lib,
# for macOS
'DYLD_LIBRARY_PATH': opengl_lib,
}
for model in test.models:
model_path = test_config.models[model]

View File

@@ -18,11 +18,19 @@ OUTPUT_DIR="$(pwd)/out/renderdiff_tests"
RENDERDIFF_TEST_DIR="$(pwd)/test/renderdiff"
TEST_UTILS_DIR="$(pwd)/test/utils"
MESA_DIR="$(pwd)/mesa/out/"
MESA_LIB_DIR="${MESA_DIR}/lib/x86_64-linux-gnu"
os_name=$(uname -s)
if [[ "$os_name" == "Linux" ]]; then
MESA_LIB_DIR="${MESA_DIR}lib/x86_64-linux-gnu"
elif [[ "$os_name" == "Darwin" ]]; then
MESA_LIB_DIR="${MESA_DIR}lib"
else
echo "Unsupported platform for renderdiff tests"
exit 1
fi
function prepare_mesa() {
if [ ! -d ${MESA_LIB_DIR} ]; then
rm -rf mesa
bash ${TEST_UTILS_DIR}/get_mesa.sh
fi
}