Update WARP and Install Mesa on Windows CI (#4270)

This commit is contained in:
Connor Fitzgerald 2023-10-22 00:34:00 -04:00 committed by GitHub
parent 095b46dbdb
commit 04ac5f2851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 100 additions and 39 deletions

View File

@ -118,7 +118,7 @@ jobs:
with: with:
key: clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }} key: clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }}
- name: install aarch64-linux-gnu g++ - name: (linux aarch64) install aarch64-linux-gnu g++
if: matrix.target == 'aarch64-unknown-linux-gnu' if: matrix.target == 'aarch64-unknown-linux-gnu'
run: | run: |
set -e set -e
@ -127,7 +127,7 @@ jobs:
sudo apt-get install g++-aarch64-linux-gnu sudo apt-get install g++-aarch64-linux-gnu
- name: add android apk to path - name: (android) add android apk to path
if: matrix.target == 'aarch64-linux-android' if: matrix.target == 'aarch64-linux-android'
run: | run: |
# clang++ will be detected correctly by CC from path # clang++ will be detected correctly by CC from path
@ -286,17 +286,46 @@ jobs:
- name: checkout repo - name: checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Repo MSRV toolchain
run: |
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal -c llvm-tools
cargo -V
- name: Install cargo-nextest and cargo-llvm-cov - name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2 uses: taiki-e/install-action@v2
with: with:
tool: cargo-nextest,cargo-llvm-cov tool: cargo-nextest,cargo-llvm-cov
- name: Install Repo MSRV toolchain - name: (windows) install warp
if: matrix.os == 'windows-2022'
shell: bash
run: | run: |
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal set -e
cargo -V
- name: install llvmpipe, vulkan sdk curl.exe -L https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/1.0.7.1 -o warp.zip
7z.exe e warp.zip -owarp build/native/amd64/d3d10warp.dll
mkdir -p target/llvm-cov-target/debug/deps
cp -v warp/d3d10warp.dll target/llvm-cov-target/debug/
cp -v warp/d3d10warp.dll target/llvm-cov-target/debug/deps
- name: (windows) install mesa
if: matrix.os == 'windows-2022'
shell: bash
run: |
set -e
curl.exe -L https://github.com/pal1000/mesa-dist-win/releases/download/23.2.1/mesa3d-23.2.1-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/* 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"
echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV"
- name: (linux) install llvmpipe, lavapipe, vulkan sdk
if: matrix.os == 'ubuntu-22.04' if: matrix.os == 'ubuntu-22.04'
shell: bash shell: bash
run: | run: |
@ -326,6 +355,19 @@ jobs:
if: matrix.os[0] != 'self-hosted' if: matrix.os[0] != 'self-hosted'
with: with:
key: test-${{ matrix.os }}-${{ env.CACHE_SUFFIX }} key: test-${{ matrix.os }}-${{ env.CACHE_SUFFIX }}
workspaces: |
. -> target
xtask -> xtask/target
- name: run wgpu-info
shell: bash
run: |
echo "$PATH"
export RUST_LOG=trace
# This needs to match the command in xtask/tests.rs
cargo llvm-cov --no-cfg-coverage --no-report run --bin wgpu-info
- name: run tests - name: run tests
shell: bash shell: bash

View File

