From ce081796c80675b56b3874089238789e2f98893a Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Fri, 14 Oct 2022 22:55:36 -0400 Subject: [PATCH] Rework CI (#3097) --- .cargo/{config => config.toml} | 0 .github/workflows/ci.yml | 370 ++++++++++++-------- .github/workflows/lazy.yaml | 32 -- Cargo.lock | 599 +++++++++++++++++++++++++++++++++ Cargo.toml | 4 +- player/Cargo.toml | 2 + wgpu-hal/src/dx12/device.rs | 4 +- wgpu/Cargo.toml | 5 +- wgpu/examples/cube/main.rs | 4 +- wgpu/examples/shadow/main.rs | 2 +- wgpu/examples/skybox/main.rs | 9 +- wgpu/examples/water/main.rs | 5 +- wgpu/tests/common/mod.rs | 8 +- 13 files changed, 852 insertions(+), 192 deletions(-) rename .cargo/{config => config.toml} (100%) delete mode 100644 .github/workflows/lazy.yaml diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a1cb04a0..78f9fdb7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,122 +2,96 @@ name: CI on: push: - branches: [master, staging] + branches: ["*"] tags: [v0.*] pull_request: env: RUST_BACKTRACE: 1 RUST_VERSION: 1.62 + PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work + RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings + RUSTDOCFLAGS: -Dwarnings + CACHE_SUFFIX: c # cache busting # We distinguish the following kinds of builds: -# - local: build for the same target as we compile on, and do local tests -# - other: build without testing, e.g. cross-build +# - native: build for the same target as we compile on # - web: build for the Web # - em: build for the Emscripten +# For build time and size optimization we disable debug +# entirely on clippy jobs and reduce it to line-numbers +# only for ones where we run tests. +# +# Additionally, we disable incremental builds entirely +# as our caching system doesn't actually cache our crates. +# It adds overhead to the build and another point of failure. + jobs: - build: + check-msrv: strategy: fail-fast: false matrix: include: # Windows - name: Windows x86_64 - os: windows-2019 + os: windows-2022 target: x86_64-pc-windows-msvc - tool: clippy - kind: local - backends: dx12 # dx11 - nextest_url: https://get.nexte.st/latest/windows-tar - - - name: Windows Nightly x86_64 - os: windows-2019 - target: x86_64-pc-windows-msvc - tool: check - kind: other + kind: native # MacOS - name: MacOS x86_64 - os: macos-11 + os: macos-12 target: x86_64-apple-darwin - tool: clippy - # Mac has no software runners, so don't run tests - kind: other + kind: native - name: MacOS aarch64 - os: macos-11 + os: macos-12 target: aarch64-apple-darwin - tool: check - # Mac has no software runners, so don't run tests - kind: other + kind: native # IOS - name: IOS aarch64 - os: macos-11 + os: macos-12 target: aarch64-apple-ios - tool: clippy - kind: other - + kind: native # Linux - name: Linux x86_64 - os: ubuntu-20.04 + os: ubuntu-22.04 target: x86_64-unknown-linux-gnu - tool: clippy - kind: local - backends: vulkan gl - nextest_url: https://get.nexte.st/latest/linux + kind: native - name: Linux aarch64 - os: ubuntu-20.04 + os: ubuntu-22.04 target: aarch64-unknown-linux-gnu - tool: check - kind: other + kind: native - - name: Linux Nightly x86_64 - os: ubuntu-20.04 - target: x86_64-unknown-linux-gnu - tool: check - kind: other - - # Android - name: Android aarch64 - os: ubuntu-20.04 + os: ubuntu-22.04 target: aarch64-linux-android - tool: clippy - kind: other + kind: native - # WebGPU/WebGL - name: WebAssembly - os: ubuntu-20.04 + os: ubuntu-22.04 target: wasm32-unknown-unknown - tool: clippy kind: web - name: Emscripten - os: ubuntu-20.04 + os: ubuntu-22.04 target: wasm32-unknown-emscripten - tool: clippy kind: em - name: Check ${{ matrix.name }} + name: Clippy ${{ matrix.name }} runs-on: ${{ matrix.os }} - env: - PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work - RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings - RUSTDOCFLAGS: -Dwarnings - steps: - name: checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - # Only run clippy on MSRV - - name: install rust stable - if: matrix.tool == 'clippy' + - name: install rust ${{ env.RUST_VERSION }} uses: actions-rs/toolchain@v1 with: toolchain: ${{ env.RUST_VERSION }} @@ -126,38 +100,122 @@ jobs: override: true components: clippy - # Other builds can use nightly - - name: install rust nightly - if: matrix.tool != 'clippy' - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - target: ${{ matrix.target }} - profile: minimal - override: true - - - name: caching - uses: Swatinem/rust-cache@v1 - with: - key: ${{ matrix.target }}-b # suffix for cache busting - - - name: download nextest - if: matrix.kind == 'local' + - name: disable debug shell: bash run: | - curl -LsSf ${{ matrix.nextest_url }} | tar xzf - -C ${CARGO_HOME:-~/.cargo}/bin + mkdir -p .cargo + echo """ + [profile.dev] + incremental = false + debug = false" >> .cargo/config.toml + + - name: caching + uses: Swatinem/rust-cache@v2 + with: + key: clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }} - name: add android apk to path - if: matrix.os == 'ubuntu-20.04' && matrix.target == 'aarch64-linux-android' + if: matrix.target == 'aarch64-linux-android' run: | echo "$ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH - - name: install llvmpipe, lavapipe, and vulkan sdk - if: matrix.os == 'ubuntu-20.04' && matrix.target != 'aarch64-linux-android' && matrix.kind == 'local' + - name: check web + if: matrix.kind == 'web' + shell: bash run: | - sudo apt-get update -y -qq + set -e + + # build for WebGPU + cargo clippy --target ${{ matrix.target }} -p wgpu --tests --features glsl,spirv + + # build for WebGL + cargo clippy --target ${{ matrix.target }} -p wgpu --tests --features webgl,glsl,spirv + + # build docs + cargo doc --target ${{ matrix.target }} -p wgpu --no-deps --features glsl,spirv + + - name: check em + if: matrix.kind == 'em' + shell: bash + run: | + set -e + + # build for Emscripten/WebGL + cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten + + # build raw-gles example + cargo clippy --target ${{ matrix.target }} --example raw-gles --features webgl,emscripten + + - name: check native + if: matrix.kind == 'native' + shell: bash + run: | + set -e + + # check with no features + cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --no-default-features + + # check with all features + cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --tests --all-features + + # build docs + cargo doc --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --all-features --no-deps + + gpu-test: + strategy: + fail-fast: false + matrix: + include: + # Windows + - name: Windows x86_64 + os: windows-2022 + backends: dx12 + + # Linux + - name: Linux x86_64 + os: ubuntu-22.04 + backends: vulkan gl + + name: Test ${{ matrix.name }} + runs-on: ${{ matrix.os }} + + steps: + - name: checkout repo + uses: actions/checkout@v3 + + - name: install rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + components: llvm-tools-preview + + - name: latest cargo-nextest + uses: taiki-e/install-action@nextest + - name: install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + + - name: install swiftshader + if: matrix.os == 'ubuntu-22.04' + shell: bash + run: | + set -e - # llvmpipe/lavapipe + mkdir -p swiftshader + curl -LsSf https://github.com/gfx-rs/ci-build/releases/latest/download/swiftshader-linux-x86_64.tar.xz | tar -xf - -C swiftshader + + echo "LD_LIBRARY_PATH=$PWD/swiftshader" >> $GITHUB_ENV + + - name: install llvmpipe, vulkan sdk + if: matrix.os == 'ubuntu-22.04' + shell: bash + run: | + set -e + + sudo apt-get update -y -qq + + # llvmpipe sudo add-apt-repository ppa:oibaf/graphics-drivers -y # vulkan sdk @@ -165,79 +223,93 @@ jobs: sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-focal.list https://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list sudo apt-get update - sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers vulkan-sdk + sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev vulkan-sdk - # We enable line numbers for panics, but that's it - name: disable debug shell: bash run: | mkdir -p .cargo - echo """\n[profile.dev] + echo """ + [profile.dev] + incremental = false debug = 1" >> .cargo/config.toml - - name: check web - if: matrix.kind == 'web' - run: | - # build with no features - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --no-default-features + - name: caching + uses: Swatinem/rust-cache@v2 + with: + key: test-${{ matrix.os }}-${{ env.CACHE_SUFFIX }} - # build examples - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --examples - - # build with features - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features glsl,spirv - - # build for WebGL - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features webgl - - # build docs - cargo doc --target ${{ matrix.target }} -p wgpu --no-deps - - - name: check em - if: matrix.kind == 'em' - run: | - # build for Emscripten/WebGL - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten - - # build raw-gles example - cargo ${{matrix.tool}} --target ${{ matrix.target }} --example raw-gles --features webgl,emscripten - - - name: check native - if: matrix.kind == 'local' || matrix.kind == 'other' - run: | - # check with no features - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --no-default-features - - # check with all features - # explicitly don't mention wgpu-hal so that --all-features don't apply to it - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --examples --tests --all-features - - # build docs - cargo doc --target ${{ matrix.target }} --no-deps - cargo doc --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --all-features --no-deps - - - name: local tests - if: matrix.kind == 'local' + - name: run wgpu-info shell: bash run: | - # run wgpu-info - cargo run --bin wgpu-info --features angle,vulkan-portability - # run unit and player tests - cargo nextest run -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast - # run native tests + set -e + + cargo llvm-cov run --bin wgpu-info --no-report + + - name: run tests + shell: bash + run: | + set -e + for backend in ${{ matrix.backends }}; do echo "======= NATIVE TESTS $backend ======"; - WGPU_BACKEND=$backend cargo nextest run -p wgpu --no-fail-fast - # Test that we catch overflows in `--release` builds too. - WGPU_BACKEND=$backend cargo nextest run --release -p wgpu --no-fail-fast + WGPU_BACKEND=$backend cargo llvm-cov nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report done + - name: generate coverage report + shell: bash + run: | + set -e + + cargo llvm-cov report --lcov --output-path lcov.info + + - name: upload coverage report to codecov + uses: codecov/codecov-action@v3 + with: + files: lcov.info + + doctest: + name: Doctest + runs-on: ubuntu-22.04 + + steps: + - name: checkout repo + uses: actions/checkout@v3 + + - name: install rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: disable debug + shell: bash + run: | + mkdir -p .cargo + echo """ + [profile.dev] + incremental = false + debug = 1" >> .cargo/config.toml + + - name: caching + uses: Swatinem/rust-cache@v2 + with: + key: clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }} + + - name: run doctests + shell: bash + run: | + set -e + + cargo test --doc + fmt: name: Format runs-on: ubuntu-latest steps: - name: checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: install rust uses: actions-rs/toolchain@v1 @@ -251,19 +323,33 @@ jobs: run: | cargo fmt -- --check - deno: - name: Deno + check-msrv-cts_runner: + name: Clippy cts_runner runs-on: ubuntu-latest steps: - name: checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: install rust uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: ${{ env.RUST_VERSION }} + + - name: disable debug + shell: bash + run: | + mkdir -p .cargo + echo """ + [profile.dev] + incremental = false + debug = 1" >> .cargo/config.toml + + - name: caching + uses: Swatinem/rust-cache@v2 + with: + key: cts_runner-${{ env.CACHE_SUFFIX }} - name: build Deno run: | - cargo check --manifest-path cts_runner/Cargo.toml + cargo clippy --manifest-path cts_runner/Cargo.toml diff --git a/.github/workflows/lazy.yaml b/.github/workflows/lazy.yaml deleted file mode 100644 index 352e57cc8..000000000 --- a/.github/workflows/lazy.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Lazy jobs running on master post merges. -name: Lazy -on: - push: - branches: [master] - -jobs: - coverage: - name: Coverage - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - run: sudo apt-get update -y -qq - - run: sudo add-apt-repository ppa:ubuntu-x-swat/updates -y - - run: sudo apt-get update - - run: sudo apt install -y libxcb-xfixes0-dev mesa-vulkan-drivers - - name: Generate report - uses: actions-rs/tarpaulin@v0.1 - with: - args: '-p wgpu-core -p wgpu-hal' - - name: Upload to codecov.io - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - name: Archive code coverage results - uses: actions/upload-artifact@v1 - with: - name: code-coverage-report - path: cobertura.xml diff --git a/Cargo.lock b/Cargo.lock index a95cefa90..c66681888 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,6 +93,17 @@ version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +[[package]] +name = "async-trait" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atty" version = "0.2.14" @@ -120,12 +131,27 @@ dependencies = [ "safemem", ] +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + [[package]] name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64-simd" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278c7ba87265587c4823cf1b2fdf57834151540b2e509574adb03627f8c7f22d" +dependencies = [ + "simd-abstraction", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -195,6 +221,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" + [[package]] name = "cache-padded" version = "1.2.0" @@ -331,6 +363,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "core-foundation" version = "0.9.3" @@ -416,6 +454,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "cts_runner" +version = "0.1.0" +dependencies = [ + "deno_console", + "deno_core", + "deno_url", + "deno_web", + "deno_webgpu", + "deno_webidl", + "termcolor", + "tokio", +] + [[package]] name = "cty" version = "0.2.2" @@ -479,6 +531,113 @@ dependencies = [ "enum_primitive", ] +[[package]] +name = "deno_console" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02cd684bd0097101aa8b411dac1e955ded1bc9c0945a453b607af929ca33b380" +dependencies = [ + "deno_core", +] + +[[package]] +name = "deno_core" +version = "0.151.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "390bdf983f9f20d403b09894ce4d9baeb980fa5faa33bf859c47ffa729abd157" +dependencies = [ + "anyhow", + "deno_ops", + "futures", + "indexmap", + "libc", + "log", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "serde", + "serde_json", + "serde_v8", + "sourcemap", + "url", + "v8", +] + +[[package]] +name = "deno_ops" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e5775de06dc4589c43fa5d81d962f8db9640ccf214291625300e6bf6f3e806" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "deno_url" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc823c3e01d24a2a55e8e9b23fcdcfdf376c039a24b3e3571b9b17630f05186" +dependencies = [ + "deno_core", + "serde", + "serde_repr", + "urlpattern", +] + +[[package]] +name = "deno_web" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "204620cb1ce3ec06b74d51fb3370c4fcb25d34d42b0557b6e97bbe84ea64e770" +dependencies = [ + "async-trait", + "base64-simd", + "deno_core", + "encoding_rs", + "flate2", + "serde", + "tokio", + "uuid", +] + +[[package]] +name = "deno_webgpu" +version = "0.63.0" +dependencies = [ + "deno_core", + "serde", + "tokio", + "wgpu-core", + "wgpu-types", +] + +[[package]] +name = "deno_webidl" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3bbfcb5416924c4b7ed50514d6577d8a87a61772a043daabe00d81734f5cb07" +dependencies = [ + "deno_core", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn", +] + [[package]] name = "devserver_lib" version = "0.4.1" @@ -527,6 +686,21 @@ dependencies = [ "wio", ] +[[package]] +name = "either" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + [[package]] name = "enum_primitive" version = "0.1.1" @@ -632,6 +806,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + [[package]] name = "freetype-rs" version = "0.26.0" @@ -654,12 +837,58 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "fslock" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57eafdd0c16f57161105ae1b98a1238f97645f2f588438b2949c99a2af9616bf" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "futures" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +dependencies = [ + "futures-core", + "futures-sink", +] + [[package]] name = "futures-core" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +[[package]] +name = "futures-executor" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-intrusive" version = "0.4.0" @@ -692,6 +921,47 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-macro" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" + +[[package]] +name = "futures-task" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" + +[[package]] +name = "futures-util" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -906,6 +1176,22 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + [[package]] name = "indexmap" version = "1.9.1" @@ -1224,6 +1510,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_enum" version = "0.5.7" @@ -1361,12 +1657,38 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.25" @@ -1600,6 +1922,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.14", +] + [[package]] name = "ryu" version = "1.0.11" @@ -1645,6 +1985,27 @@ dependencies = [ "tiny-skia", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.145" @@ -1654,6 +2015,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.145" @@ -1671,11 +2041,37 @@ version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ + "indexmap", "itoa", "ryu", "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_v8" +version = "0.62.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f30310f753d4b1347acdd669a30b8e6208029cfbb28d3d91012b19333eeff1" +dependencies = [ + "bytes", + "derive_more", + "serde", + "serde_bytes", + "smallvec", + "v8", +] + [[package]] name = "servo-fontconfig" version = "0.5.1" @@ -1707,6 +2103,21 @@ dependencies = [ "libc", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "simd-abstraction" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2880f3f7b392823ee65bbcc681961cd8e698c6a30e91ab9b4eef1f9c6c226d8" + [[package]] name = "slab" version = "0.4.7" @@ -1750,6 +2161,32 @@ dependencies = [ "wayland-protocols", ] +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "sourcemap" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e031f2463ecbdd5f34c950f89f5c1e1032f22c0f8e3dc4bdb2e8b6658cf61eb" +dependencies = [ + "base64 0.11.0", + "if_chain", + "lazy_static", + "regex", + "rustc_version 0.2.3", + "serde", + "serde_json", + "url", +] + [[package]] name = "spirv" version = "0.2.0+1.5.4" @@ -1851,6 +2288,52 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "toml" version = "0.5.9" @@ -1860,12 +2343,68 @@ dependencies = [ "serde", ] +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-ucd-ident" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + [[package]] name = "unicode-ident" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.10.0" @@ -1884,6 +2423,54 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlpattern" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9bd5ff03aea02fa45b13a7980151fe45009af1980ba69f651ec367121a31609" +dependencies = [ + "derive_more", + "regex", + "serde", + "unic-ucd-ident", + "url", +] + +[[package]] +name = "uuid" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" +dependencies = [ + "getrandom 0.2.7", + "serde", +] + +[[package]] +name = "v8" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a1cbad73336d67babcbe5e3b03c907c8d2ff77fc6f997570af219bbd9fdb6ce" +dependencies = [ + "bitflags", + "fslock", + "lazy_static", + "libc", + "which", +] + [[package]] name = "vec_map" version = "0.8.2" @@ -2205,6 +2792,7 @@ dependencies = [ "async-executor", "bitflags", "bytemuck", + "cfg-if", "console_error_panic_hook", "console_log", "ddsfile", @@ -2315,6 +2903,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "which" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +dependencies = [ + "either", + "libc", + "once_cell", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 7d3044ae3..6fb12398c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,8 @@ [workspace] resolver = "2" members = [ + "cts_runner", + "deno_webgpu", "dummy", "player", "wgpu", @@ -11,8 +13,6 @@ members = [ "run-wasm", ] exclude = [ - "cts_runner", - "deno_webgpu", ] default-members = ["wgpu", "wgpu-hal", "wgpu-info"] diff --git a/player/Cargo.toml b/player/Cargo.toml index 8cfbbcff8..34a54f9c2 100644 --- a/player/Cargo.toml +++ b/player/Cargo.toml @@ -13,6 +13,8 @@ license = "MIT OR Apache-2.0" publish = false [features] +angle = ["wgc/angle"] +vulkan-portability = ["wgc/vulkan-portability"] [dependencies] env_logger = "0.9" diff --git a/wgpu-hal/src/dx12/device.rs b/wgpu-hal/src/dx12/device.rs index 42bb343fa..92bbefef6 100644 --- a/wgpu-hal/src/dx12/device.rs +++ b/wgpu-hal/src/dx12/device.rs @@ -1260,10 +1260,10 @@ impl crate::Device for super::Device { } unsafe fn destroy_bind_group(&self, group: super::BindGroup) { if let Some(dual) = group.handle_views { - let _ = self.shared.heap_views.free_slice(dual); + self.shared.heap_views.free_slice(dual); } if let Some(dual) = group.handle_samplers { - let _ = self.shared.heap_samplers.free_slice(dual); + self.shared.heap_samplers.free_slice(dual); } } diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 2017ada19..3f0489013 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -123,22 +123,23 @@ static_assertions = "1.1.0" [dev-dependencies] bitflags = "1" bytemuck = { version = "1.4", features = ["derive"] } +cfg-if = "1" glam = "0.21.3" ddsfile = "0.5" futures-intrusive = "0.4" +env_logger = "0.9" log = "0.4" # Opt out of noise's "default-features" to avoid "image" feature as a dependency count optimization. # This will not be required in the next release since it has been removed from the default feature in https://github.com/Razaekel/noise-rs/commit/1af9e1522236b2c584fb9a02150c9c67a5e6bb04#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542 noise = { version = "0.7", default-features = false } obj = "0.10" +pollster = "0.2" png = "0.17" nanorand = { version = "0.7", default-features = false, features = ["wyrand"] } winit = "0.27.1" # for "halmark" example [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] async-executor = "1.0" -pollster = "0.2" -env_logger = "0.9" [dependencies.naga] git = "https://github.com/gfx-rs/naga" diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index dadf81b0a..5f0ffb9dc 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -415,7 +415,7 @@ fn cube() { optional_features: wgpu::Features::default(), base_test_parameters: framework::test_common::TestParameters::default(), tolerance: 1, - max_outliers: 500, // Bounded by rpi4 + max_outliers: 1225, // Bounded by swiftshader }); } @@ -428,6 +428,6 @@ fn cube_lines() { optional_features: wgpu::Features::POLYGON_MODE_LINE, base_test_parameters: framework::test_common::TestParameters::default(), tolerance: 2, - max_outliers: 600, // Bounded by rpi4 on GL + max_outliers: 1250, // Bounded by swiftshader }); } diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index 72106ebfd..d2eba66c3 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -855,6 +855,6 @@ fn shadow() { // llvmpipe versions in CI are flaky: https://github.com/gfx-rs/wgpu/issues/2594 .specific_failure(Some(wgpu::Backends::VULKAN), None, Some("llvmpipe"), true), tolerance: 2, - max_outliers: 500, // bounded by rpi4 + max_outliers: 1075, // bounded by swiftshader }); } diff --git a/wgpu/examples/skybox/main.rs b/wgpu/examples/skybox/main.rs index 3b4a152c1..d5b08634a 100644 --- a/wgpu/examples/skybox/main.rs +++ b/wgpu/examples/skybox/main.rs @@ -472,10 +472,9 @@ fn skybox() { width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default() - .backend_failure(wgpu::Backends::GL), + base_test_parameters: framework::test_common::TestParameters::default(), tolerance: 3, - max_outliers: 3, + max_outliers: 207, // bounded by swiftshader }); } @@ -488,7 +487,7 @@ fn skybox_bc1() { optional_features: wgpu::Features::TEXTURE_COMPRESSION_BC, base_test_parameters: framework::test_common::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056 tolerance: 5, - max_outliers: 105, // Bounded by llvmpipe + max_outliers: 191, // Bounded by swiftshader }); } @@ -501,7 +500,7 @@ fn skybox_etc2() { optional_features: wgpu::Features::TEXTURE_COMPRESSION_ETC2, base_test_parameters: framework::test_common::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056 tolerance: 5, - max_outliers: 105, // Bounded by llvmpipe + max_outliers: 248, // Bounded by swiftshader }); } diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index d246e9a67..aa785c6ec 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -826,9 +826,8 @@ fn water() { height: 768, optional_features: wgpu::Features::default(), base_test_parameters: framework::test_common::TestParameters::default() - .downlevel_flags(wgpu::DownlevelFlags::READ_ONLY_DEPTH_STENCIL) - .specific_failure(Some(wgpu::Backends::DX12), None, Some("Basic"), false), // WARP has a bug https://github.com/gfx-rs/wgpu/issues/1730 + .downlevel_flags(wgpu::DownlevelFlags::READ_ONLY_DEPTH_STENCIL), tolerance: 5, - max_outliers: 470, // bounded by DX12, then AMD Radeon Polaris12 on vk linux + max_outliers: 1693, // bounded by swiftshader }); } diff --git a/wgpu/tests/common/mod.rs b/wgpu/tests/common/mod.rs index 9b12f4672..3a87e41c6 100644 --- a/wgpu/tests/common/mod.rs +++ b/wgpu/tests/common/mod.rs @@ -278,7 +278,13 @@ pub fn initialize_test(parameters: TestParameters, test_function: impl FnOnce(Te } let panicked = catch_unwind(AssertUnwindSafe(|| test_function(context))).is_err(); - let canary_set = hal::VALIDATION_CANARY.get_and_reset(); + cfg_if::cfg_if!( + if #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] { + let canary_set = hal::VALIDATION_CANARY.get_and_reset(); + } else { + let canary_set = false; + } + ); let failed = panicked || canary_set;