[wip] #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SwiftShader | |
on: [push, pull_request] | |
# Cancel in-progress builds on push to same branch / PR | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# This one includes a fix for building on ARM64 on macOS, and seems to fix | |
# various other bugs | |
COMMIT: 14dcbed947ce755af1fcbfb3ba8e643b4e769860 | |
# Mostly just copied from here, with ES1 disabled: | |
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=swiftshader-git | |
jobs: | |
ubuntu-gles: | |
name: GLES, ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-18.04 | |
runs-on: ubuntu-latest | |
container: ubuntu:bionic-20220427 | |
steps: | |
- name: Install base build tools | |
# apt update is needed to fetch package lists; software-properties-common | |
# is the add-apt-repository command (why that isn't included by | |
# default?!) | |
run: | | |
apt update | |
apt install -y ninja-build libx11-dev libxext-dev wget g++ software-properties-common | |
- name: Install a newer Git version from a PPA | |
# The actions/checkout FOR SOME REASON requires Git 2.18+, while 18.04 | |
# ships only with 2.17. Ultimately that means the "clones" are not | |
# actually clones, so I can't do git submodule update. | |
run: | | |
add-apt-repository ppa:git-core/ppa | |
apt update | |
apt install -y git | |
- name: Install CMake 3.13 | |
run: | | |
mkdir -p $HOME/cmake && cd $HOME/cmake | |
wget --no-check-certificate https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz | |
tar --strip-components=1 -xzf cmake-3.13.5-Linux-x86_64.tar.gz | |
echo $HOME/cmake/bin >> $GITHUB_PATH | |
- name: Clone SwiftShader | |
# checkout v4 uses Node 20 which doesn't work on Ubuntu 18.04 | |
uses: actions/checkout@v3.6.0 | |
with: | |
repository: google/swiftshader | |
ref: ${{ env.COMMIT }} | |
path: swiftshader | |
# Yeah, I know, but the repo has no tags, and we use number of commits | |
# for SWIFTSHADER_VERSION. | |
fetch-depth: 0 | |
- name: Init & update submodules, fetch version | |
run: | | |
git -C swiftshader submodule init | |
git -C swiftshader submodule update | |
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)" | |
echo "version: $SWIFTSHADER_VERSION" | |
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV | |
- name: Build & install Debug | |
run: | | |
mkdir build-debug && cd build-debug | |
cmake ../swiftshader \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DSWIFTSHADER_BUILD_GLES_CM=OFF \ | |
-DSWIFTSHADER_BUILD_GLESv2=ON \ | |
-DSWIFTSHADER_BUILD_VULKAN=OFF \ | |
-DSWIFTSHADER_BUILD_PVR=OFF \ | |
-DSWIFTSHADER_BUILD_TESTS=OFF \ | |
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \ | |
-G Ninja | |
ninja | |
cd .. | |
install -dm755 install-debug/lib | |
install -dm755 install-debug/include | |
install -dm755 install-debug/include/EGL | |
install -dm755 install-debug/include/KHR | |
install -m755 -t install-debug/lib \ | |
build-debug/libEGL.so \ | |
build-debug/libGLESv2.so | |
install -m644 -t install-debug/include/EGL \ | |
swiftshader/include/EGL/egl.h \ | |
swiftshader/include/EGL/eglext.h \ | |
swiftshader/include/EGL/eglplatform.h | |
install -m644 -t install-debug/include/KHR \ | |
swiftshader/include/KHR/khrplatform.h | |
- name: Build & install Release | |
run: | | |
mkdir build && cd build | |
cmake ../swiftshader \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DSWIFTSHADER_BUILD_GLES_CM=OFF \ | |
-DSWIFTSHADER_BUILD_GLESv2=ON \ | |
-DSWIFTSHADER_BUILD_VULKAN=OFF \ | |
-DSWIFTSHADER_BUILD_PVR=OFF \ | |
-DSWIFTSHADER_BUILD_TESTS=OFF \ | |
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \ | |
-G Ninja | |
ninja | |
cd .. | |
install -dm755 install/lib | |
install -dm755 install/include | |
install -dm755 install/include/EGL | |
install -dm755 install/include/KHR | |
install -m755 -t install/lib \ | |
build/libEGL.so \ | |
build/libGLESv2.so | |
install -m644 -t install/include/EGL \ | |
swiftshader/include/EGL/egl.h \ | |
swiftshader/include/EGL/eglext.h \ | |
swiftshader/include/EGL/eglplatform.h | |
install -m644 -t install/include/KHR \ | |
swiftshader/include/KHR/khrplatform.h | |
- name: Upload Debug artifacts | |
# upload-artifact v4 uses Node 20 which doesn't work on Ubuntu 18.04 | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}-debug | |
path: install-debug | |
- name: Upload Release artifacts | |
# upload-artifact v4 uses Node 20 which doesn't work on Ubuntu 18.04 | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }} | |
path: install | |
ubuntu-vulkan: | |
name: Vulkan, ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-18.04 | |
runs-on: ubuntu-latest | |
container: ubuntu:bionic-20220427 | |
steps: | |
- name: Install base build tools | |
# apt update is needed to fetch package lists; software-properties-common | |
# is the add-apt-repository command (why that isn't included by | |
# default?!) | |
run: | | |
apt update | |
apt install -y ninja-build libx11-dev libxext-dev wget g++ software-properties-common | |
- name: Install a newer Git version from a PPA | |
# The actions/checkout FOR SOME REASON requires Git 2.18+, while 18.04 | |
# ships only with 2.17. Ultimately that means the "clones" are not | |
# actually clones, so I can't so git submodule update. | |
run: | | |
add-apt-repository ppa:git-core/ppa | |
apt update | |
apt install -y git | |
- name: Install CMake 3.13 | |
run: | | |
mkdir -p $HOME/cmake && cd $HOME/cmake | |
wget --no-check-certificate https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz | |
tar --strip-components=1 -xzf cmake-3.13.5-Linux-x86_64.tar.gz | |
echo $HOME/cmake/bin >> $GITHUB_PATH | |
- name: Clone SwiftShader | |
# checkout v4 uses Node 20 which doesn't work on Ubuntu 18.04 | |
uses: actions/checkout@v3.6.0 | |
with: | |
repository: google/swiftshader | |
ref: ${{ env.COMMIT }} | |
path: swiftshader | |
# Yeah, I know, but the repo has no tags, and we use number of commits | |
# for SWIFTSHADER_VERSION. | |
fetch-depth: 0 | |
- name: Init & update submodules, fetch version | |
run: | | |
git -C swiftshader submodule init | |
git -C swiftshader submodule update | |
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)" | |
echo "version: $SWIFTSHADER_VERSION" | |
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV | |
- name: Configure | |
run: | | |
mkdir build && cd build | |
cmake ../swiftshader \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DSWIFTSHADER_BUILD_GLES_CM=OFF \ | |
-DSWIFTSHADER_BUILD_GLESv2=OFF \ | |
-DSWIFTSHADER_BUILD_VULKAN=ON \ | |
-DSWIFTSHADER_BUILD_PVR=OFF \ | |
-DSWIFTSHADER_BUILD_TESTS=OFF \ | |
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \ | |
-DSPIRV_WERROR=OFF \ | |
-G Ninja | |
- name: Build | |
run: | | |
cd build | |
ninja | |
- name: Install | |
run: | | |
install -dm755 install/lib | |
install -m755 -t install/lib \ | |
build/libvk_swiftshader.so | |
install -dm755 install/share/vulkan/icd.d/ | |
install -m644 -t install/share/vulkan/icd.d/ \ | |
build/Linux/vk_swiftshader_icd.json | |
sed 's#./libvk_swiftshader.so#../../../lib/libvk_swiftshader.so#' \ | |
-i install/share/vulkan/icd.d/vk_swiftshader_icd.json | |
- name: Upload artifacts | |
# upload-artifact v4 uses Node 20 which doesn't work on Ubuntu 18.04 | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }} | |
path: install | |
mac: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
matrix: | |
include: | |
- os: macos12-arm64 | |
runs-on: macos-12 | |
steps: | |
- name: Install base build tools | |
run: | | |
brew install ninja | |
- name: Clone SwiftShader | |
uses: actions/checkout@v4.1.7 | |
with: | |
repository: google/swiftshader | |
ref: ${{ env.COMMIT }} | |
path: swiftshader | |
# Yeah, I know, but the repo has no tags, and we use number of commits | |
# for SWIFTSHADER_VERSION. | |
fetch-depth: 0 | |
- name: Init & update submodules, fetch version | |
run: | | |
git -C swiftshader submodule init | |
git -C swiftshader submodule update | |
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)" | |
echo "version: $SWIFTSHADER_VERSION" | |
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV | |
- name: Configure | |
run: | | |
cmake \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_OSX_ARCHITECTURES="arm64" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="12.0" \ | |
-DSWIFTSHADER_BUILD_GLES_CM=OFF \ | |
-DSWIFTSHADER_BUILD_GLESv2=ON \ | |
-DSWIFTSHADER_BUILD_VULKAN=ON \ | |
-DSWIFTSHADER_BUILD_PVR=OFF \ | |
-DSWIFTSHADER_BUILD_TESTS=OFF \ | |
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \ | |
-DSPIRV_WERROR=OFF \ | |
-S swiftshader -B build | |
- name: Build | |
run: | | |
ninja -C build | |
- name: Install | |
run: | | |
install -dm755 install-gles/lib | |
install -dm755 install-gles/include | |
install -dm755 install-gles/include/EGL | |
install -dm755 install-gles/include/KHR | |
install -dm755 install-vulkan/lib | |
# There's no install -t on macOS | |
install -m755 \ | |
build/libEGL.dylib \ | |
build/libGLESv2.dylib \ | |
install-gles/lib | |
install -m644 \ | |
swiftshader/include/EGL/egl.h \ | |
swiftshader/include/EGL/eglext.h \ | |
swiftshader/include/EGL/eglplatform.h \ | |
install-gles/include/EGL | |
install -m644 \ | |
swiftshader/include/KHR/khrplatform.h \ | |
install-gles/include/KHR | |
install -m755 \ | |
build/libvk_swiftshader.dylib \ | |
install-vulkan/lib | |
install -dm755 install-vulkan/share/vulkan/icd.d/ | |
install -m644 build/Darwin/vk_swiftshader_icd.json \ | |
install-vulkan/share/vulkan/icd.d/ | |
# There's no sed -i on macOS, need to provide an extension and then | |
# delete the backup | |
sed -e 's#./libvk_swiftshader.dylib#../../../lib/libvk_swiftshader.dylib#' \ | |
-i'.old' install-vulkan/share/vulkan/icd.d/vk_swiftshader_icd.json | |
rm install-vulkan/share/vulkan/icd.d/vk_swiftshader_icd.json.old | |
- name: Upload GLES artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }} | |
path: install-gles | |
- name: Upload Vulkan artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }} | |
path: install-vulkan | |
windows: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# Can't (easily) build on MSVC 2017 because windows-2016 has CMake 3.12 | |
# and the damn SwiftShader codebase requires 3.13 for some stupid | |
# reason. | |
os: [windows-2019] | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v5 | |
- name: Set up Visual Studio environment | |
uses: compnerd/gha-setup-vsdevenv@v6 | |
- name: Clone SwiftShader | |
uses: actions/checkout@v4.1.7 | |
with: | |
repository: google/swiftshader | |
ref: ${{ env.COMMIT }} | |
path: swiftshader | |
# Yeah, I know, but the repo has no tags, and we use number of commits | |
# for SWIFTSHADER_VERSION. | |
fetch-depth: 0 | |
- name: Init & update submodules, fetch version | |
# PowerShell. How any sane person could let such a horrible thing to get | |
# even released. How am I supposed to have fun typing all the fucking | |
# Camel-Dash-Case commands. | |
run: | | |
git -C swiftshader submodule init | |
git -C swiftshader submodule update | |
$SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)" | |
echo "version: $SWIFTSHADER_VERSION" | |
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: Configure | |
run: | | |
cmake ` | |
-G Ninja ` | |
-DCMAKE_C_COMPILER=cl.exe ` | |
-DCMAKE_CXX_COMPILER=cl.exe ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DSWIFTSHADER_BUILD_GLES_CM=OFF ` | |
-DSWIFTSHADER_BUILD_GLESv2=ON ` | |
-DSWIFTSHADER_BUILD_VULKAN=ON ` | |
-DSWIFTSHADER_BUILD_PVR=OFF ` | |
-DSWIFTSHADER_BUILD_TESTS=OFF ` | |
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF ` | |
-DSPIRV_WERROR=OFF ` | |
-S swiftshader -B build | |
- name: Build | |
run: | | |
ninja -C build | |
- name: Install | |
run: | | |
mkdir install-gles\bin | |
mkdir install-gles\lib | |
mkdir install-gles\include | |
mkdir install-gles\include\EGL | |
mkdir install-gles\include\KHR | |
mkdir install-vulkan\bin | |
mkdir install-vulkan\lib | |
mkdir install-vulkan\share\vulkan\icd.d | |
copy build\libEGL.dll install-gles\bin\ | |
copy build\src\OpenGL\libEGL\libEGL.lib install-gles\lib\ | |
copy build\libGLESv2.dll install-gles\bin\ | |
copy build\src\OpenGL\libGLESv2\libGLESv2.lib install-gles\lib\ | |
copy swiftshader\include\EGL\egl.h install-gles\include\EGL\ | |
copy swiftshader\include\EGL\eglext.h install-gles\include\EGL\ | |
copy swiftshader\include\EGL\eglplatform.h install-gles\include\EGL\ | |
copy swiftshader\include\KHR\khrplatform.h install-gles\include\KHR\ | |
copy build\vk_swiftshader.dll install-vulkan\bin\ | |
copy build\src\Vulkan\vk_swiftshader.lib install-vulkan\lib\ | |
(Get-Content build\Windows\vk_swiftshader_icd.json) ` | |
-replace '\.\\\\vk_swiftshader\.dll', '..\\..\\..\\bin\\vk_swiftshader.dll' ` | |
| Out-File -encoding UTF8 install-vulkan\share\vulkan\icd.d\vk_swiftshader_icd.json | |
- name: Upload GLES artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }} | |
path: install-gles | |
- name: Upload Vulkan artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }} | |
path: install-vulkan |