@ -70,16 +70,20 @@ We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) that serves as a knowledge
## Supported Platforms ## Supported Platforms
| API | Windows | Linux & Android | macOS & iOS | Web (wasm) | | API | Windows | Linux/Android | macOS/iOS | Web (wasm) |
| ----------- | ------------------------------ | ------------------ | ------------------------- | ------------------------- | | ----------- | ------------------------------ | ------------------ | ------------------------- | ------------------------- |
| Vulkan | :white_check_mark: | :white_check_mark: | :ok: (vulkan-portability) | | | Vulkan | :white_check_mark: | :white_check_mark: | :volcano: | |
| Metal | | | :white_check_mark: | | | Metal | | | :white_check_mark: | |
| DX12 | :white_check_mark: (W10+ only) | | | | | DX12 | :white_check_mark: | | | |
| DX11 | :hammer_and_wrench: | | | | | DX11 | :hammer_and_wrench: | | | |
| OpenGL | :ok: (Desktop GL 3.3+) | :ok: (GL ES 3.0+) | :ok: (angle; GL ES 3.0+) | :ok: (WebGL2) | | OpenGL | :ok: (GL 3.3+) | :ok: (GL ES 3.0+) | :triangular_ruler: | :ok: (WebGL2) |
| WebGPU | | | | :white_check_mark: | | WebGPU | | | | :white_check_mark: |
:white_check_mark: = First Class Support — :ok: = Best Effort Support — :hammer_and_wrench: = Unsupported, but support in progress :white_check_mark: = First Class Support
:ok: = Downlevel/Best Effort Support
:triangular_ruler: = Requires the [ANGLE](#angle) translation layer
:volcano: = Requires the [MoltenVK](https://vulkan.lunarg.com/sdk/home#mac) translation layer
:hammer_and_wrench: = Unsupported, though open to contributions
### Shader Support ### Shader Support
@ -103,7 +107,7 @@ To enable GLSL shaders, enable the `glsl` feature of wgpu.
### Angle ### Angle
[Angle](http://angleproject.org) is a translation layer from GLES to other backends, developed by Google. [Angle](http://angleproject.org) is a translation layer from GLES to other backends, developed by Google.
We support running our GLES3 backend over it in order to reach platforms with GLES2 or DX11 support, which aren't accessible otherwise. We support running our GLES3 backend over it in order to reach platforms DX11 support, which aren't accessible otherwise.
In order to run with Angle, "angle" feature has to be enabled, and Angle libraries placed in a location visible to the application. In order to run with Angle, "angle" feature has to be enabled, and Angle libraries placed in a location visible to the application.
These binaries can be downloaded from [gfbuild-angle](https://github.com/DileSoft/gfbuild-angle) artifacts, [manual compilation](https://github.com/google/angle/blob/main/doc/DevSetup.md) may be required on Macs with Apple silicon. These binaries can be downloaded from [gfbuild-angle](https://github.com/DileSoft/gfbuild-angle) artifacts, [manual compilation](https://github.com/google/angle/blob/main/doc/DevSetup.md) may be required on Macs with Apple silicon.
@ -140,17 +144,17 @@ When running the CTS, use the variables `DENO_WEBGPU_ADAPTER_NAME`, `DENO_WEBGPU
## Testing ## Testing
We have multiple methods of testing, each of which tests different qualities about wgpu. We automatically run our tests on CI if possible. The current state of CI testing: We have multiple methods of testing, each of which tests different qualities about wgpu. We automatically run our tests on CI. The current state of CI testing:
| Backend/Platform | Tests | CTS | Notes | | Platform/Backend | Tests | Notes |
| ---------------- | ------------------ | ------------------ | ------------------------------------- | | ---------------- | ------------------ | ------------------------------------- |
| DX12/Windows 10 | :heavy_check_mark: | - | using WARP | | Windows/DX12 | :heavy_check_mark: | using WARP |
| DX11/Windows 10 | :construction: | — | using WARP | | Windows/OpenGL | :heavy_check_mark: | using llvmpipe |
| Metal/MacOS | :heavy_check_mark: | — | using hardware runner | | MacOS/Metal | :heavy_check_mark: | using hardware runner |
| Vulkan/Linux | :heavy_check_mark: | - | using swiftshader | | Linux/Vulkan | :heavy_check_mark: | using lavapipe |
| GL/Windows | | — | | | Linux/OpenGL ES | :heavy_check_mark: | using llvmpipe |
| GLES/Linux | :heavy_check_mark: | — | using llvmpipe | | Chrome/WebGL | :heavy_check_mark: | using swiftshader |
| WebGL/Chrome | :heavy_check_mark: | — | using swiftshader | | Chrome/WebGPU | :x: | not set up |
### Core Test Infrastructure ### Core Test Infrastructure

View File

@ -7,7 +7,6 @@ static COMPUTE_1: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default() TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS) .downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults()) .limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")), .skip(FailureCase::adapter("V3D")),
) )
.run_async(|ctx| { .run_async(|ctx| {
@ -22,7 +21,6 @@ static COMPUTE_2: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default() TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS) .downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults()) .limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")), .skip(FailureCase::adapter("V3D")),
) )
.run_async(|ctx| { .run_async(|ctx| {
@ -37,7 +35,6 @@ static COMPUTE_OVERFLOW: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default() TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS) .downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults()) .limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")), .skip(FailureCase::adapter("V3D")),
) )
.run_async(|ctx| { .run_async(|ctx| {
@ -60,7 +57,6 @@ static MULTITHREADED_COMPUTE: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default() TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS) .downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults()) .limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")), .skip(FailureCase::adapter("V3D")),
) )
.run_sync(|ctx| { .run_sync(|ctx| {

View File

@ -240,9 +240,9 @@ bitflags::bitflags! {
// Builder pattern to make it easier // Builder pattern to make it easier
impl TestParameters { impl TestParameters {
/// Set of common features that most internal tests require for readback. /// Set of common features that most internal tests require for compute and readback.
pub fn test_features_limits(self) -> Self { pub fn test_features_limits(self) -> Self {
self.features(Features::MAPPABLE_PRIMARY_BUFFERS | Features::VERTEX_WRITABLE_STORAGE) self.downlevel_flags(DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults()) .limits(wgpu::Limits::downlevel_defaults())
} }

View File

@ -29,12 +29,18 @@ fn pulling_common(
}], }],
}); });
let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor { let buffer_size = 4 * expected.len() as u64;
let cpu_buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None, label: None,
size: 4 * expected.len() as u64, size: buffer_size,
usage: wgpu::BufferUsages::COPY_SRC usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,
| wgpu::BufferUsages::STORAGE mapped_at_creation: false,
| wgpu::BufferUsages::MAP_READ, });
let gpu_buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: buffer_size,
usage: wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::STORAGE,
mapped_at_creation: false, mapped_at_creation: false,
}); });
@ -43,7 +49,7 @@ fn pulling_common(
layout: &bgl, layout: &bgl,
entries: &[wgpu::BindGroupEntry { entries: &[wgpu::BindGroupEntry {
binding: 0, binding: 0,
resource: buffer.as_entire_binding(), resource: gpu_buffer.as_entire_binding(),
}], }],
}); });
@ -124,8 +130,10 @@ fn pulling_common(
drop(rpass); drop(rpass);
encoder.copy_buffer_to_buffer(&gpu_buffer, 0, &cpu_buffer, 0, buffer_size);
ctx.queue.submit(Some(encoder.finish())); ctx.queue.submit(Some(encoder.finish()));
let slice = buffer.slice(..); let slice = cpu_buffer.slice(..);
slice.map_async(wgpu::MapMode::Read, |_| ()); slice.map_async(wgpu::MapMode::Read, |_| ());
ctx.device.poll(wgpu::Maintain::Wait); ctx.device.poll(wgpu::Maintain::Wait);
let data: Vec<u32> = bytemuck::cast_slice(&slice.get_mapped_range()).to_vec(); let data: Vec<u32> = bytemuck::cast_slice(&slice.get_mapped_range()).to_vec();
@ -135,7 +143,11 @@ fn pulling_common(
#[gpu_test] #[gpu_test]
static DRAW: GpuTestConfiguration = GpuTestConfiguration::new() static DRAW: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits()) .parameters(
TestParameters::default()
.test_features_limits()
.features(wgpu::Features::VERTEX_WRITABLE_STORAGE),
)
.run_sync(|ctx| { .run_sync(|ctx| {
pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| { pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {
cmb.draw(0..6, 0..1); cmb.draw(0..6, 0..1);
@ -144,7 +156,11 @@ static DRAW: GpuTestConfiguration = GpuTestConfiguration::new()
#[gpu_test] #[gpu_test]
static DRAW_VERTEX: GpuTestConfiguration = GpuTestConfiguration::new() static DRAW_VERTEX: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits()) .parameters(
TestParameters::default()
.test_features_limits()
.features(wgpu::Features::VERTEX_WRITABLE_STORAGE),
)
.run_sync(|ctx| { .run_sync(|ctx| {
pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| { pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {
cmb.draw(0..3, 0..1); cmb.draw(0..3, 0..1);
@ -157,7 +173,7 @@ static DRAW_INSTANCED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters( .parameters(
TestParameters::default() TestParameters::default()
.test_features_limits() .test_features_limits()
.expect_fail(FailureCase::backend(wgpu::Backends::DX11)), .features(wgpu::Features::VERTEX_WRITABLE_STORAGE),
) )
.run_sync(|ctx| { .run_sync(|ctx| {
pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| { pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {
@ -170,7 +186,9 @@ static DRAW_INSTANCED_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters( .parameters(
TestParameters::default() TestParameters::default()
.test_features_limits() .test_features_limits()
.expect_fail(FailureCase::backend(wgpu::Backends::DX11)), .features(wgpu::Features::VERTEX_WRITABLE_STORAGE)
// https://github.com/gfx-rs/wgpu/issues/4276
.expect_fail(FailureCase::backend(wgpu::Backends::GL)),
) )
.run_sync(|ctx| { .run_sync(|ctx| {
pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| { pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {

View File

@ -3,6 +3,7 @@ use pico_args::Arguments;
pub fn run_tests(mut args: Arguments) -> anyhow::Result<()> { pub fn run_tests(mut args: Arguments) -> anyhow::Result<()> {
let llvm_cov = args.contains("--llvm-cov"); let llvm_cov = args.contains("--llvm-cov");
// These needs to match the command in "run wgpu-info" in `.github/workflows/ci.yml`
let llvm_cov_flags: &[_] = if llvm_cov { let llvm_cov_flags: &[_] = if llvm_cov {
&["llvm-cov", "--no-cfg-coverage", "--no-report"] &["llvm-cov", "--no-cfg-coverage", "--no-report"]
} else { } else {