Skip to content

Commit

Permalink
Merge branch 'trunk' into gl-mipmap
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Oct 23, 2023
2 parents 2351b45 + 85cab49 commit 526e7ab
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 96 deletions.
66 changes: 55 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
with:
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'
run: |
set -e
Expand All @@ -127,7 +127,7 @@ jobs:
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'
run: |
# clang++ will be detected correctly by CC from path
Expand Down Expand Up @@ -286,17 +286,57 @@ jobs:
- name: checkout repo
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
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov

- name: Install Repo MSRV toolchain
# Cache step must go before warp and mesa install on windows as they write into the
# target directory, and rust-cache will overwrite the entirety of the target directory.
- name: caching
uses: Swatinem/rust-cache@v2
if: matrix.os[0] != 'self-hosted'
with:
key: test-${{ matrix.os }}-${{ env.CACHE_SUFFIX }}
workspaces: |
. -> target
xtask -> xtask/target
- name: (windows) install warp
if: matrix.os == 'windows-2022'
shell: bash
run: |
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal
cargo -V
set -e
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
- name: install llvmpipe, vulkan sdk
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'
shell: bash
run: |
Expand All @@ -321,11 +361,15 @@ jobs:
[profile.dev]
debug = 1" >> .cargo/config.toml
- name: caching
uses: Swatinem/rust-cache@v2
if: matrix.os[0] != 'self-hosted'
with:
key: test-${{ matrix.os }}-${{ env.CACHE_SUFFIX }}
- 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
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,20 @@ We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) that serves as a knowledge

## 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: | |
| DX12 | :white_check_mark: (W10+ only) | | | |
| DX12 | :white_check_mark: | | | |
| 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: |

: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

Expand All @@ -103,7 +107,7 @@ To enable GLSL shaders, enable the `glsl` feature of wgpu.
### Angle

[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.
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.

Expand Down Expand Up @@ -140,17 +144,17 @@ When running the CTS, use the variables `DENO_WEBGPU_ADAPTER_NAME`, `DENO_WEBGPU

## 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:

| Backend/Platform | Tests | CTS | Notes |
| ---------------- | ------------------ | ------------------ | ------------------------------------- |
| DX12/Windows 10 | :heavy_check_mark: | - | using WARP |
| DX11/Windows 10 | :construction: || using WARP |
| Metal/MacOS | :heavy_check_mark: | | using hardware runner |
| Vulkan/Linux | :heavy_check_mark: | - | using swiftshader |
| GL/Windows | || |
| GLES/Linux | :heavy_check_mark: | | using llvmpipe |
| WebGL/Chrome | :heavy_check_mark: | | using swiftshader |
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:

| Platform/Backend | Tests | Notes |
| ---------------- | ------------------ | ------------------------------------- |
| Windows/DX12 | :heavy_check_mark: | using WARP |
| Windows/OpenGL | :heavy_check_mark: | using llvmpipe |
| MacOS/Metal | :heavy_check_mark: | using hardware runner |
| Linux/Vulkan | :heavy_check_mark: | using lavapipe |
| Linux/OpenGL ES | :heavy_check_mark: | using llvmpipe |
| Chrome/WebGL | :heavy_check_mark: | using swiftshader |
| Chrome/WebGPU | :x: | not set up |

### Core Test Infrastructure

Expand Down
8 changes: 3 additions & 5 deletions examples/hello-compute/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ static COMPUTE_1: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")),
)
.run_async(|ctx| {
Expand All @@ -22,7 +21,6 @@ static COMPUTE_2: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")),
)
.run_async(|ctx| {
Expand All @@ -37,7 +35,6 @@ static COMPUTE_OVERFLOW: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")),
)
.run_async(|ctx| {
Expand All @@ -60,8 +57,9 @@ static MULTITHREADED_COMPUTE: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults())
.features(wgpu::Features::TIMESTAMP_QUERY)
.skip(FailureCase::adapter("V3D")),
.skip(FailureCase::adapter("V3D"))
// Segfaults on linux CI only https://github.com/gfx-rs/wgpu/issues/4285
.skip(FailureCase::backend_adapter(wgpu::Backends::GL, "llvmpipe")),
)
.run_sync(|ctx| {
use std::{sync::mpsc, sync::Arc, thread, time::Duration};
Expand Down
1 change: 1 addition & 0 deletions examples/hello-synchronization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ publish = false
[[bin]]
name = "hello-synchronization"
path = "src/main.rs"
harness = false

[dependencies]
bytemuck.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions examples/hello-synchronization/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ const ARR_SIZE: usize = 128;

struct ExecuteResults {
patient_workgroup_results: Vec<u32>,
#[cfg_attr(test, allow(unused))]
hasty_workgroup_results: Vec<u32>,
}

#[cfg_attr(test, allow(unused))]
async fn run() {
let instance = wgpu::Instance::default();
let adapter = instance
Expand Down Expand Up @@ -187,6 +189,7 @@ async fn get_data<T: bytemuck::Pod>(
staging_buffer.unmap();
}

#[cfg(not(test))]
fn main() {
#[cfg(not(target_arch = "wasm32"))]
{
Expand All @@ -207,5 +210,8 @@ fn main() {
}
}

#[cfg(test)]
wgpu_test::gpu_test_main!();

#[cfg(test)]
mod tests;
1 change: 1 addition & 0 deletions examples/timestamp-queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ publish = false
[[bin]]
name = "timestamp-queries"
path = "src/main.rs"
harness = false

[dependencies]
bytemuck.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions examples/timestamp-queries/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl QueryResults {
}
}

#[cfg_attr(test, allow(unused))]
fn print(&self, queue: &wgpu::Queue) {
let period = queue.get_timestamp_period();
let elapsed_us = |start, end: u64| end.wrapping_sub(start) as f64 * period as f64 / 1000.0;
Expand Down Expand Up @@ -174,6 +175,7 @@ impl Queries {
}
}

#[cfg_attr(test, allow(unused))]
async fn run() {
// Instantiates instance of wgpu
let backends = wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all);
Expand Down Expand Up @@ -403,6 +405,7 @@ fn render_pass(
rpass.draw(0..3, 0..1);
}

#[cfg(not(test))]
fn main() {
#[cfg(not(target_arch = "wasm32"))]
{
Expand All @@ -417,6 +420,9 @@ fn main() {
}
}

#[cfg(test)]
wgpu_test::gpu_test_main!();

#[cfg(test)]
mod tests {
use wgpu_test::{gpu_test, GpuTestConfiguration};
Expand Down
4 changes: 2 additions & 2 deletions tests/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ bitflags::bitflags! {

// Builder pattern to make it easier
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 {
self.features(Features::MAPPABLE_PRIMARY_BUFFERS | Features::VERTEX_WRITABLE_STORAGE)
self.downlevel_flags(DownlevelFlags::COMPUTE_SHADERS)
.limits(wgpu::Limits::downlevel_defaults())
}

Expand Down
Loading

0 comments on commit 526e7ab

Please sign in to comment.