Files
wgpu/.github/actions/install-mesa/action.yml

77 lines
2.9 KiB
YAML

name: "Install Mesa"
description: "Install Mesa"
inputs:
# Sourced from https://archive.mesa3d.org/. Bumping this requires
# updating the mesa build in https://github.com/gfx-rs/ci-build and creating a new release.
version:
default: "26.2.6"
# Corresponds to https://github.com/gfx-rs/ci-build/releases
ci-binary-build:
default: "build30"
target-dir:
description: "The directory into which to install the Mesa libraries."
default: "target/llvm-cov-target/debug"
runs:
using: "composite"
steps:
- name: (Linux) Install Mesa
if: runner.os == 'Linux'
shell: bash
env:
MESA_VERSION: ${{ inputs.version }}
CI_BINARY_BUILD: ${{ inputs.ci-binary-build }}
# NOTE: We ignore `github-env` because we trust:
#
# - The `cygpath` tool
# - The `$PWD` variable
# - The contents of the Mesa archive we download here, which we control.
run: | # zizmor: ignore[github-env]
set -e
curl -L --retry 5 https://github.com/gfx-rs/ci-build/releases/download/$CI_BINARY_BUILD/mesa-$MESA_VERSION-linux-x86_64.tar.xz -o mesa.tar.xz
mkdir mesa
tar xpf mesa.tar.xz -C mesa
# The ICD provided by the mesa build is hardcoded to the build environment.
#
# We write out our own ICD file to point to the mesa vulkan
cat <<- EOF > icd.json
{
"ICD": {
"api_version": "1.4.354",
"library_arch": "64",
"library_path": "$PWD/mesa/lib/x86_64-linux-gnu/libvulkan_lvp.so"
},
"file_format_version": "1.0.1"
}
EOF
echo "VK_DRIVER_FILES=$PWD/icd.json" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$PWD/mesa/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
echo "LIBGL_DRIVERS_PATH=$PWD/mesa/lib/x86_64-linux-gnu/dri" >> "$GITHUB_ENV"
- name: (Windows) Install Mesa
if: runner.os == 'Windows'
shell: bash
env:
MESA_VERSION: ${{ inputs.version }}
CI_BINARY_BUILD: ${{ inputs.ci-binary-build }}
INPUTS_TARGET_DIR: ${{ inputs.target-dir }}
# NOTE: We ignore `github-env` because we trust:
#
# - The `cygpath` tool
# - The `$PWD` variable
# - The contents of the Mesa archive we download here.
run: | # zizmor: ignore[github-env]
set -e
curl.exe -L --retry 5 https://github.com/pal1000/mesa-dist-win/releases/download/$MESA_VERSION/mesa3d-$MESA_VERSION-release-msvc.7z -o mesa.7z
7z.exe e mesa.7z -omesa x64/{opengl32.dll,libgallium_wgl.dll,libglapi.dll,vulkan_lvp.dll,lvp_icd.x86_64.json}
cp -v mesa/* ${INPUTS_TARGET_DIR}/
cp -v mesa/* ${INPUTS_TARGET_DIR}/deps
# We need to use cygpath to convert PWD to a windows path as we're using bash.
echo "VK_DRIVER_FILES=`cygpath --windows $PWD/mesa/lvp_icd.x86_64.json`" >> "$GITHUB_ENV"
echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV"