Skip to content
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

Backport OpenPBR Surface to MaterialX 1.38.10 #2082

Open
wants to merge 12 commits into
base: legacy_1.38
Choose a base branch
from
115 changes: 61 additions & 54 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,85 +18,85 @@ jobs:
fail-fast: false
matrix:
include:
- name: Linux_GCC_9_Python37
os: ubuntu-20.04
- name: Linux_GCC_10_Python37
os: ubuntu-22.04
compiler: gcc
compiler_version: "9"
compiler_version: "10"
python: 3.7
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON -DMATERIALX_BUILD_MONOLITHIC=ON

- name: Linux_GCC_12_Python311
os: ubuntu-22.04
- name: Linux_GCC_13_Python311
os: ubuntu-24.04
compiler: gcc
compiler_version: "12"
compiler_version: "13"
python: 3.11
build_javascript: ON

- name: Linux_GCC_13_Python312
os: ubuntu-22.04
- name: Linux_GCC_14_Python312
os: ubuntu-24.04
compiler: gcc
compiler_version: "13"
compiler_version: "14"
python: 3.12
static_analysis: ON
cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Linux_GCC_CoverageAnalysis
os: ubuntu-22.04
os: ubuntu-24.04
compiler: gcc
compiler_version: "None"
python: None
coverage_analysis: ON
cmake_config: -DMATERIALX_COVERAGE_ANALYSIS=ON -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_PYTHON=OFF

- name: Linux_Clang_10_Python37
os: ubuntu-20.04
- name: Linux_Clang_13_Python37
os: ubuntu-22.04
compiler: clang
compiler_version: "10"
compiler_version: "13"
python: 3.7
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON

- name: Linux_Clang_15_Python312
os: ubuntu-22.04
- name: Linux_Clang_18_Python312
os: ubuntu-24.04
compiler: clang
compiler_version: "15"
compiler_version: "18"
python: 3.12
test_render: ON
clang_format: ON

- name: Linux_Clang_DynamicAnalysis
os: ubuntu-22.04
compiler: clang
compiler_version: "15"
python: None
cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON
dynamic_analysis: ON

- name: MacOS_Xcode_13_Python37
os: macos-12
- name: MacOS_Xcode_14_Python39
os: macos-13
compiler: xcode
compiler_version: "13.1"
compiler_version: "14.1"
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON
python: 3.7
python: 3.9

- name: MacOS_Xcode_14_Python311
os: macos-13
os: macos-14
compiler: xcode
compiler_version: "14.3"
python: 3.11
static_analysis: ON
cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: MacOS_Xcode_15_Python312
os: macos-14
compiler: xcode
compiler_version: "15.0"
compiler_version: "15.4"
python: 3.12
test_shaders: ON

- name: MacOS_Xcode_DynamicAnalysis
os: macos-14
compiler: xcode
compiler_version: "15.4"
python: None
dynamic_analysis: ON
cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON

- name: iOS_Xcode_15
os: macos-14
compiler: xcode
compiler_version: "15.0"
compiler_version: "15.4"
python: None
cmake_config: -DMATERIALX_BUILD_IOS=ON -DCMAKE_OSX_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` -DCMAKE_OSX_ARCHITECTURES=arm64
cmake_config: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` -DCMAKE_OSX_ARCHITECTURES=arm64

- name: Windows_VS2019_Win32_Python37
os: windows-2019
Expand Down Expand Up @@ -128,14 +128,14 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install xorg-dev mesa-utils
sudo apt-get install xorg-dev
if [ "${{ matrix.compiler_version }}" != 'None' ]; then
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.compiler_version }} g++-${{ matrix.compiler_version }}-multilib
sudo apt-get install -y g++-${{ matrix.compiler_version }}
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.compiler_version }} libc++-${{ matrix.compiler_version }}-dev libc++abi-${{ matrix.compiler_version }}-dev
sudo apt-get install -y clang-${{ matrix.compiler_version }}
echo "CC=clang-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
fi
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
run: find source \( -name *.h -o -name *.cpp -o -name *.mm -o -name *.inl \) ! -path "*/External/*" ! -path "*/NanoGUI/*" | xargs clang-format -i --verbose

