diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0096f2877..c2be70afd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,19 +8,42 @@ on: merge_group: env: + # + # Dependency versioning + # + + # Sourced from https://vulkan.lunarg.com/sdk/home#linux + VULKAN_SDK_VERSION: "1.3.268" + # Sourced from https://www.nuget.org/packages/Microsoft.Direct3D.WARP + WARP_VERSION: "1.0.8" + + # Sourced from https://github.com/microsoft/DirectXShaderCompiler/releases + # + # Must also be changed in shaders.yaml + DXC_RELEASE: "v1.7.2308" + DXC_FILENAME: "dxc_2023_08_14.zip" + + # 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. MESA_VERSION: "23.3.1" + # Corresponds to https://github.com/gfx-rs/ci-build/releases CI_BINARY_BUILD: "build18" + # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. + REPO_MSRV: "1.71" + # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, + # to ensure that they can be used with firefox. + CORE_MSRV: "1.65" + + # + # Environment variables + # + CARGO_INCREMENTAL: false CARGO_TERM_COLOR: always WGPU_DX12_COMPILER: dxc RUST_LOG: info RUST_BACKTRACE: full - # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. - REPO_MSRV: "1.71" - # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, - # to ensure that they can be used with firefox. - CORE_MSRV: "1.65" PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings RUSTDOCFLAGS: -Dwarnings @@ -365,7 +388,15 @@ jobs: - name: (windows) install dxc if: matrix.os == 'windows-2022' - uses: napokue/setup-dxc@v1.1.0 + shell: bash + run: | + set -e + + curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE/$DXC_FILENAME -o dxc.zip + 7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll,dxil.dll} + + # We need to use cygpath to convert PWD to a windows path as we're using bash. + cygpath --windows "$PWD/dxc" >> "$GITHUB_PATH" - name: (windows) install warp if: matrix.os == 'windows-2022' @@ -373,7 +404,10 @@ jobs: run: | set -e - curl.exe -L https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/1.0.7.1 -o warp.zip + # Make sure dxc is in path. + dxc --version + + curl.exe -L --retry 5 https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/$WARP_VERSION -o warp.zip 7z.exe e warp.zip -owarp build/native/amd64/d3d10warp.dll mkdir -p target/llvm-cov-target/debug/deps @@ -393,7 +427,8 @@ jobs: cp -v mesa/* target/llvm-cov-target/debug/ cp -v mesa/* target/llvm-cov-target/debug/deps - echo "VK_DRIVER_FILES=$PWD/mesa/lvp_icd.x86_64.json" >> "$GITHUB_ENV" + # 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" - name: (linux) install vulkan sdk @@ -406,7 +441,7 @@ jobs: # vulkan sdk wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - - sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list + sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-$VULKAN_SDK_VERSION-jammy.list https://packages.lunarg.com/vulkan/$VULKAN_SDK_VERSION/lunarg-vulkan-$VULKAN_SDK_VERSION-jammy.list sudo apt-get update sudo apt install -y vulkan-sdk @@ -421,6 +456,9 @@ jobs: 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": { diff --git a/.github/workflows/shaders.yml b/.github/workflows/shaders.yml index 6a3a6d621..d5acd990b 100644 --- a/.github/workflows/shaders.yml +++ b/.github/workflows/shaders.yml @@ -7,6 +7,13 @@ on: pull_request: merge_group: +env: + # Sourced from https://github.com/microsoft/DirectXShaderCompiler/releases + # + # Must also be changed in ci.yaml + DXC_RELEASE: "v1.7.2308" + DXC_FILENAME: "dxc_2023_08_14.zip" + jobs: naga-validate-windows: name: "Validate: HLSL" @@ -14,9 +21,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup DXC - uses: napokue/setup-dxc@v1.1.0 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + naga/xtask -> naga/xtask/target + # We must have the FXC job before the DXC job, so the DXC PATH has priority + # over the FXC PATH. This is because the windows kits also include an older + # version of DXC, which we don't want to use. - name: Setup FXC run: | Get-Childitem -Path "C:\Program Files (x86)\Windows Kits\10\bin\**\x64\fxc.exe" ` @@ -26,16 +38,28 @@ jobs: | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append shell: powershell - - uses: Swatinem/rust-cache@v2 - with: - workspaces: | - naga/xtask -> naga/xtask/target + - name: Setup DXC + shell: bash + run: | + set -e + + curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE/$DXC_FILENAME -o dxc.zip + 7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll,dxil.dll} + + # We need to use cygpath to convert PWD to a windows path as we're using bash. + cygpath --windows "$PWD/dxc" >> "$GITHUB_PATH" + + - name: Validate + shell: bash + run: | + set -e + + dxc --version - - run: | cd naga cargo xtask validate hlsl dxc cargo xtask validate hlsl fxc - + naga-validate-macos: name: "Validate: MSL" runs-on: macos-latest diff --git a/wgpu-hal/src/dx12/shader_compilation.rs b/wgpu-hal/src/dx12/shader_compilation.rs index a034f54a7..df040dba1 100644 --- a/wgpu-hal/src/dx12/shader_compilation.rs +++ b/wgpu-hal/src/dx12/shader_compilation.rs @@ -99,7 +99,7 @@ mod dxc { let dxil = match hassle_rs::Dxil::new(dxil_path) { Ok(dxil) => dxil, Err(e) => { - log::warn!("Failed to load dxil.dll. Defaulting to DXC instead: {}", e); + log::warn!("Failed to load dxil.dll. Defaulting to FXC instead: {}", e); return Ok(None); } };