- name: CMake Generate
run: cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_TEST_RENDER=OFF -DMATERIALX_WARNINGS_AS_ERRORS=ON ${{matrix.cmake_config}}
run: 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 ${{matrix.cmake_config}}

- name: CMake Build
run: cmake --build build --target install --config Release --parallel 2
Expand All @@ -220,20 +220,25 @@ jobs:
python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target osl
python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target mdl
python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target msl
python Scripts/generateshader.py ../resources/Materials/Examples/OpenPbr --target glsl
python Scripts/generateshader.py ../resources/Materials/Examples/OpenPbr --target osl
python Scripts/generateshader.py ../resources/Materials/Examples/OpenPbr --target mdl
python Scripts/generateshader.py ../resources/Materials/Examples/OpenPbr --target msl
working-directory: python

- name: Shader Validation Tests (Windows)
if: matrix.test_shaders == 'ON' && runner.os == 'Windows'
run: |
vcpkg/vcpkg install glslang --triplet=x64-windows
glslangValidator.exe -v
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target glsl --validator glslangValidator.exe --vulkanGlsl True --validatorArgs="-V --aml"
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target essl --validator glslangValidator.exe
python python/Scripts/generateshader.py resources/Materials/Examples --target glsl --validator glslangValidator.exe
python python/Scripts/generateshader.py resources/Materials/Examples --target essl --validator glslangValidator.exe
- name: Shader Validation Tests (MacOS)
if: matrix.test_shaders == 'ON' && runner.os == 'macOS'
run: |
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target msl --validator "xcrun metal --language=metal" --validatorArgs="-w"
python python/Scripts/generateshader.py resources/Materials/Examples --target msl --validator "xcrun metal --language=metal" --validatorArgs="-w"
python python/Scripts/generateshader.py resources/Materials/TestSuite/stdlib --target msl --validator "xcrun metal --language=metal" --validatorArgs="-w"
- name: Coverage Analysis Tests
if: matrix.coverage_analysis == 'ON'
Expand All @@ -244,18 +249,21 @@ jobs:
working-directory: build

- name: Static Analysis Tests
if: matrix.static_analysis == 'ON' && runner.os == 'Linux'
if: matrix.static_analysis == 'ON'
run: |
sudo apt-get install cppcheck
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=*:*/External/* --suppress=*:*/NanoGUI/*
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get install cppcheck
else
brew install cppcheck
fi
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/*
- name: Initialize Virtual Framebuffer
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
echo "GALLIUM_DRIVER=llvmpipe" >> $GITHUB_ENV
- name: Render Script Tests
if: matrix.test_render == 'ON'
Expand All @@ -269,6 +277,7 @@ 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
../installed/bin/MaterialXView --material open_pbr_carpaint.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_OpenPBRCarpaintTranslated.png
../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 Expand Up @@ -331,8 +340,8 @@ jobs:
working-directory: javascript/MaterialXView

- name: Deploy Web Viewer
if: matrix.build_javascript == 'ON' && github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
if: matrix.build_javascript == 'ON' && github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.6.4
with:
branch: gh-pages
folder: javascript/MaterialXView/dist
Expand All @@ -344,11 +353,10 @@ jobs:
with:
name: MaterialX_JavaScript
path: javascript/build/installed/JavaScript/MaterialX
if-no-files-found: ignore

sdist:
name: Python SDist
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: github.repository == 'AcademySoftwareFoundation/MaterialX'
outputs:
sdist_filename: ${{ steps.generate.outputs.filename }}
Expand Down Expand Up @@ -383,8 +391,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-minor: ['7', '8', '9', '10', '11']
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-minor: ['7', '8', '9', '10', '11', '12']
os: ['ubuntu-22.04', 'windows-2022', 'macos-13']

steps:
- name: Sync Repository
Expand All @@ -402,7 +410,7 @@ jobs:
path: sdist

- name: Build Wheel
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.19.2
with:
package-dir: ${{ github.workspace }}/sdist/${{ needs.sdist.outputs.sdist_filename }}
env:
Expand All @@ -413,7 +421,6 @@ jobs:
# manylinux2014 is CentOS 7 based. Which means GCC 10 and glibc 2.17.
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: yum install -y libXt-devel
CIBW_BEFORE_ALL_MACOS: sudo xcode-select -switch /Applications/Xcode_13.4.app
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=2
# CIBW_BUILD_FRONTEND: build # https://github.com/pypa/build
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

on:
release:
types: [published]

permissions:
contents: read

jobs:

release:
name: Release Signing
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ github.ref_name }}
permissions:
contents: write
id-token: write
repository-projects: write

steps:
- name: Sync Repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Create Archive Name
run: echo "MATERIALX_ARCHIVE=MaterialX-${RELEASE_TAG//v}" >> $GITHUB_ENV

- name: Generate Archives
run: |
git archive --prefix ${MATERIALX_ARCHIVE}/ --output ${MATERIALX_ARCHIVE}.zip ${RELEASE_TAG}
git archive --prefix ${MATERIALX_ARCHIVE}/ --output ${MATERIALX_ARCHIVE}.tar.gz ${RELEASE_TAG}
- name: Sign and Upload Archives
uses: sigstore/[email protected]
with:
inputs: |
${{ env.MATERIALX_ARCHIVE }}.zip
${{ env.MATERIALX_ARCHIVE }}.tar.gz
upload-signing-artifacts: true
release-signing-artifacts: false
11 changes: 9 additions & 2 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ if(NOT SKBUILD)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION "${MATERIALX_INSTALL_STDLIB_PATH}"
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN "pbrlib_genosl_impl.*" EXCLUDE)
PATTERN "pbrlib_genosl_impl.*" EXCLUDE
PATTERN "mx39_pbrlib_genosl_impl.*" EXCLUDE)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pbrlib/genosl/pbrlib_genosl_impl.${PBRLIB_SUFFIX}"
DESTINATION "${MATERIALX_INSTALL_STDLIB_PATH}/pbrlib/genosl/" RENAME pbrlib_genosl_impl.mtlx)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pbrlib/genosl/mx39_pbrlib_genosl_impl.${PBRLIB_SUFFIX}"
DESTINATION "${MATERIALX_INSTALL_STDLIB_PATH}/pbrlib/genosl/" RENAME mx39_pbrlib_genosl_impl.mtlx)

endif()

set(MATERIALX_PYTHON_LIBRARIES_PATH "${MATERIALX_PYTHON_FOLDER_NAME}/${MATERIALX_INSTALL_STDLIB_PATH}")
Expand All @@ -22,7 +26,10 @@ if(MATERIALX_BUILD_PYTHON)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION "${MATERIALX_PYTHON_LIBRARIES_PATH}"
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN "pbrlib_genosl_impl.*" EXCLUDE)
PATTERN "pbrlib_genosl_impl.*" EXCLUDE
PATTERN "mx39_pbrlib_genosl_impl.*" EXCLUDE)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pbrlib/genosl/pbrlib_genosl_impl.${PBRLIB_SUFFIX}"
DESTINATION "${MATERIALX_PYTHON_LIBRARIES_PATH}/pbrlib/genosl/" RENAME pbrlib_genosl_impl.mtlx)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pbrlib/genosl/mx39_pbrlib_genosl_impl.${PBRLIB_SUFFIX}"
DESTINATION "${MATERIALX_PYTHON_LIBRARIES_PATH}/pbrlib/genosl/" RENAME mx39_pbrlib_genosl_impl.mtlx)
endif()
Loading
Loading