From 10172e1f381a53494f8851c3369273473a103603 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Sat, 10 Jun 2023 14:35:46 -0400 Subject: [PATCH] Move Examples and Tests to Their Own Crates (#3841) Co-authored-by: Connor Fitzgerald --- .deny.toml | 5 +- .github/pull_request_template.md | 2 +- .github/workflows/ci.yml | 22 +- .github/workflows/publish.yml | 8 +- Cargo.lock | 798 ++++++++++++------ Cargo.toml | 19 +- {wgpu/examples => examples}/README.md | 0 examples/boids/Cargo.toml | 22 + {wgpu/examples => examples}/boids/README.md | 0 .../boids/screenshot.png | Bin .../boids => examples/boids/src}/compute.wgsl | 0 .../boids => examples/boids/src}/draw.wgsl | 0 .../boids => examples/boids/src}/main.rs | 17 +- examples/bunnymark/Cargo.toml | 24 + .../bunnymark/screenshot.png | Bin .../bunnymark/src}/main.rs | 17 +- examples/capture/Cargo.toml | 28 + {wgpu/examples => examples}/capture/README.md | 0 .../capture/screenshot.png | Bin .../capture => examples/capture/src}/main.rs | 9 +- examples/common/Cargo.toml | 42 + .../common/src}/framework.rs | 18 +- examples/common/src/lib.rs | 1 + examples/conservative-raster/Cargo.toml | 20 + .../conservative-raster/README.md | 0 .../conservative-raster/screenshot.png | Bin .../conservative-raster/src}/main.rs | 15 +- .../src}/triangle_and_lines.wgsl | 0 .../conservative-raster/src}/upscale.wgsl | 0 examples/cube/Cargo.toml | 22 + {wgpu/examples => examples}/cube/README.md | 0 .../cube/screenshot-lines.png | Bin .../examples => examples}/cube/screenshot.png | Bin .../cube => examples/cube/src}/main.rs | 32 +- .../cube => examples/cube/src}/shader.wgsl | 0 examples/hello-compute/Cargo.toml | 30 + .../hello-compute/README.md | 0 .../hello-compute/src}/main.rs | 0 .../hello-compute/src}/shader.wgsl | 0 .../hello-compute/src}/tests.rs | 5 +- examples/hello-triangle/Cargo.toml | 24 + .../hello-triangle/README.md | 0 .../hello-triangle/screenshot.png | Bin .../hello-triangle/src}/main.rs | 0 .../hello-triangle/src}/shader.wgsl | 0 examples/hello-windows/Cargo.toml | 21 + .../hello-windows/README.md | 0 .../hello-windows/screenshot.png | Bin .../hello-windows/src}/main.rs | 0 examples/hello/Cargo.toml | 27 + {wgpu/examples => examples}/hello/README.md | 0 .../hello => examples/hello/src}/main.rs | 0 examples/mipmap/Cargo.toml | 22 + {wgpu/examples => examples}/mipmap/README.md | 0 .../mipmap/screenshot.png | Bin .../mipmap => examples/mipmap/src}/blit.wgsl | 0 .../mipmap => examples/mipmap/src}/draw.wgsl | 0 .../mipmap => examples/mipmap/src}/main.rs | 15 +- examples/msaa-line/Cargo.toml | 24 + .../examples => examples}/msaa-line/README.md | 0 .../msaa-line/screenshot.png | Bin .../msaa-line/src}/main.rs | 23 +- .../msaa-line/src}/shader.wgsl | 0 examples/shadow/Cargo.toml | 23 + {wgpu/examples => examples}/shadow/README.md | 0 .../shadow/screenshot.png | Bin .../shadow => examples/shadow/src}/main.rs | 15 +- .../shadow/src}/shader.wgsl | 0 examples/skybox/Cargo.toml | 25 + {wgpu/examples => examples}/skybox/README.md | 0 .../skybox/images/astc.dds | Bin .../skybox/images/bc1.dds | Bin .../skybox/images/bgra.dds | Bin .../skybox/images/etc2.dds | Bin .../skybox/models/teslacyberv3.0.mtl | 0 .../skybox/models/teslacyberv3.0.obj | 0 .../skybox/screenshot-astc.png | Bin .../skybox/screenshot-bc1.png | Bin .../skybox/screenshot-etc2.png | Bin .../skybox/screenshot.png | Bin .../skybox => examples/skybox/src}/main.rs | 43 +- .../skybox/src}/shader.wgsl | 0 examples/stencil-triangles/Cargo.toml | 21 + .../stencil-triangles/README.md | 0 .../stencil-triangles/screenshot.png | Bin .../stencil-triangles/src}/main.rs | 15 +- .../stencil-triangles/src}/shader.wgsl | 0 examples/texture-arrays/Cargo.toml | 21 + .../texture-arrays/screenshot.png | Bin .../texture-arrays/src}/indexing.wgsl | 0 .../texture-arrays/src}/main.rs | 21 +- .../src}/non_uniform_indexing.wgsl | 0 examples/water/Cargo.toml | 24 + {wgpu/examples => examples}/water/README.md | 0 .../water/screenshot.png | Bin .../water => examples/water/src}/main.rs | 15 +- .../water => examples/water/src}/point_gen.rs | 0 .../water => examples/water/src}/terrain.wgsl | 0 .../water => examples/water/src}/water.wgsl | 0 player/Cargo.toml | 16 +- player/src/bin/play.rs | 20 +- player/src/lib.rs | 2 +- .../tests/data/pipeline-statistics-query.ron | 4 +- player/tests/test.rs | 11 + tests/Cargo.toml | 50 ++ .../src}/copy_texture_to_buffer.wgsl | 0 {wgpu/tests/common => tests/src}/image.rs | 0 {wgpu/tests/common => tests/src}/isolation.rs | 0 wgpu/tests/common/mod.rs => tests/src/lib.rs | 32 +- {wgpu => tests}/tests/3x3_colors.png | Bin {wgpu => tests}/tests/buffer.rs | 2 +- {wgpu => tests}/tests/buffer_copy.rs | 2 +- {wgpu => tests}/tests/buffer_usages.rs | 2 +- {wgpu => tests}/tests/clear_texture.rs | 2 +- {wgpu => tests}/tests/device.rs | 2 +- {wgpu => tests}/tests/encoder.rs | 2 +- {wgpu => tests}/tests/example_wgsl.rs | 0 {wgpu => tests}/tests/external_texture.rs | 2 +- {wgpu => tests}/tests/instance.rs | 0 {wgpu => tests}/tests/poll.rs | 2 +- {wgpu => tests}/tests/queue_transfer.rs | 2 +- .../tests/regression/issue_3457.rs | 2 +- .../tests/regression/issue_3457.wgsl | 0 .../tests/resource_descriptor_accessor.rs | 2 +- {wgpu => tests}/tests/resource_error.rs | 2 +- {wgpu => tests}/tests/root.rs | 3 - {wgpu => tests}/tests/shader/mod.rs | 2 +- .../tests/shader/numeric_builtins.rs | 6 +- {wgpu => tests}/tests/shader/shader_test.wgsl | 0 {wgpu => tests}/tests/shader/struct_layout.rs | 6 +- .../tests/shader/zero_init_workgroup_mem.rs | 2 +- .../tests/shader/zero_init_workgroup_mem.wgsl | 0 .../tests/shader_primitive_index/mod.rs | 2 +- .../primitive_index.wgsl | 0 .../tests/shader_view_format/mod.rs | 2 +- .../tests/shader_view_format/view_format.wgsl | 0 {wgpu => tests}/tests/texture_bounds.rs | 2 +- {wgpu => tests}/tests/transfer.rs | 2 +- .../tests/vertex_indices/draw.vert.wgsl | 0 {wgpu => tests}/tests/vertex_indices/mod.rs | 2 +- {wgpu => tests}/tests/write_texture.rs | 2 +- .../tests/zero_init_texture_after_discard.rs | 2 +- wgpu-core/src/error.rs | 20 +- wgpu-core/src/hub.rs | 16 + wgpu-core/src/instance.rs | 12 +- wgpu-core/src/lib.rs | 11 + wgpu-hal/Cargo.toml | 1 + wgpu-hal/examples/halmark/main.rs | 42 +- wgpu-hal/examples/raw-gles.rs | 1 + wgpu-types/src/lib.rs | 2 +- wgpu/Cargo.toml | 99 +-- wgpu/src/lib.rs | 17 +- 152 files changed, 1330 insertions(+), 618 deletions(-) rename {wgpu/examples => examples}/README.md (100%) create mode 100644 examples/boids/Cargo.toml rename {wgpu/examples => examples}/boids/README.md (100%) rename {wgpu/examples => examples}/boids/screenshot.png (100%) rename {wgpu/examples/boids => examples/boids/src}/compute.wgsl (100%) rename {wgpu/examples/boids => examples/boids/src}/draw.wgsl (100%) rename {wgpu/examples/boids => examples/boids/src}/main.rs (96%) create mode 100644 examples/bunnymark/Cargo.toml rename {wgpu/examples => examples}/bunnymark/screenshot.png (100%) rename {wgpu/examples/bunnymark => examples/bunnymark/src}/main.rs (96%) create mode 100644 examples/capture/Cargo.toml rename {wgpu/examples => examples}/capture/README.md (100%) rename {wgpu/examples => examples}/capture/screenshot.png (100%) rename {wgpu/examples/capture => examples/capture/src}/main.rs (96%) create mode 100644 examples/common/Cargo.toml rename {wgpu/examples => examples/common/src}/framework.rs (98%) create mode 100644 examples/common/src/lib.rs create mode 100644 examples/conservative-raster/Cargo.toml rename {wgpu/examples => examples}/conservative-raster/README.md (100%) rename {wgpu/examples => examples}/conservative-raster/screenshot.png (100%) rename {wgpu/examples/conservative-raster => examples/conservative-raster/src}/main.rs (96%) rename {wgpu/examples/conservative-raster => examples/conservative-raster/src}/triangle_and_lines.wgsl (100%) rename {wgpu/examples/conservative-raster => examples/conservative-raster/src}/upscale.wgsl (100%) create mode 100644 examples/cube/Cargo.toml rename {wgpu/examples => examples}/cube/README.md (100%) rename {wgpu/examples => examples}/cube/screenshot-lines.png (100%) rename {wgpu/examples => examples}/cube/screenshot.png (100%) rename {wgpu/examples/cube => examples/cube/src}/main.rs (94%) rename {wgpu/examples/cube => examples/cube/src}/shader.wgsl (100%) create mode 100644 examples/hello-compute/Cargo.toml rename {wgpu/examples => examples}/hello-compute/README.md (100%) rename {wgpu/examples/hello-compute => examples/hello-compute/src}/main.rs (100%) rename {wgpu/examples/hello-compute => examples/hello-compute/src}/shader.wgsl (100%) rename {wgpu/examples/hello-compute => examples/hello-compute/src}/tests.rs (97%) create mode 100644 examples/hello-triangle/Cargo.toml rename {wgpu/examples => examples}/hello-triangle/README.md (100%) rename {wgpu/examples => examples}/hello-triangle/screenshot.png (100%) rename {wgpu/examples/hello-triangle => examples/hello-triangle/src}/main.rs (100%) rename {wgpu/examples/hello-triangle => examples/hello-triangle/src}/shader.wgsl (100%) create mode 100644 examples/hello-windows/Cargo.toml rename {wgpu/examples => examples}/hello-windows/README.md (100%) rename {wgpu/examples => examples}/hello-windows/screenshot.png (100%) rename {wgpu/examples/hello-windows => examples/hello-windows/src}/main.rs (100%) create mode 100644 examples/hello/Cargo.toml rename {wgpu/examples => examples}/hello/README.md (100%) rename {wgpu/examples/hello => examples/hello/src}/main.rs (100%) create mode 100644 examples/mipmap/Cargo.toml rename {wgpu/examples => examples}/mipmap/README.md (100%) rename {wgpu/examples => examples}/mipmap/screenshot.png (100%) rename {wgpu/examples/mipmap => examples/mipmap/src}/blit.wgsl (100%) rename {wgpu/examples/mipmap => examples/mipmap/src}/draw.wgsl (100%) rename {wgpu/examples/mipmap => examples/mipmap/src}/main.rs (98%) create mode 100644 examples/msaa-line/Cargo.toml rename {wgpu/examples => examples}/msaa-line/README.md (100%) rename {wgpu/examples => examples}/msaa-line/screenshot.png (100%) rename {wgpu/examples/msaa-line => examples/msaa-line/src}/main.rs (94%) rename {wgpu/examples/msaa-line => examples/msaa-line/src}/shader.wgsl (100%) create mode 100644 examples/shadow/Cargo.toml rename {wgpu/examples => examples}/shadow/README.md (100%) rename {wgpu/examples => examples}/shadow/screenshot.png (100%) rename {wgpu/examples/shadow => examples/shadow/src}/main.rs (98%) rename {wgpu/examples/shadow => examples/shadow/src}/shader.wgsl (100%) create mode 100644 examples/skybox/Cargo.toml rename {wgpu/examples => examples}/skybox/README.md (100%) rename {wgpu/examples => examples}/skybox/images/astc.dds (100%) rename {wgpu/examples => examples}/skybox/images/bc1.dds (100%) rename {wgpu/examples => examples}/skybox/images/bgra.dds (100%) rename {wgpu/examples => examples}/skybox/images/etc2.dds (100%) rename {wgpu/examples => examples}/skybox/models/teslacyberv3.0.mtl (100%) rename {wgpu/examples => examples}/skybox/models/teslacyberv3.0.obj (100%) rename {wgpu/examples => examples}/skybox/screenshot-astc.png (100%) rename {wgpu/examples => examples}/skybox/screenshot-bc1.png (100%) rename {wgpu/examples => examples}/skybox/screenshot-etc2.png (100%) rename {wgpu/examples => examples}/skybox/screenshot.png (100%) rename {wgpu/examples/skybox => examples/skybox/src}/main.rs (92%) rename {wgpu/examples/skybox => examples/skybox/src}/shader.wgsl (100%) create mode 100644 examples/stencil-triangles/Cargo.toml rename {wgpu/examples => examples}/stencil-triangles/README.md (100%) rename {wgpu/examples => examples}/stencil-triangles/screenshot.png (100%) rename {wgpu/examples/stencil-triangles => examples/stencil-triangles/src}/main.rs (95%) rename {wgpu/examples/stencil-triangles => examples/stencil-triangles/src}/shader.wgsl (100%) create mode 100644 examples/texture-arrays/Cargo.toml rename {wgpu/examples => examples}/texture-arrays/screenshot.png (100%) rename {wgpu/examples/texture-arrays => examples/texture-arrays/src}/indexing.wgsl (100%) rename {wgpu/examples/texture-arrays => examples/texture-arrays/src}/main.rs (96%) rename {wgpu/examples/texture-arrays => examples/texture-arrays/src}/non_uniform_indexing.wgsl (100%) create mode 100644 examples/water/Cargo.toml rename {wgpu/examples => examples}/water/README.md (100%) rename {wgpu/examples => examples}/water/screenshot.png (100%) rename {wgpu/examples/water => examples/water/src}/main.rs (98%) rename {wgpu/examples/water => examples/water/src}/point_gen.rs (100%) rename {wgpu/examples/water => examples/water/src}/terrain.wgsl (100%) rename {wgpu/examples/water => examples/water/src}/water.wgsl (100%) create mode 100644 tests/Cargo.toml rename {wgpu/tests/common => tests/src}/copy_texture_to_buffer.wgsl (100%) rename {wgpu/tests/common => tests/src}/image.rs (100%) rename {wgpu/tests/common => tests/src}/isolation.rs (100%) rename wgpu/tests/common/mod.rs => tests/src/lib.rs (92%) rename {wgpu => tests}/tests/3x3_colors.png (100%) rename {wgpu => tests}/tests/buffer.rs (98%) rename {wgpu => tests}/tests/buffer_copy.rs (94%) rename {wgpu => tests}/tests/buffer_usages.rs (97%) rename {wgpu => tests}/tests/clear_texture.rs (99%) rename {wgpu => tests}/tests/device.rs (77%) rename {wgpu => tests}/tests/encoder.rs (84%) rename {wgpu => tests}/tests/example_wgsl.rs (100%) rename {wgpu => tests}/tests/external_texture.rs (99%) rename {wgpu => tests}/tests/instance.rs (100%) rename {wgpu => tests}/tests/poll.rs (97%) rename {wgpu => tests}/tests/queue_transfer.rs (96%) rename {wgpu => tests}/tests/regression/issue_3457.rs (99%) rename {wgpu => tests}/tests/regression/issue_3457.wgsl (100%) rename {wgpu => tests}/tests/resource_descriptor_accessor.rs (91%) rename {wgpu => tests}/tests/resource_error.rs (96%) rename {wgpu => tests}/tests/root.rs (92%) rename {wgpu => tests}/tests/shader/mod.rs (99%) rename {wgpu => tests}/tests/shader/numeric_builtins.rs (91%) rename {wgpu => tests}/tests/shader/shader_test.wgsl (100%) rename {wgpu => tests}/tests/shader/struct_layout.rs (98%) rename {wgpu => tests}/tests/shader/zero_init_workgroup_mem.rs (98%) rename {wgpu => tests}/tests/shader/zero_init_workgroup_mem.wgsl (100%) rename {wgpu => tests}/tests/shader_primitive_index/mod.rs (99%) rename {wgpu => tests}/tests/shader_primitive_index/primitive_index.wgsl (100%) rename {wgpu => tests}/tests/shader_view_format/mod.rs (98%) rename {wgpu => tests}/tests/shader_view_format/view_format.wgsl (100%) rename {wgpu => tests}/tests/texture_bounds.rs (98%) rename {wgpu => tests}/tests/transfer.rs (97%) rename {wgpu => tests}/tests/vertex_indices/draw.vert.wgsl (100%) rename {wgpu => tests}/tests/vertex_indices/mod.rs (98%) rename {wgpu => tests}/tests/write_texture.rs (99%) rename {wgpu => tests}/tests/zero_init_texture_after_discard.rs (99%) diff --git a/.deny.toml b/.deny.toml index 5613b6ac2..5c214bbc2 100644 --- a/.deny.toml +++ b/.deny.toml @@ -2,11 +2,12 @@ multiple-versions = "deny" skip-tree = [ { name = "cts_runner" }, - { name = "dummy" }, { name = "player" }, - { name = "run-wasm" }, { name = "wgpu-info" }, ] +skip = [ + { name = "wgpu" } +] wildcards = "deny" [licenses] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ddc9086a4..14e09dde0 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ **Checklist** - [ ] Run `cargo clippy`. -- [ ] Run `RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown` if applicable. +- [ ] Run `cargo clippy --target wasm32-unknown-unknown` if applicable. - [ ] Add change to CHANGELOG.md. See simple instructions inside file. **Connections** diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84bb455a5..50c303861 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,12 +138,12 @@ jobs: set -e # build for WebGPU - cargo clippy --target ${{ matrix.target }} -p wgpu --tests --features glsl,spirv - cargo doc --target ${{ matrix.target }} -p wgpu --no-deps --features glsl,spirv + cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv + cargo doc --target ${{ matrix.target }} --no-deps --features glsl,spirv # all features - cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --tests --all-features - cargo doc --target ${{ matrix.target }} -p wgpu --no-deps --all-features + cargo clippy --target ${{ matrix.target }} --tests --all-features + cargo doc --target ${{ matrix.target }} --no-deps --all-features - name: check em if: matrix.kind == 'em' @@ -155,7 +155,7 @@ jobs: cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features # build cube example - cargo clippy --target ${{ matrix.target }} --example cube + cargo clippy --target ${{ matrix.target }} --bin cube # build raw-gles example cargo clippy --target ${{ matrix.target }} --example raw-gles @@ -171,13 +171,13 @@ jobs: set -e # check with no features - cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --no-default-features + cargo clippy --target ${{ matrix.target }} --no-default-features # Check with all features. - cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player -p wgpu-core -p wgpu-hal --tests --all-features + cargo clippy --target ${{ matrix.target }} --tests --all-features # build docs - cargo doc --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player -p wgpu-core -p wgpu-hal --all-features --no-deps + cargo doc --target ${{ matrix.target }} --all-features --no-deps wasm-test: name: Test WebAssembly @@ -194,7 +194,7 @@ jobs: - name: execute tests run: | cd wgpu - wasm-pack test --headless --chrome --features webgl + wasm-pack test --headless --chrome --features webgl --workspace gpu-test: strategy: @@ -283,7 +283,7 @@ jobs: for backend in ${{ matrix.backends }}; do echo "======= NATIVE TESTS $backend ======"; - WGPU_BACKEND=$backend cargo llvm-cov --no-cfg-coverage nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report + WGPU_BACKEND=$backend cargo llvm-cov --no-cfg-coverage nextest --no-fail-fast --no-report done - uses: actions/upload-artifact@v3 @@ -331,7 +331,7 @@ jobs: run: | set -e - cargo test --doc -p wgpu -p wgpu-core -p wgpu-hal -p wgpu-types + cargo test --doc fmt: name: Format diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index deb393271..c872c4986 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,11 +27,11 @@ jobs: run: cargo +stable install wasm-bindgen-cli --version=0.2.84 - name: Build WebGPU examples - run: cargo build --package wgpu --release --target wasm32-unknown-unknown --examples + run: cargo build --release --target wasm32-unknown-unknown - name: Generate JS bindings for WebGPU examples run: | - for i in target/wasm32-unknown-unknown/release/examples/*.wasm; + for i in target/wasm32-unknown-unknown/release/*.wasm; do wasm-bindgen --no-typescript --out-dir target/generated-gpu --web "$i"; done @@ -49,11 +49,11 @@ jobs: run: cargo clean - name: Build WebGL examples - run: cargo build --release --target wasm32-unknown-unknown --examples --features webgl + run: cargo build --release --target wasm32-unknown-unknown --features webgl - name: Generate JS bindings for WebGL examples run: | - for i in target/wasm32-unknown-unknown/release/examples/*.wasm; + for i in target/wasm32-unknown-unknown/release/*.wasm; do wasm-bindgen --no-typescript --out-dir target/generated-gl --web "$i"; done diff --git a/Cargo.lock b/Cargo.lock index 9c86e7db5..9e5a01838 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ "gimli", ] @@ -23,16 +23,16 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -48,15 +48,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "arrayref" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" @@ -79,7 +79,7 @@ version = "0.37.3+1.3.251" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" dependencies = [ - "libloading", + "libloading 0.7.4", ] [[package]] @@ -98,19 +98,18 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" dependencies = [ "event-listener", - "futures-lite", ] [[package]] name = "async-task" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" @@ -120,7 +119,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", ] [[package]] @@ -131,15 +130,15 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.5.4", + "miniz_oxide 0.6.2", "object", "rustc-demangle", ] @@ -195,9 +194,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "bytemuck" @@ -210,13 +209,13 @@ dependencies = [ [[package]] name = "bytemuck_derive" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca418a974d83d40a0c1f0c5cba6ff4bc28d8df099109ca459a2118d40b6322" +checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 2.0.18", ] [[package]] @@ -233,12 +232,13 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "calloop" -version = "0.10.2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" dependencies = [ + "bitflags 1.3.2", "log", - "nix", + "nix 0.25.1", "slotmap", "thiserror", "vec_map", @@ -246,9 +246,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -267,9 +267,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.49" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ "cc", ] @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "cocoa-foundation" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" +checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ "bitflags 1.3.2", "block", @@ -329,9 +329,9 @@ checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" [[package]] name = "concurrent-queue" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ "crossbeam-utils", ] @@ -374,9 +374,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-graphics" @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", ] @@ -482,7 +482,7 @@ version = "0.6.0" source = "git+https://github.com/gfx-rs/d3d12-rs?rev=b940b1d71#b940b1d71ab7083ae80eec697872672dc1f2bd32" dependencies = [ "bitflags 1.3.2", - "libloading", + "libloading 0.7.4", "winapi", ] @@ -507,7 +507,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -518,14 +518,14 @@ checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] name = "data-encoding" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "ddsfile" @@ -586,7 +586,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -649,7 +649,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -660,11 +660,11 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dlib" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.0", ] [[package]] @@ -726,13 +726,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -763,9 +763,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] @@ -822,13 +822,13 @@ dependencies = [ [[package]] name = "foreign-types-macros" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 2.0.18", ] [[package]] @@ -845,9 +845,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -945,9 +945,9 @@ checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand", "futures-core", @@ -966,7 +966,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", ] [[package]] @@ -1012,9 +1012,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -1023,9 +1023,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "gl_generator" @@ -1069,7 +1069,7 @@ dependencies = [ "glutin_gles2_sys", "glutin_glx_sys", "glutin_wgl_sys", - "libloading", + "libloading 0.7.4", "log", "objc", "once_cell", @@ -1191,7 +1191,7 @@ dependencies = [ "bitflags 1.3.2", "com-rs", "libc", - "libloading", + "libloading 0.7.4", "thiserror", "widestring", "winapi", @@ -1232,9 +1232,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1262,9 +1262,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -1285,31 +1285,32 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.5" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ + "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jni-sys" @@ -1333,7 +1334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" dependencies = [ "libc", - "libloading", + "libloading 0.7.4", "pkg-config", ] @@ -1363,7 +1364,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -1389,16 +1390,26 @@ dependencies = [ ] [[package]] -name = "linux-raw-sys" -version = "0.1.4" +name = "libloading" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -1430,9 +1441,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ "libc", ] @@ -1476,6 +1487,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1488,14 +1508,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -1572,7 +1592,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -1596,6 +1616,19 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", +] + [[package]] name = "noise" version = "0.7.0" @@ -1608,9 +1641,9 @@ dependencies = [ [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1679,23 +1712,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -1743,18 +1776,18 @@ dependencies = [ [[package]] name = "object" -version = "0.29.0" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "osmesa-sys" @@ -1773,9 +1806,9 @@ checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" [[package]] name = "parking" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "parking_lot" @@ -1785,7 +1818,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -1795,34 +1828,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.5", + "parking_lot_core 0.9.8", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.42.0", + "windows-targets 0.48.0", ] [[package]] @@ -1833,15 +1866,15 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -1849,22 +1882,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 2.0.18", ] [[package]] @@ -1881,9 +1914,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "player" @@ -1907,7 +1940,7 @@ checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -1946,20 +1979,19 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.54" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -1972,9 +2004,9 @@ checksum = "332cd62e95873ea4f41f3dfd6bbbfc5b52aec892d7e8d534197c4720a0bbbab2" [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -2075,10 +2107,19 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.7.1" +name = "redox_syscall" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -2087,9 +2128,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "renderdoc-sys" @@ -2110,9 +2151,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -2140,23 +2181,23 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ "bitflags 1.3.2", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safe_arch" @@ -2214,9 +2255,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] @@ -2232,13 +2273,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", ] [[package]] @@ -2261,7 +2302,7 @@ checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 1.0.109", ] [[package]] @@ -2328,9 +2369,9 @@ checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2362,7 +2403,7 @@ dependencies = [ "lazy_static", "log", "memmap2", - "nix", + "nix 0.24.3", "pkg-config", "wayland-client", "wayland-cursor", @@ -2418,9 +2459,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.105" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2429,9 +2470,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.11" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e3787bb71465627110e7d87ed4faaa36c1f61042ee67badb9e2ef173accc40" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -2464,7 +2505,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", ] [[package]] @@ -2534,16 +2575,24 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", ] [[package]] -name = "toml" -version = "0.5.9" +name = "toml_datetime" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" + +[[package]] +name = "toml_edit" +version = "0.19.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ - "serde", + "indexmap", + "toml_datetime", + "winnow", ] [[package]] @@ -2601,9 +2650,9 @@ checksum = "d70b6494226b36008c8366c288d77190b3fad2eb4c10533139c1c1f461127f1a" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -2628,9 +2677,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -2653,11 +2702,11 @@ dependencies = [ [[package]] name = "uuid" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b55a3fef2a1e3b3a00ce878640918820d3c51081576ac657d23af9fc7928fdb" +checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.10", "serde", ] @@ -2730,15 +2779,15 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" dependencies = [ "cfg-if", "js-sys", @@ -2764,7 +2813,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.11", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2777,9 +2826,9 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-bindgen-test" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db36fc0f9fb209e88fb3642590ae0205bb5a56216dabd963ba15879fe53a30b" +checksum = "c9e636f3a428ff62b3742ebc3c70e254dfe12b8c2b469d688ea59cdd4abcf502" dependencies = [ "console_error_panic_hook", "js-sys", @@ -2791,9 +2840,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0734759ae6b3b1717d661fe4f016efcfb9828f5edb4520c18eaee05af3b43be9" +checksum = "f18c1fad2f7c4958e7bcce014fa212f59a65d5e3721d0f77e6c0b27ede936ba3" dependencies = [ "proc-macro2", "quote", @@ -2808,7 +2857,7 @@ dependencies = [ "bitflags 1.3.2", "downcast-rs", "libc", - "nix", + "nix 0.24.3", "scoped-tls", "wayland-commons", "wayland-scanner", @@ -2821,7 +2870,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" dependencies = [ - "nix", + "nix 0.24.3", "once_cell", "smallvec", "wayland-sys", @@ -2833,7 +2882,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" dependencies = [ - "nix", + "nix 0.24.3", "wayland-client", "xcursor", ] @@ -2884,9 +2933,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" dependencies = [ "js-sys", "wasm-bindgen", @@ -2897,27 +2946,11 @@ name = "wgpu" version = "0.16.0" dependencies = [ "arrayvec 0.7.2", - "async-executor", - "bitflags 2.3.1", - "bytemuck", "cfg-if", - "console_error_panic_hook", - "console_log", - "ddsfile", - "env_logger", - "futures-intrusive", - "glam", - "image", "js-sys", "log", "naga", - "nanorand", - "noise", - "nv-flip", - "obj", "parking_lot 0.12.1", - "png", - "pollster", "profiling", "raw-window-handle 0.5.2", "serde", @@ -2925,11 +2958,66 @@ dependencies = [ "static_assertions", "wasm-bindgen", "wasm-bindgen-futures", - "wasm-bindgen-test", "web-sys", "wgpu-core", "wgpu-hal", "wgpu-types", +] + +[[package]] +name = "wgpu-boids-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "nanorand", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-bunnymark-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "glam", + "nanorand", + "png", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-capture-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "console_error_panic_hook", + "console_log", + "env_logger", + "futures-intrusive", + "png", + "pollster", + "wasm-bindgen-futures", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "winit", +] + +[[package]] +name = "wgpu-conservative-raster-example" +version = "0.16.0" +dependencies = [ + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", "winit", ] @@ -2956,6 +3044,40 @@ dependencies = [ "wgpu-types", ] +[[package]] +name = "wgpu-cube-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "glam", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-example" +version = "0.16.0" +dependencies = [ + "async-executor", + "console_error_panic_hook", + "console_log", + "env_logger", + "js-sys", + "log", + "png", + "pollster", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu", + "wgpu-hal", + "wgpu-test", + "winit", +] + [[package]] name = "wgpu-hal" version = "0.16.0" @@ -2966,6 +3088,7 @@ dependencies = [ "bit-set", "bitflags 2.3.1", "block", + "cfg-if", "core-graphics-types", "d3d12", "env_logger", @@ -2978,7 +3101,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading", + "libloading 0.8.0", "log", "metal", "naga", @@ -2998,6 +3121,66 @@ dependencies = [ "winit", ] +[[package]] +name = "wgpu-hello-compute-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "console_error_panic_hook", + "console_log", + "env_logger", + "futures-intrusive", + "log", + "pollster", + "wasm-bindgen-futures", + "wasm-bindgen-test", + "wgpu", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-hello-example" +version = "0.16.0" +dependencies = [ + "console_error_panic_hook", + "console_log", + "env_logger", + "glam", + "log", + "pollster", + "wasm-bindgen-futures", + "wgpu", + "wgpu-test", +] + +[[package]] +name = "wgpu-hello-triangle-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "console_error_panic_hook", + "console_log", + "env_logger", + "pollster", + "wasm-bindgen-futures", + "web-sys", + "wgpu", + "winit", +] + +[[package]] +name = "wgpu-hello-windows-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "console_error_panic_hook", + "env_logger", + "pollster", + "wgpu", + "winit", +] + [[package]] name = "wgpu-info" version = "0.16.0" @@ -3007,6 +3190,111 @@ dependencies = [ "wgpu", ] +[[package]] +name = "wgpu-mipmap-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "glam", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-msaa-line-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "glam", + "log", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-shadow-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "glam", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-skybox-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "ddsfile", + "glam", + "log", + "obj", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-stencil-triangle-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + +[[package]] +name = "wgpu-test" +version = "0.16.0" +dependencies = [ + "bitflags 2.3.1", + "bytemuck", + "cfg-if", + "console_log", + "env_logger", + "image", + "js-sys", + "log", + "naga", + "nv-flip", + "png", + "pollster", + "raw-window-handle 0.5.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test", + "web-sys", + "wgpu", + "wgpu-types", +] + +[[package]] +name = "wgpu-texture-arrays-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + [[package]] name = "wgpu-types" version = "0.16.0" @@ -3018,6 +3306,21 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wgpu-water-example" +version = "0.16.0" +dependencies = [ + "bytemuck", + "glam", + "nanorand", + "noise", + "wasm-bindgen-test", + "wgpu", + "wgpu-example", + "wgpu-test", + "winit", +] + [[package]] name = "which" version = "4.4.0" @@ -3072,7 +3375,7 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows-targets 0.42.1", + "windows-targets 0.42.2", ] [[package]] @@ -3088,30 +3391,6 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.1", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -3123,17 +3402,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -3153,9 +3432,9 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" @@ -3171,9 +3450,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" @@ -3189,9 +3468,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" @@ -3207,9 +3486,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" @@ -3225,9 +3504,9 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" @@ -3237,9 +3516,9 @@ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" @@ -3255,9 +3534,9 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" @@ -3298,6 +3577,15 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "winnow" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +dependencies = [ + "memchr", +] + [[package]] name = "wio" version = "0.2.2" @@ -3309,12 +3597,12 @@ dependencies = [ [[package]] name = "x11-dl" -version = "2.20.1" +version = "2.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" dependencies = [ - "lazy_static", "libc", + "once_cell", "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 0a731f4aa..28e4ac9f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,14 +4,25 @@ members = [ "cts_runner", "deno_webgpu", "player", + "examples/*", "wgpu", "wgpu-core", "wgpu-hal", "wgpu-info", "wgpu-types", + "tests", ] exclude = [] -default-members = ["wgpu", "wgpu-hal", "wgpu-info", "wgpu-types"] +default-members = [ + "examples/*", + "player", + "wgpu", + "wgpu-core", + "wgpu-hal", + "wgpu-info", + "wgpu-types", + "tests" +] [workspace.package] edition = "2021" @@ -48,7 +59,7 @@ arrayvec = "0.7" async-executor = "1" bitflags = "2" bit-vec = "0.6" -bytemuck = "1.13" +bytemuck = { version = "1.13", features = ["derive"] } cfg_aliases = "0.1" cfg-if = "1" codespan-reporting = "0.11" @@ -62,7 +73,7 @@ image = { version = "0.24", default-features = false, features = ["png"] } libloading = ">=0.7,<0.9" libc = "0.2" log = "0.4" -nanorand = { version = "0.7", default-features = false } +nanorand = { version = "0.7", default-features = false, features = ["wyrand"] } nv-flip = "0.1" num-traits = { version = "0.2" } # Opt out of noise's "default-features" to avoid "image" feature as a dependency count optimization. @@ -83,6 +94,8 @@ smallvec = "1" static_assertions = "1.1.0" thiserror = "1" wgpu = { version = "0.16", path = "./wgpu" } +wgpu-example = { version = "0.16", path = "./examples/common" } +wgpu-test = { version = "0.16", path = "./tests"} winit = "0.27.1" # Metal dependencies diff --git a/wgpu/examples/README.md b/examples/README.md similarity index 100% rename from wgpu/examples/README.md rename to examples/README.md diff --git a/examples/boids/Cargo.toml b/examples/boids/Cargo.toml new file mode 100644 index 000000000..933acd64e --- /dev/null +++ b/examples/boids/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "wgpu-boids-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu boids example" +publish = false + +[[bin]] +name = "boids" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +nanorand.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/boids/README.md b/examples/boids/README.md similarity index 100% rename from wgpu/examples/boids/README.md rename to examples/boids/README.md diff --git a/wgpu/examples/boids/screenshot.png b/examples/boids/screenshot.png similarity index 100% rename from wgpu/examples/boids/screenshot.png rename to examples/boids/screenshot.png diff --git a/wgpu/examples/boids/compute.wgsl b/examples/boids/src/compute.wgsl similarity index 100% rename from wgpu/examples/boids/compute.wgsl rename to examples/boids/src/compute.wgsl diff --git a/wgpu/examples/boids/draw.wgsl b/examples/boids/src/draw.wgsl similarity index 100% rename from wgpu/examples/boids/draw.wgsl rename to examples/boids/src/draw.wgsl diff --git a/wgpu/examples/boids/main.rs b/examples/boids/src/main.rs similarity index 96% rename from wgpu/examples/boids/main.rs rename to examples/boids/src/main.rs index 80d28dc3e..9fca8e7e2 100644 --- a/wgpu/examples/boids/main.rs +++ b/examples/boids/src/main.rs @@ -5,9 +5,6 @@ use nanorand::{Rng, WyRand}; use std::{borrow::Cow, mem}; use wgpu::util::DeviceExt; -#[path = "../framework.rs"] -mod framework; - // number of boid particles to simulate const NUM_PARTICLES: u32 = 1500; @@ -27,7 +24,7 @@ struct Example { frame_num: usize, } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn required_limits() -> wgpu::Limits { wgpu::Limits::downlevel_defaults() } @@ -269,7 +266,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { // create render pass descriptor and its color attachments let color_attachments = [Some(wgpu::RenderPassColorAttachment { @@ -326,7 +323,7 @@ impl framework::Example for Example { /// run example fn main() { - framework::run::("boids"); + wgpu_example::framework::run::("boids"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -334,15 +331,15 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn boids() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { // Generated on 1080ti on Vk/Windows - image_path: "/examples/boids/screenshot.png", + image_path: "examples/boids/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default() + base_test_parameters: wgpu_test::TestParameters::default() .downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS) .limits(wgpu::Limits::downlevel_defaults()), - comparisons: &[framework::ComparisonType::Mean(0.005)], + comparisons: &[wgpu_test::ComparisonType::Mean(0.005)], }); } diff --git a/examples/bunnymark/Cargo.toml b/examples/bunnymark/Cargo.toml new file mode 100644 index 000000000..43e0be0d6 --- /dev/null +++ b/examples/bunnymark/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "wgpu-bunnymark-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu bunnymark example" +publish = false + +[[bin]] +name = "bunnymark" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +nanorand.workspace = true +glam.workspace = true +png.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/bunnymark/screenshot.png b/examples/bunnymark/screenshot.png similarity index 100% rename from wgpu/examples/bunnymark/screenshot.png rename to examples/bunnymark/screenshot.png diff --git a/wgpu/examples/bunnymark/main.rs b/examples/bunnymark/src/main.rs similarity index 96% rename from wgpu/examples/bunnymark/main.rs rename to examples/bunnymark/src/main.rs index a4553f663..9322131f0 100644 --- a/wgpu/examples/bunnymark/main.rs +++ b/examples/bunnymark/src/main.rs @@ -3,9 +3,6 @@ use nanorand::{Rng, WyRand}; use std::{borrow::Cow, mem}; use wgpu::util::DeviceExt; -#[path = "../framework.rs"] -mod framework; - const MAX_BUNNIES: usize = 1 << 20; const BUNNY_SIZE: f32 = 0.15 * 256.0; const GRAVITY: f32 = -9.8 * 100.0; @@ -39,7 +36,7 @@ struct Example { rng: WyRand, } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn init( config: &wgpu::SurfaceConfiguration, _adapter: &wgpu::Adapter, @@ -294,7 +291,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { let delta = 0.01; for bunny in self.bunnies.iter_mut() { @@ -355,7 +352,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("bunnymark"); + wgpu_example::framework::run::("bunnymark"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -363,16 +360,16 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn bunnymark() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/bunnymark/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default(), + base_test_parameters: wgpu_test::TestParameters::default(), // We're looking for very small differences, so look in the high percentiles. comparisons: &[ - framework::ComparisonType::Mean(0.05), - framework::ComparisonType::Percentile { + wgpu_test::ComparisonType::Mean(0.05), + wgpu_test::ComparisonType::Percentile { percentile: 0.95, threshold: 0.05, }, diff --git a/examples/capture/Cargo.toml b/examples/capture/Cargo.toml new file mode 100644 index 000000000..87c9b6c38 --- /dev/null +++ b/examples/capture/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "wgpu-capture-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu capture example" +publish = false + +[[bin]] +name = "capture" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +env_logger.workspace = true +futures-intrusive.workspace = true +pollster.workspace = true +png.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook.workspace = true +console_log.workspace = true +wasm-bindgen-futures.workspace = true + diff --git a/wgpu/examples/capture/README.md b/examples/capture/README.md similarity index 100% rename from wgpu/examples/capture/README.md rename to examples/capture/README.md diff --git a/wgpu/examples/capture/screenshot.png b/examples/capture/screenshot.png similarity index 100% rename from wgpu/examples/capture/screenshot.png rename to examples/capture/screenshot.png diff --git a/wgpu/examples/capture/main.rs b/examples/capture/src/main.rs similarity index 96% rename from wgpu/examples/capture/main.rs rename to examples/capture/src/main.rs index 252777355..d36c3033e 100644 --- a/wgpu/examples/capture/main.rs +++ b/examples/capture/src/main.rs @@ -229,17 +229,18 @@ mod tests { wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] - #[wasm_bindgen_test::wasm_bindgen_test] + // This test never creates a canvas, so will always fail on webgl2. + // #[wasm_bindgen_test::wasm_bindgen_test] fn ensure_generated_data_matches_expected() { assert_generated_data_matches_expected(); } fn assert_generated_data_matches_expected() { - let (device, output_buffer, dimensions) = - create_red_image_with_dimensions(100usize, 200usize).await; + let (device, output_buffer, dimensions, submission_index) = + pollster::block_on(create_red_image_with_dimensions(100usize, 200usize)); let buffer_slice = output_buffer.slice(..); buffer_slice.map_async(wgpu::MapMode::Read, |_| ()); - device.poll(wgpu::Maintain::Wait); + device.poll(wgpu::Maintain::WaitForSubmissionIndex(submission_index)); let padded_buffer = buffer_slice.get_mapped_range(); let expected_buffer_size = dimensions.padded_bytes_per_row * dimensions.height; assert_eq!(padded_buffer.len(), expected_buffer_size); diff --git a/examples/common/Cargo.toml b/examples/common/Cargo.toml new file mode 100644 index 000000000..f9dd5d32e --- /dev/null +++ b/examples/common/Cargo.toml @@ -0,0 +1,42 @@ +[package] +name = "wgpu-example" +version.workspace = true +authors.workspace = true +edition.workspace = true +description = "Common example code" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true +publish = false + +[dependencies] +env_logger.workspace = true +log.workspace = true +pollster.workspace = true +png.workspace = true +winit.workspace = true +wgpu.workspace = true +wgpu-test.workspace = true + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +async-executor.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook.workspace = true +console_log.workspace = true +js-sys.workspace = true +wasm-bindgen.workspace = true +wasm-bindgen-futures.workspace = true +hal = { workspace = true, optional = true } +# We need these features in the framework examples and tests +web-sys = { workspace = true, features = [ + "Location", + "Blob", + "RequestInit", + "RequestMode", + "Request", + "Response", + "WebGl2RenderingContext", + "CanvasRenderingContext2d" +] } diff --git a/wgpu/examples/framework.rs b/examples/common/src/framework.rs similarity index 98% rename from wgpu/examples/framework.rs rename to examples/common/src/framework.rs index cd5e07820..27b76bf86 100644 --- a/wgpu/examples/framework.rs +++ b/examples/common/src/framework.rs @@ -10,10 +10,6 @@ use winit::{ event_loop::{ControlFlow, EventLoop}, }; -#[cfg(test)] -#[path = "../tests/common/mod.rs"] -pub mod test_common; - #[allow(dead_code)] pub fn cast_slice(data: &[T]) -> &[u8] { use std::{mem::size_of, slice::from_raw_parts}; @@ -494,21 +490,19 @@ pub fn parse_url_query_string<'a>(query: &'a str, search_key: &str) -> Option<&' None } -#[cfg(test)] -pub use test_common::image::ComparisonType; +pub use wgpu_test::image::ComparisonType; -#[cfg(test)] pub struct FrameworkRefTest { + // Path to the reference image, relative to the root of the repo. pub image_path: &'static str, pub width: u32, pub height: u32, pub optional_features: wgpu::Features, - pub base_test_parameters: test_common::TestParameters, + pub base_test_parameters: wgpu_test::TestParameters, /// Comparisons against FLIP statistics that determine if the test passes or fails. pub comparisons: &'static [ComparisonType], } -#[cfg(test)] #[allow(dead_code)] pub fn test(mut params: FrameworkRefTest) { use std::mem; @@ -517,7 +511,7 @@ pub fn test(mut params: FrameworkRefTest) { let features = E::required_features() | params.optional_features; - test_common::initialize_test( + wgpu_test::initialize_test( mem::take(&mut params.base_test_parameters).features(features), |ctx| { let spawner = Spawner::new(); @@ -617,8 +611,8 @@ pub fn test(mut params: FrameworkRefTest) { ctx.device.poll(wgpu::Maintain::Wait); let bytes = dst_buffer_slice.get_mapped_range().to_vec(); - test_common::image::compare_image_output( - env!("CARGO_MANIFEST_DIR").to_string() + params.image_path, + wgpu_test::image::compare_image_output( + env!("CARGO_MANIFEST_DIR").to_string() + "/../../" + params.image_path, ctx.adapter_info.backend, params.width, params.height, diff --git a/examples/common/src/lib.rs b/examples/common/src/lib.rs new file mode 100644 index 000000000..0c717499e --- /dev/null +++ b/examples/common/src/lib.rs @@ -0,0 +1 @@ +pub mod framework; diff --git a/examples/conservative-raster/Cargo.toml b/examples/conservative-raster/Cargo.toml new file mode 100644 index 000000000..1b4de4839 --- /dev/null +++ b/examples/conservative-raster/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "wgpu-conservative-raster-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu conservative raster example" +publish = false + +[[bin]] +name = "conservative-raster" +path = "src/main.rs" + +[dependencies] +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/conservative-raster/README.md b/examples/conservative-raster/README.md similarity index 100% rename from wgpu/examples/conservative-raster/README.md rename to examples/conservative-raster/README.md diff --git a/wgpu/examples/conservative-raster/screenshot.png b/examples/conservative-raster/screenshot.png similarity index 100% rename from wgpu/examples/conservative-raster/screenshot.png rename to examples/conservative-raster/screenshot.png diff --git a/wgpu/examples/conservative-raster/main.rs b/examples/conservative-raster/src/main.rs similarity index 96% rename from wgpu/examples/conservative-raster/main.rs rename to examples/conservative-raster/src/main.rs index 9ed305b3c..1dba59959 100644 --- a/wgpu/examples/conservative-raster/main.rs +++ b/examples/conservative-raster/src/main.rs @@ -1,6 +1,3 @@ -#[path = "../framework.rs"] -mod framework; - use std::borrow::Cow; const RENDER_TARGET_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8UnormSrgb; @@ -66,7 +63,7 @@ impl Example { } } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn required_features() -> wgpu::Features { wgpu::Features::CONSERVATIVE_RASTERIZATION } @@ -258,7 +255,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: Some("primary"), @@ -312,7 +309,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("conservative-raster"); + wgpu_example::framework::run::("conservative-raster"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -320,12 +317,12 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn conservative_raster() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/conservative-raster/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default(), - comparisons: &[framework::ComparisonType::Mean(0.0)], + base_test_parameters: wgpu_test::TestParameters::default(), + comparisons: &[wgpu_test::ComparisonType::Mean(0.0)], }); } diff --git a/wgpu/examples/conservative-raster/triangle_and_lines.wgsl b/examples/conservative-raster/src/triangle_and_lines.wgsl similarity index 100% rename from wgpu/examples/conservative-raster/triangle_and_lines.wgsl rename to examples/conservative-raster/src/triangle_and_lines.wgsl diff --git a/wgpu/examples/conservative-raster/upscale.wgsl b/examples/conservative-raster/src/upscale.wgsl similarity index 100% rename from wgpu/examples/conservative-raster/upscale.wgsl rename to examples/conservative-raster/src/upscale.wgsl diff --git a/examples/cube/Cargo.toml b/examples/cube/Cargo.toml new file mode 100644 index 000000000..697aa240e --- /dev/null +++ b/examples/cube/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "wgpu-cube-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu cube example" +publish = false + +[[bin]] +name = "cube" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +glam.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/cube/README.md b/examples/cube/README.md similarity index 100% rename from wgpu/examples/cube/README.md rename to examples/cube/README.md diff --git a/wgpu/examples/cube/screenshot-lines.png b/examples/cube/screenshot-lines.png similarity index 100% rename from wgpu/examples/cube/screenshot-lines.png rename to examples/cube/screenshot-lines.png diff --git a/wgpu/examples/cube/screenshot.png b/examples/cube/screenshot.png similarity index 100% rename from wgpu/examples/cube/screenshot.png rename to examples/cube/screenshot.png diff --git a/wgpu/examples/cube/main.rs b/examples/cube/src/main.rs similarity index 94% rename from wgpu/examples/cube/main.rs rename to examples/cube/src/main.rs index 61e901988..271bc17ce 100644 --- a/wgpu/examples/cube/main.rs +++ b/examples/cube/src/main.rs @@ -1,6 +1,3 @@ -#[path = "../framework.rs"] -mod framework; - use bytemuck::{Pod, Zeroable}; use std::{borrow::Cow, f32::consts, future::Future, mem, pin::Pin, task}; use wgpu::util::DeviceExt; @@ -127,9 +124,9 @@ impl Example { } } -impl framework::Example for Example { - fn optional_features() -> wgt::Features { - wgt::Features::POLYGON_MODE_LINE +impl wgpu_example::framework::Example for Example { + fn optional_features() -> wgpu::Features { + wgpu::Features::POLYGON_MODE_LINE } fn init( @@ -285,7 +282,10 @@ impl framework::Example for Example { multiview: None, }); - let pipeline_wire = if device.features().contains(wgt::Features::POLYGON_MODE_LINE) { + let pipeline_wire = if device + .features() + .contains(wgpu::Features::POLYGON_MODE_LINE) + { let pipeline_wire = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { label: None, layout: Some(&pipeline_layout), @@ -357,7 +357,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - spawner: &framework::Spawner, + spawner: &wgpu_example::framework::Spawner, ) { device.push_error_scope(wgpu::ErrorFilter::Validation); let mut encoder = @@ -404,7 +404,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("cube"); + wgpu_example::framework::run::("cube"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -412,15 +412,15 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn cube() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { // Generated on 1080ti on Vk/Windows image_path: "/examples/cube/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default(), + base_test_parameters: wgpu_test::TestParameters::default(), comparisons: &[ - framework::ComparisonType::Mean(0.04), // Bounded by Intel 630 on Vk/Windows + wgpu_test::ComparisonType::Mean(0.04), // Bounded by Intel 630 on Vk/Windows ], }); } @@ -428,17 +428,17 @@ fn cube() { #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn cube_lines() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { // Generated on 1080ti on Vk/Windows image_path: "/examples/cube/screenshot-lines.png", width: 1024, height: 768, optional_features: wgpu::Features::POLYGON_MODE_LINE, - base_test_parameters: framework::test_common::TestParameters::default(), + base_test_parameters: wgpu_test::TestParameters::default(), // We're looking for tiny changes here, so we focus on a spike in the 95th percentile. comparisons: &[ - framework::ComparisonType::Mean(0.05), // Bounded by Intel 630 on Vk/Windows - framework::ComparisonType::Percentile { + wgpu_test::ComparisonType::Mean(0.05), // Bounded by Intel 630 on Vk/Windows + wgpu_test::ComparisonType::Percentile { percentile: 0.95, threshold: 0.36, }, // Bounded by 1080ti on DX12 diff --git a/wgpu/examples/cube/shader.wgsl b/examples/cube/src/shader.wgsl similarity index 100% rename from wgpu/examples/cube/shader.wgsl rename to examples/cube/src/shader.wgsl diff --git a/examples/hello-compute/Cargo.toml b/examples/hello-compute/Cargo.toml new file mode 100644 index 000000000..af5b29d73 --- /dev/null +++ b/examples/hello-compute/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "wgpu-hello-compute-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu hello compute example" +publish = false + +[[bin]] +name = "hello-compute" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +env_logger.workspace = true +futures-intrusive.workspace = true +pollster.workspace = true +wgpu.workspace = true +winit.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook.workspace = true +console_log.workspace = true +log.workspace = true +wasm-bindgen-futures.workspace = true + +[dev-dependencies] +wasm-bindgen-test.workspace = true +wgpu-test.workspace = true + diff --git a/wgpu/examples/hello-compute/README.md b/examples/hello-compute/README.md similarity index 100% rename from wgpu/examples/hello-compute/README.md rename to examples/hello-compute/README.md diff --git a/wgpu/examples/hello-compute/main.rs b/examples/hello-compute/src/main.rs similarity index 100% rename from wgpu/examples/hello-compute/main.rs rename to examples/hello-compute/src/main.rs diff --git a/wgpu/examples/hello-compute/shader.wgsl b/examples/hello-compute/src/shader.wgsl similarity index 100% rename from wgpu/examples/hello-compute/shader.wgsl rename to examples/hello-compute/src/shader.wgsl diff --git a/wgpu/examples/hello-compute/tests.rs b/examples/hello-compute/src/tests.rs similarity index 97% rename from wgpu/examples/hello-compute/tests.rs rename to examples/hello-compute/src/tests.rs index 52e62d1c8..c67f2ca8f 100644 --- a/wgpu/examples/hello-compute/tests.rs +++ b/examples/hello-compute/src/tests.rs @@ -1,10 +1,7 @@ -#[path = "../../tests/common/mod.rs"] -mod common; - use std::sync::Arc; use super::*; -use common::{initialize_test, TestParameters}; +use wgpu_test::{initialize_test, TestParameters}; wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); diff --git a/examples/hello-triangle/Cargo.toml b/examples/hello-triangle/Cargo.toml new file mode 100644 index 000000000..1c0d6b9a3 --- /dev/null +++ b/examples/hello-triangle/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "wgpu-hello-triangle-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu hello triangle example" +publish = false + +[[bin]] +name = "hello-triangle" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +env_logger.workspace = true +pollster.workspace = true +wgpu.workspace = true +winit.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook.workspace = true +console_log.workspace = true +wasm-bindgen-futures.workspace = true +web-sys.workspace = true diff --git a/wgpu/examples/hello-triangle/README.md b/examples/hello-triangle/README.md similarity index 100% rename from wgpu/examples/hello-triangle/README.md rename to examples/hello-triangle/README.md diff --git a/wgpu/examples/hello-triangle/screenshot.png b/examples/hello-triangle/screenshot.png similarity index 100% rename from wgpu/examples/hello-triangle/screenshot.png rename to examples/hello-triangle/screenshot.png diff --git a/wgpu/examples/hello-triangle/main.rs b/examples/hello-triangle/src/main.rs similarity index 100% rename from wgpu/examples/hello-triangle/main.rs rename to examples/hello-triangle/src/main.rs diff --git a/wgpu/examples/hello-triangle/shader.wgsl b/examples/hello-triangle/src/shader.wgsl similarity index 100% rename from wgpu/examples/hello-triangle/shader.wgsl rename to examples/hello-triangle/src/shader.wgsl diff --git a/examples/hello-windows/Cargo.toml b/examples/hello-windows/Cargo.toml new file mode 100644 index 000000000..966197f5b --- /dev/null +++ b/examples/hello-windows/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "wgpu-hello-windows-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu hello windows example" +publish = false + +[[bin]] +name = "hello-windows" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +env_logger.workspace = true +pollster.workspace = true +wgpu.workspace = true +winit.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook.workspace = true diff --git a/wgpu/examples/hello-windows/README.md b/examples/hello-windows/README.md similarity index 100% rename from wgpu/examples/hello-windows/README.md rename to examples/hello-windows/README.md diff --git a/wgpu/examples/hello-windows/screenshot.png b/examples/hello-windows/screenshot.png similarity index 100% rename from wgpu/examples/hello-windows/screenshot.png rename to examples/hello-windows/screenshot.png diff --git a/wgpu/examples/hello-windows/main.rs b/examples/hello-windows/src/main.rs similarity index 100% rename from wgpu/examples/hello-windows/main.rs rename to examples/hello-windows/src/main.rs diff --git a/examples/hello/Cargo.toml b/examples/hello/Cargo.toml new file mode 100644 index 000000000..54b145c26 --- /dev/null +++ b/examples/hello/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "wgpu-hello-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu hello example" +publish = false + +[[bin]] +name = "hello" +path = "src/main.rs" + +[dependencies] +env_logger.workspace = true +glam.workspace = true +log.workspace = true +pollster.workspace = true +wgpu.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook.workspace = true +console_log.workspace = true +wasm-bindgen-futures.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true + diff --git a/wgpu/examples/hello/README.md b/examples/hello/README.md similarity index 100% rename from wgpu/examples/hello/README.md rename to examples/hello/README.md diff --git a/wgpu/examples/hello/main.rs b/examples/hello/src/main.rs similarity index 100% rename from wgpu/examples/hello/main.rs rename to examples/hello/src/main.rs diff --git a/examples/mipmap/Cargo.toml b/examples/mipmap/Cargo.toml new file mode 100644 index 000000000..ab117e409 --- /dev/null +++ b/examples/mipmap/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "wgpu-mipmap-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu mipmap example" +publish = false + +[[bin]] +name = "mipmap" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +glam.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/mipmap/README.md b/examples/mipmap/README.md similarity index 100% rename from wgpu/examples/mipmap/README.md rename to examples/mipmap/README.md diff --git a/wgpu/examples/mipmap/screenshot.png b/examples/mipmap/screenshot.png similarity index 100% rename from wgpu/examples/mipmap/screenshot.png rename to examples/mipmap/screenshot.png diff --git a/wgpu/examples/mipmap/blit.wgsl b/examples/mipmap/src/blit.wgsl similarity index 100% rename from wgpu/examples/mipmap/blit.wgsl rename to examples/mipmap/src/blit.wgsl diff --git a/wgpu/examples/mipmap/draw.wgsl b/examples/mipmap/src/draw.wgsl similarity index 100% rename from wgpu/examples/mipmap/draw.wgsl rename to examples/mipmap/src/draw.wgsl diff --git a/wgpu/examples/mipmap/main.rs b/examples/mipmap/src/main.rs similarity index 98% rename from wgpu/examples/mipmap/main.rs rename to examples/mipmap/src/main.rs index c30473a47..25e1890d9 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/examples/mipmap/src/main.rs @@ -1,6 +1,3 @@ -#[path = "../framework.rs"] -mod framework; - use bytemuck::{Pod, Zeroable}; use std::{borrow::Cow, f32::consts, mem}; use wgpu::util::DeviceExt; @@ -198,7 +195,7 @@ impl Example { } } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn optional_features() -> wgpu::Features { wgpu::Features::TIMESTAMP_QUERY | wgpu::Features::PIPELINE_STATISTICS_QUERY @@ -452,7 +449,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); @@ -485,7 +482,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("mipmap"); + wgpu_example::framework::run::("mipmap"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -493,13 +490,13 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn mipmap() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/mipmap/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default() + base_test_parameters: wgpu_test::TestParameters::default() .backend_failure(wgpu::Backends::GL), - comparisons: &[framework::ComparisonType::Mean(0.02)], + comparisons: &[wgpu_test::ComparisonType::Mean(0.02)], }); } diff --git a/examples/msaa-line/Cargo.toml b/examples/msaa-line/Cargo.toml new file mode 100644 index 000000000..c84d2676c --- /dev/null +++ b/examples/msaa-line/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "wgpu-msaa-line-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu msaa line example" +publish = false + +[[bin]] +name = "msaa-line" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +glam.workspace = true +log.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true + diff --git a/wgpu/examples/msaa-line/README.md b/examples/msaa-line/README.md similarity index 100% rename from wgpu/examples/msaa-line/README.md rename to examples/msaa-line/README.md diff --git a/wgpu/examples/msaa-line/screenshot.png b/examples/msaa-line/screenshot.png similarity index 100% rename from wgpu/examples/msaa-line/screenshot.png rename to examples/msaa-line/screenshot.png diff --git a/wgpu/examples/msaa-line/main.rs b/examples/msaa-line/src/main.rs similarity index 94% rename from wgpu/examples/msaa-line/main.rs rename to examples/msaa-line/src/main.rs index b5321ea8c..c7f69b633 100644 --- a/wgpu/examples/msaa-line/main.rs +++ b/examples/msaa-line/src/main.rs @@ -7,9 +7,6 @@ //! * Set the primitive_topology to PrimitiveTopology::LineList. //! * Vertices and Indices describe the two points that make up a line. -#[path = "../framework.rs"] -mod framework; - use std::{borrow::Cow, iter}; use bytemuck::{Pod, Zeroable}; @@ -118,9 +115,9 @@ impl Example { } } -impl framework::Example for Example { - fn optional_features() -> wgt::Features { - wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES +impl wgpu_example::framework::Example for Example { + fn optional_features() -> wgpu::Features { + wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES } fn init( @@ -256,7 +253,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { if self.rebuild_bundle { self.bundle = Example::create_bundle( @@ -312,7 +309,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("msaa-line"); + wgpu_example::framework::run::("msaa-line"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -320,19 +317,19 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn msaa_line() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/msaa-line/screenshot.png", width: 1024, height: 768, - optional_features: wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES, - base_test_parameters: framework::test_common::TestParameters::default() + optional_features: wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES, + base_test_parameters: wgpu_test::TestParameters::default() // AMD seems to render nothing on DX12 https://github.com/gfx-rs/wgpu/issues/3838 .specific_failure(Some(wgpu::Backends::DX12), Some(0x1002), None, false), // There's a lot of natural variance so we check the weighted median too to differentiate // real failures from variance. comparisons: &[ - framework::ComparisonType::Mean(0.065), - framework::ComparisonType::Percentile { + wgpu_test::ComparisonType::Mean(0.065), + wgpu_test::ComparisonType::Percentile { percentile: 0.5, threshold: 0.29, }, diff --git a/wgpu/examples/msaa-line/shader.wgsl b/examples/msaa-line/src/shader.wgsl similarity index 100% rename from wgpu/examples/msaa-line/shader.wgsl rename to examples/msaa-line/src/shader.wgsl diff --git a/examples/shadow/Cargo.toml b/examples/shadow/Cargo.toml new file mode 100644 index 000000000..0f7847a88 --- /dev/null +++ b/examples/shadow/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "wgpu-shadow-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu shadow example" +publish = false + +[[bin]] +name = "shadow" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +glam.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true + diff --git a/wgpu/examples/shadow/README.md b/examples/shadow/README.md similarity index 100% rename from wgpu/examples/shadow/README.md rename to examples/shadow/README.md diff --git a/wgpu/examples/shadow/screenshot.png b/examples/shadow/screenshot.png similarity index 100% rename from wgpu/examples/shadow/screenshot.png rename to examples/shadow/screenshot.png diff --git a/wgpu/examples/shadow/main.rs b/examples/shadow/src/main.rs similarity index 98% rename from wgpu/examples/shadow/main.rs rename to examples/shadow/src/main.rs index 7c6f5017a..461b04d17 100644 --- a/wgpu/examples/shadow/main.rs +++ b/examples/shadow/src/main.rs @@ -1,8 +1,5 @@ use std::{borrow::Cow, f32::consts, iter, mem, ops::Range, rc::Rc}; -#[path = "../framework.rs"] -mod framework; - use bytemuck::{Pod, Zeroable}; use wgpu::util::{align_to, DeviceExt}; @@ -204,7 +201,7 @@ impl Example { } } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn optional_features() -> wgpu::Features { wgpu::Features::DEPTH_CLIP_CONTROL } @@ -711,7 +708,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { // update uniforms for entity in self.entities.iter_mut() { @@ -840,7 +837,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("shadow"); + wgpu_example::framework::run::("shadow"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -848,17 +845,17 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn shadow() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/shadow/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default() + base_test_parameters: wgpu_test::TestParameters::default() .downlevel_flags(wgpu::DownlevelFlags::COMPARISON_SAMPLERS) // rpi4 on VK doesn't work: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3916 .specific_failure(Some(wgpu::Backends::VULKAN), None, Some("V3D"), false) // llvmpipe versions in CI are flaky: https://github.com/gfx-rs/wgpu/issues/2594 .specific_failure(Some(wgpu::Backends::VULKAN), None, Some("llvmpipe"), true), - comparisons: &[framework::ComparisonType::Mean(0.02)], + comparisons: &[wgpu_test::ComparisonType::Mean(0.02)], }); } diff --git a/wgpu/examples/shadow/shader.wgsl b/examples/shadow/src/shader.wgsl similarity index 100% rename from wgpu/examples/shadow/shader.wgsl rename to examples/shadow/src/shader.wgsl diff --git a/examples/skybox/Cargo.toml b/examples/skybox/Cargo.toml new file mode 100644 index 000000000..f70e78e9b --- /dev/null +++ b/examples/skybox/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "wgpu-skybox-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu skybox example" +publish = false + +[[bin]] +name = "skybox" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +ddsfile.workspace = true +glam.workspace = true +obj.workspace = true +log.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true \ No newline at end of file diff --git a/wgpu/examples/skybox/README.md b/examples/skybox/README.md similarity index 100% rename from wgpu/examples/skybox/README.md rename to examples/skybox/README.md diff --git a/wgpu/examples/skybox/images/astc.dds b/examples/skybox/images/astc.dds similarity index 100% rename from wgpu/examples/skybox/images/astc.dds rename to examples/skybox/images/astc.dds diff --git a/wgpu/examples/skybox/images/bc1.dds b/examples/skybox/images/bc1.dds similarity index 100% rename from wgpu/examples/skybox/images/bc1.dds rename to examples/skybox/images/bc1.dds diff --git a/wgpu/examples/skybox/images/bgra.dds b/examples/skybox/images/bgra.dds similarity index 100% rename from wgpu/examples/skybox/images/bgra.dds rename to examples/skybox/images/bgra.dds diff --git a/wgpu/examples/skybox/images/etc2.dds b/examples/skybox/images/etc2.dds similarity index 100% rename from wgpu/examples/skybox/images/etc2.dds rename to examples/skybox/images/etc2.dds diff --git a/wgpu/examples/skybox/models/teslacyberv3.0.mtl b/examples/skybox/models/teslacyberv3.0.mtl similarity index 100% rename from wgpu/examples/skybox/models/teslacyberv3.0.mtl rename to examples/skybox/models/teslacyberv3.0.mtl diff --git a/wgpu/examples/skybox/models/teslacyberv3.0.obj b/examples/skybox/models/teslacyberv3.0.obj similarity index 100% rename from wgpu/examples/skybox/models/teslacyberv3.0.obj rename to examples/skybox/models/teslacyberv3.0.obj diff --git a/wgpu/examples/skybox/screenshot-astc.png b/examples/skybox/screenshot-astc.png similarity index 100% rename from wgpu/examples/skybox/screenshot-astc.png rename to examples/skybox/screenshot-astc.png diff --git a/wgpu/examples/skybox/screenshot-bc1.png b/examples/skybox/screenshot-bc1.png similarity index 100% rename from wgpu/examples/skybox/screenshot-bc1.png rename to examples/skybox/screenshot-bc1.png diff --git a/wgpu/examples/skybox/screenshot-etc2.png b/examples/skybox/screenshot-etc2.png similarity index 100% rename from wgpu/examples/skybox/screenshot-etc2.png rename to examples/skybox/screenshot-etc2.png diff --git a/wgpu/examples/skybox/screenshot.png b/examples/skybox/screenshot.png similarity index 100% rename from wgpu/examples/skybox/screenshot.png rename to examples/skybox/screenshot.png diff --git a/wgpu/examples/skybox/main.rs b/examples/skybox/src/main.rs similarity index 92% rename from wgpu/examples/skybox/main.rs rename to examples/skybox/src/main.rs index 6b0637643..bfb5c1052 100644 --- a/wgpu/examples/skybox/main.rs +++ b/examples/skybox/src/main.rs @@ -1,6 +1,3 @@ -#[path = "../framework.rs"] -mod framework; - use bytemuck::{Pod, Zeroable}; use std::{borrow::Cow, f32::consts}; use wgpu::{util::DeviceExt, AstcBlock, AstcChannel}; @@ -92,7 +89,7 @@ impl Skybox { } } -impl framework::Example for Skybox { +impl wgpu_example::framework::Example for Skybox { fn optional_features() -> wgpu::Features { wgpu::Features::TEXTURE_COMPRESSION_ASTC | wgpu::Features::TEXTURE_COMPRESSION_ETC2 @@ -107,7 +104,7 @@ impl framework::Example for Skybox { ) -> Self { let mut entities = Vec::new(); { - let source = include_bytes!("models/teslacyberv3.0.obj"); + let source = include_bytes!("../models/teslacyberv3.0.obj"); let data = obj::ObjData::load_buf(&source[..]).unwrap(); let mut vertices = Vec::new(); for object in data.objects { @@ -309,10 +306,10 @@ impl framework::Example for Skybox { wgpu::TextureFormat::Astc { block: AstcBlock::B4x4, channel: AstcChannel::UnormSrgb, - } => &include_bytes!("images/astc.dds")[..], - wgpu::TextureFormat::Etc2Rgb8UnormSrgb => &include_bytes!("images/etc2.dds")[..], - wgpu::TextureFormat::Bc1RgbaUnormSrgb => &include_bytes!("images/bc1.dds")[..], - wgpu::TextureFormat::Bgra8UnormSrgb => &include_bytes!("images/bgra.dds")[..], + } => &include_bytes!("../images/astc.dds")[..], + wgpu::TextureFormat::Etc2Rgb8UnormSrgb => &include_bytes!("../images/etc2.dds")[..], + wgpu::TextureFormat::Bc1RgbaUnormSrgb => &include_bytes!("../images/bc1.dds")[..], + wgpu::TextureFormat::Bgra8UnormSrgb => &include_bytes!("../images/bgra.dds")[..], _ => unreachable!(), }; @@ -399,7 +396,7 @@ impl framework::Example for Skybox { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); @@ -463,7 +460,7 @@ impl framework::Example for Skybox { } fn main() { - framework::run::("skybox"); + wgpu_example::framework::run::("skybox"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -471,56 +468,56 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn skybox() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/skybox/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default().specific_failure( + base_test_parameters: wgpu_test::TestParameters::default().specific_failure( Some(wgpu::Backends::GL), None, Some("ANGLE"), false, ), - comparisons: &[framework::ComparisonType::Mean(0.015)], + comparisons: &[wgpu_test::ComparisonType::Mean(0.015)], }); } #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn skybox_bc1() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/skybox/screenshot-bc1.png", width: 1024, height: 768, 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 - comparisons: &[framework::ComparisonType::Mean(0.02)], + base_test_parameters: wgpu_test::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056 + comparisons: &[wgpu_test::ComparisonType::Mean(0.02)], }); } #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn skybox_etc2() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/skybox/screenshot-etc2.png", width: 1024, height: 768, 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 - comparisons: &[framework::ComparisonType::Mean(0.015)], + base_test_parameters: wgpu_test::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056 + comparisons: &[wgpu_test::ComparisonType::Mean(0.015)], }); } #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn skybox_astc() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/skybox/screenshot-astc.png", width: 1024, height: 768, optional_features: wgpu::Features::TEXTURE_COMPRESSION_ASTC, - base_test_parameters: framework::test_common::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056 - comparisons: &[framework::ComparisonType::Mean(0.016)], + base_test_parameters: wgpu_test::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056 + comparisons: &[wgpu_test::ComparisonType::Mean(0.016)], }); } diff --git a/wgpu/examples/skybox/shader.wgsl b/examples/skybox/src/shader.wgsl similarity index 100% rename from wgpu/examples/skybox/shader.wgsl rename to examples/skybox/src/shader.wgsl diff --git a/examples/stencil-triangles/Cargo.toml b/examples/stencil-triangles/Cargo.toml new file mode 100644 index 000000000..cd8e42676 --- /dev/null +++ b/examples/stencil-triangles/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "wgpu-stencil-triangle-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu stencil triangles example" +publish = false + +[[bin]] +name = "stencil-triangles" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/stencil-triangles/README.md b/examples/stencil-triangles/README.md similarity index 100% rename from wgpu/examples/stencil-triangles/README.md rename to examples/stencil-triangles/README.md diff --git a/wgpu/examples/stencil-triangles/screenshot.png b/examples/stencil-triangles/screenshot.png similarity index 100% rename from wgpu/examples/stencil-triangles/screenshot.png rename to examples/stencil-triangles/screenshot.png diff --git a/wgpu/examples/stencil-triangles/main.rs b/examples/stencil-triangles/src/main.rs similarity index 95% rename from wgpu/examples/stencil-triangles/main.rs rename to examples/stencil-triangles/src/main.rs index 5ad46c6ac..1499f9ab7 100644 --- a/wgpu/examples/stencil-triangles/main.rs +++ b/examples/stencil-triangles/src/main.rs @@ -3,9 +3,6 @@ use std::borrow::Cow; use std::mem; use wgpu::util::DeviceExt; -#[path = "../framework.rs"] -mod framework; - #[repr(C)] #[derive(Clone, Copy, Pod, Zeroable)] struct Vertex { @@ -26,7 +23,7 @@ struct Triangles { stencil_buffer: wgpu::Texture, } -impl framework::Example for Triangles { +impl wgpu_example::framework::Example for Triangles { fn init( config: &wgpu::SurfaceConfiguration, _adapter: &wgpu::Adapter, @@ -185,7 +182,7 @@ impl framework::Example for Triangles { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); @@ -232,7 +229,7 @@ impl framework::Example for Triangles { } fn main() { - framework::run::("stencil-triangles"); + wgpu_example::framework::run::("stencil-triangles"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -240,12 +237,12 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn stencil_triangles() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/stencil-triangles/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default(), - comparisons: &[framework::ComparisonType::Mean(0.03)], + base_test_parameters: wgpu_test::TestParameters::default(), + comparisons: &[wgpu_test::ComparisonType::Mean(0.03)], }); } diff --git a/wgpu/examples/stencil-triangles/shader.wgsl b/examples/stencil-triangles/src/shader.wgsl similarity index 100% rename from wgpu/examples/stencil-triangles/shader.wgsl rename to examples/stencil-triangles/src/shader.wgsl diff --git a/examples/texture-arrays/Cargo.toml b/examples/texture-arrays/Cargo.toml new file mode 100644 index 000000000..af30e9305 --- /dev/null +++ b/examples/texture-arrays/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "wgpu-texture-arrays-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu texture arrays example" +publish = false + +[[bin]] +name = "texture-arrays" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/texture-arrays/screenshot.png b/examples/texture-arrays/screenshot.png similarity index 100% rename from wgpu/examples/texture-arrays/screenshot.png rename to examples/texture-arrays/screenshot.png diff --git a/wgpu/examples/texture-arrays/indexing.wgsl b/examples/texture-arrays/src/indexing.wgsl similarity index 100% rename from wgpu/examples/texture-arrays/indexing.wgsl rename to examples/texture-arrays/src/indexing.wgsl diff --git a/wgpu/examples/texture-arrays/main.rs b/examples/texture-arrays/src/main.rs similarity index 96% rename from wgpu/examples/texture-arrays/main.rs rename to examples/texture-arrays/src/main.rs index c9318673e..b2683c847 100644 --- a/wgpu/examples/texture-arrays/main.rs +++ b/examples/texture-arrays/src/main.rs @@ -1,6 +1,3 @@ -#[path = "../framework.rs"] -mod framework; - use bytemuck::{Pod, Zeroable}; use std::num::{NonZeroU32, NonZeroU64}; use wgpu::util::DeviceExt; @@ -73,7 +70,7 @@ struct Example { uniform_workaround: bool, } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn optional_features() -> wgpu::Features { wgpu::Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING } @@ -369,7 +366,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: Some("primary"), @@ -408,7 +405,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("texture-arrays"); + wgpu_example::framework::run::("texture-arrays"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -416,26 +413,26 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn texture_arrays_uniform() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/texture-arrays/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::empty(), - base_test_parameters: framework::test_common::TestParameters::default(), - comparisons: &[framework::ComparisonType::Mean(0.0)], + base_test_parameters: wgpu_test::TestParameters::default(), + comparisons: &[wgpu_test::ComparisonType::Mean(0.0)], }); } #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn texture_arrays_non_uniform() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/texture-arrays/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING, - base_test_parameters: framework::test_common::TestParameters::default(), - comparisons: &[framework::ComparisonType::Mean(0.0)], + base_test_parameters: wgpu_test::TestParameters::default(), + comparisons: &[wgpu_test::ComparisonType::Mean(0.0)], }); } diff --git a/wgpu/examples/texture-arrays/non_uniform_indexing.wgsl b/examples/texture-arrays/src/non_uniform_indexing.wgsl similarity index 100% rename from wgpu/examples/texture-arrays/non_uniform_indexing.wgsl rename to examples/texture-arrays/src/non_uniform_indexing.wgsl diff --git a/examples/water/Cargo.toml b/examples/water/Cargo.toml new file mode 100644 index 000000000..6310f83f8 --- /dev/null +++ b/examples/water/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "wgpu-water-example" +version.workspace = true +license.workspace = true +edition.workspace = true +description = "wgpu water example" +publish = false + +[[bin]] +name = "water" +path = "src/main.rs" + +[dependencies] +bytemuck.workspace = true +nanorand.workspace = true +glam.workspace = true +noise.workspace = true +wasm-bindgen-test.workspace = true +wgpu-example.workspace = true +wgpu.workspace = true +winit.workspace = true + +[dev-dependencies] +wgpu-test.workspace = true diff --git a/wgpu/examples/water/README.md b/examples/water/README.md similarity index 100% rename from wgpu/examples/water/README.md rename to examples/water/README.md diff --git a/wgpu/examples/water/screenshot.png b/examples/water/screenshot.png similarity index 100% rename from wgpu/examples/water/screenshot.png rename to examples/water/screenshot.png diff --git a/wgpu/examples/water/main.rs b/examples/water/src/main.rs similarity index 98% rename from wgpu/examples/water/main.rs rename to examples/water/src/main.rs index 9f516cd53..9d1c1e155 100644 --- a/wgpu/examples/water/main.rs +++ b/examples/water/src/main.rs @@ -1,6 +1,3 @@ -#[path = "../framework.rs"] -mod framework; - mod point_gen; use bytemuck::{Pod, Zeroable}; @@ -268,7 +265,7 @@ impl Example { } } -impl framework::Example for Example { +impl wgpu_example::framework::Example for Example { fn init( config: &wgpu::SurfaceConfiguration, _adapter: &wgpu::Adapter, @@ -699,7 +696,7 @@ impl framework::Example for Example { view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue, - _spawner: &framework::Spawner, + _spawner: &wgpu_example::framework::Spawner, ) { // Increment frame count regardless of if we draw. self.current_frame += 1; @@ -817,7 +814,7 @@ impl framework::Example for Example { } fn main() { - framework::run::("water"); + wgpu_example::framework::run::("water"); } wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); @@ -825,13 +822,13 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test::wasm_bindgen_test] fn water() { - framework::test::(framework::FrameworkRefTest { + wgpu_example::framework::test::(wgpu_example::framework::FrameworkRefTest { image_path: "/examples/water/screenshot.png", width: 1024, height: 768, optional_features: wgpu::Features::default(), - base_test_parameters: framework::test_common::TestParameters::default() + base_test_parameters: wgpu_test::TestParameters::default() .downlevel_flags(wgpu::DownlevelFlags::READ_ONLY_DEPTH_STENCIL), - comparisons: &[framework::ComparisonType::Mean(0.01)], + comparisons: &[wgpu_test::ComparisonType::Mean(0.01)], }); } diff --git a/wgpu/examples/water/point_gen.rs b/examples/water/src/point_gen.rs similarity index 100% rename from wgpu/examples/water/point_gen.rs rename to examples/water/src/point_gen.rs diff --git a/wgpu/examples/water/terrain.wgsl b/examples/water/src/terrain.wgsl similarity index 100% rename from wgpu/examples/water/terrain.wgsl rename to examples/water/src/terrain.wgsl diff --git a/wgpu/examples/water/water.wgsl b/examples/water/src/water.wgsl similarity index 100% rename from wgpu/examples/water/water.wgsl rename to examples/water/src/water.wgsl diff --git a/player/Cargo.toml b/player/Cargo.toml index 01aaf02db..5a6ea2bd7 100644 --- a/player/Cargo.toml +++ b/player/Cargo.toml @@ -25,21 +25,9 @@ winit = { workspace = true, optional = true } workspace = true features = ["replay"] -[dependencies.wgc] +[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] workspace = true -features = ["replay", "raw-window-handle", "strict_asserts", "wgsl"] - -[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc] -workspace = true -features = ["metal"] - -[target.'cfg(windows)'.dependencies.wgc] -workspace = true -features = ["dx11", "dx12"] - -[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc] -workspace = true -features = ["vulkan"] +features = ["replay", "raw-window-handle", "strict_asserts", "wgsl", "metal", "dx11", "dx12", "vulkan", "gles"] [dev-dependencies] serde.workspace = true diff --git a/player/src/bin/play.rs b/player/src/bin/play.rs index 3623737b6..cb596b4ac 100644 --- a/player/src/bin/play.rs +++ b/player/src/bin/play.rs @@ -1,15 +1,16 @@ /*! This is a player for WebGPU traces. !*/ -use player::{GlobalPlay as _, IdentityPassThroughFactory}; -use wgc::{device::trace, gfx_select}; - -use std::{ - fs, - path::{Path, PathBuf}, -}; - +#[cfg(not(target_arch = "wasm32"))] fn main() { + use player::{GlobalPlay as _, IdentityPassThroughFactory}; + use wgc::{device::trace, gfx_select}; + + use std::{ + fs, + path::{Path, PathBuf}, + }; + #[cfg(feature = "winit")] use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle}; #[cfg(feature = "winit")] @@ -197,3 +198,6 @@ fn main() { }); } } + +#[cfg(target_arch = "wasm32")] +fn main() {} diff --git a/player/src/lib.rs b/player/src/lib.rs index bbf87a8cd..0f6eb1d10 100644 --- a/player/src/lib.rs +++ b/player/src/lib.rs @@ -5,7 +5,7 @@ * which is basically everything except for BGL and shader modules, * so that we don't accidentally try to use the same ID. !*/ - +#![cfg(not(target_arch = "wasm32"))] #![warn(unsafe_op_in_unsafe_fn)] use wgc::device::trace; diff --git a/player/tests/data/pipeline-statistics-query.ron b/player/tests/data/pipeline-statistics-query.ron index d4198f2a3..999c333a3 100644 --- a/player/tests/data/pipeline-statistics-query.ron +++ b/player/tests/data/pipeline-statistics-query.ron @@ -1,5 +1,5 @@ ( - features: 0x0000_0001_0000_0000, // PIPELINE_STATISTICS_QUERY + features: 0x0000_0005_0000_0000, // MAPPABLE_PRIMARY_BUFFERS | PIPELINE_STATISTICS_QUERY expectations: [ ( name: "Queried number of compute invocations is correct", @@ -46,7 +46,7 @@ ( label: Some("Compute Invocation Result Buffer"), size: 16, - usage: 9, // COPY_DST | MAP_READ + usage: 0b1000001001, // COPY_DST | MAP_READ mapped_at_creation: false, ), ), diff --git a/player/tests/test.rs b/player/tests/test.rs index 7534e04b5..cafb9c0ee 100644 --- a/player/tests/test.rs +++ b/player/tests/test.rs @@ -8,6 +8,7 @@ * - last action is `Submit` * - no swapchain use !*/ +#![cfg(not(target_arch = "wasm32"))] use player::{GlobalPlay, IdentityPassThroughFactory}; use std::{ @@ -208,6 +209,9 @@ impl Corpus { println!("\tBackend {:?}", backend); let supported_features = wgc::gfx_select!(adapter => global.adapter_features(adapter)).unwrap(); + let downlevel_caps = + wgc::gfx_select!(adapter => global.adapter_downlevel_capabilities(adapter)) + .unwrap(); let mut test_num = 0; for test_path in &corpus.tests { println!("\t\tTest '{:?}'", test_path); @@ -219,6 +223,13 @@ impl Corpus { ); continue; } + if !downlevel_caps + .flags + .contains(wgt::DownlevelFlags::COMPUTE_SHADERS) + { + println!("\t\tSkipped due to missing compute shader capability"); + continue; + } test.run(dir, &global, adapter, test_num); test_num += 1; } diff --git a/tests/Cargo.toml b/tests/Cargo.toml new file mode 100644 index 000000000..5ab713ddd --- /dev/null +++ b/tests/Cargo.toml @@ -0,0 +1,50 @@ +[package] +name = "wgpu-test" +version.workspace = true +authors.workspace = true +edition.workspace = true +description = "common code for wgpu tests" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true +autotests = false +publish = false + +[[test]] +name = "wgpu-tests" +path = "tests/root.rs" + +[features] +webgl = ["wgpu/webgl"] + +[dependencies] +bitflags.workspace = true +cfg-if.workspace = true +env_logger.workspace = true +log.workspace = true +pollster.workspace = true +png.workspace = true +wgpu.workspace = true +wgt.workspace = true + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +nv-flip.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_log.workspace = true +raw-window-handle.workspace = true +wasm-bindgen.workspace = true +web-sys = { workspace = true } + +[dev-dependencies] +bytemuck.workspace = true +naga = { workspace = true, features = ["wgsl-in"] } +wasm-bindgen-test.workspace = true + +[target.'cfg(target_arch = "wasm32")'.dev-dependencies] +js-sys.workspace = true +image.workspace = true +wasm-bindgen.workspace = true +wasm-bindgen-futures.workspace = true +web-sys = { workspace = true, features = ["CanvasRenderingContext2d", "Blob"] } diff --git a/wgpu/tests/common/copy_texture_to_buffer.wgsl b/tests/src/copy_texture_to_buffer.wgsl similarity index 100% rename from wgpu/tests/common/copy_texture_to_buffer.wgsl rename to tests/src/copy_texture_to_buffer.wgsl diff --git a/wgpu/tests/common/image.rs b/tests/src/image.rs similarity index 100% rename from wgpu/tests/common/image.rs rename to tests/src/image.rs diff --git a/wgpu/tests/common/isolation.rs b/tests/src/isolation.rs similarity index 100% rename from wgpu/tests/common/isolation.rs rename to tests/src/isolation.rs diff --git a/wgpu/tests/common/mod.rs b/tests/src/lib.rs similarity index 92% rename from wgpu/tests/common/mod.rs rename to tests/src/lib.rs index 11044a966..b8a0fb244 100644 --- a/wgpu/tests/common/mod.rs +++ b/tests/src/lib.rs @@ -9,6 +9,8 @@ use wgt::{Backends, DeviceDescriptor, DownlevelCapabilities, Features, Limits}; pub mod image; mod isolation; +pub use self::image::ComparisonType; + const CANVAS_ID: &str = "test-canvas"; async fn initialize_device( @@ -296,7 +298,7 @@ pub fn initialize_test(parameters: TestParameters, test_function: impl FnOnce(Te let panicked = catch_unwind(AssertUnwindSafe(|| test_function(context))).is_err(); cfg_if::cfg_if!( if #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] { - let canary_set = hal::VALIDATION_CANARY.get_and_reset(); + let canary_set = wgpu::hal::VALIDATION_CANARY.get_and_reset(); } else { let canary_set = _surface_guard.check_for_unreported_errors(); } @@ -357,9 +359,30 @@ fn initialize_adapter() -> (Adapter, SurfaceGuard) { // On wasm, append a canvas to the document body for initializing the adapter let canvas = create_html_canvas(); - let surface = instance - .create_surface_from_canvas(canvas.clone()) - .expect("could not create surface from canvas"); + // We use raw_window_handle here, as create_surface_from_canvas is not implemented on emscripten. + struct WindowHandle; + unsafe impl raw_window_handle::HasRawWindowHandle for WindowHandle { + fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle { + raw_window_handle::RawWindowHandle::Web({ + let mut handle = raw_window_handle::WebWindowHandle::empty(); + handle.id = 1; + handle + }) + } + } + unsafe impl raw_window_handle::HasRawDisplayHandle for WindowHandle { + fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle { + raw_window_handle::RawDisplayHandle::Web( + raw_window_handle::WebDisplayHandle::empty(), + ) + } + } + + let surface = unsafe { + instance + .create_surface(&WindowHandle) + .expect("could not create surface from canvas") + }; surface_guard = SurfaceGuard { canvas }; @@ -428,6 +451,7 @@ fn create_html_canvas() -> web_sys::HtmlCanvasElement { .and_then(|doc| { let body = doc.body().unwrap(); let canvas = doc.create_element("Canvas").unwrap(); + canvas.set_attribute("data-raw-handle", "1").unwrap(); canvas.set_id(CANVAS_ID); body.append_child(&canvas).unwrap(); canvas.dyn_into::().ok() diff --git a/wgpu/tests/3x3_colors.png b/tests/tests/3x3_colors.png similarity index 100% rename from wgpu/tests/3x3_colors.png rename to tests/tests/3x3_colors.png diff --git a/wgpu/tests/buffer.rs b/tests/tests/buffer.rs similarity index 98% rename from wgpu/tests/buffer.rs rename to tests/tests/buffer.rs index ab3d38669..1e7445d89 100644 --- a/wgpu/tests/buffer.rs +++ b/tests/tests/buffer.rs @@ -1,4 +1,4 @@ -use crate::common::{initialize_test, TestParameters, TestingContext}; +use wgpu_test::{initialize_test, TestParameters, TestingContext}; fn test_empty_buffer_range(ctx: &TestingContext, buffer_size: u64, label: &str) { let r = wgpu::BufferUsages::MAP_READ; diff --git a/wgpu/tests/buffer_copy.rs b/tests/tests/buffer_copy.rs similarity index 94% rename from wgpu/tests/buffer_copy.rs rename to tests/tests/buffer_copy.rs index 98baf2c78..5fcafe68f 100644 --- a/wgpu/tests/buffer_copy.rs +++ b/tests/tests/buffer_copy.rs @@ -3,7 +3,7 @@ use wasm_bindgen_test::wasm_bindgen_test; use wgt::BufferAddress; -use crate::common::{fail_if, initialize_test, TestParameters}; +use wgpu_test::{fail_if, initialize_test, TestParameters}; #[test] #[wasm_bindgen_test] diff --git a/wgpu/tests/buffer_usages.rs b/tests/tests/buffer_usages.rs similarity index 97% rename from wgpu/tests/buffer_usages.rs rename to tests/tests/buffer_usages.rs index 350f3a04a..e0f5164f6 100644 --- a/wgpu/tests/buffer_usages.rs +++ b/tests/tests/buffer_usages.rs @@ -1,7 +1,7 @@ //! Tests for buffer usages validation. -use crate::common::{fail_if, initialize_test, TestParameters}; use wasm_bindgen_test::*; +use wgpu_test::{fail_if, initialize_test, TestParameters}; use wgt::BufferAddress; const BUFFER_SIZE: BufferAddress = 1234; diff --git a/wgpu/tests/clear_texture.rs b/tests/tests/clear_texture.rs similarity index 99% rename from wgpu/tests/clear_texture.rs rename to tests/tests/clear_texture.rs index 87751f54a..7b2024c64 100644 --- a/wgpu/tests/clear_texture.rs +++ b/tests/tests/clear_texture.rs @@ -1,5 +1,5 @@ -use crate::common::{image::ReadbackBuffers, initialize_test, TestParameters, TestingContext}; use wasm_bindgen_test::*; +use wgpu_test::{image::ReadbackBuffers, initialize_test, TestParameters, TestingContext}; static TEXTURE_FORMATS_UNCOMPRESSED_GLES_COMPAT: &[wgpu::TextureFormat] = &[ wgpu::TextureFormat::R8Unorm, diff --git a/wgpu/tests/device.rs b/tests/tests/device.rs similarity index 77% rename from wgpu/tests/device.rs rename to tests/tests/device.rs index 69da6b9f3..cfd9ac960 100644 --- a/wgpu/tests/device.rs +++ b/tests/tests/device.rs @@ -1,6 +1,6 @@ use wasm_bindgen_test::*; -use crate::common::{initialize_test, TestParameters}; +use wgpu_test::{initialize_test, TestParameters}; #[test] #[wasm_bindgen_test] diff --git a/wgpu/tests/encoder.rs b/tests/tests/encoder.rs similarity index 84% rename from wgpu/tests/encoder.rs rename to tests/tests/encoder.rs index 119f2cad8..9e541c16a 100644 --- a/wgpu/tests/encoder.rs +++ b/tests/tests/encoder.rs @@ -1,5 +1,5 @@ -use crate::common::{initialize_test, TestParameters}; use wasm_bindgen_test::*; +use wgpu_test::{initialize_test, TestParameters}; #[test] #[wasm_bindgen_test] diff --git a/wgpu/tests/example_wgsl.rs b/tests/tests/example_wgsl.rs similarity index 100% rename from wgpu/tests/example_wgsl.rs rename to tests/tests/example_wgsl.rs diff --git a/wgpu/tests/external_texture.rs b/tests/tests/external_texture.rs similarity index 99% rename from wgpu/tests/external_texture.rs rename to tests/tests/external_texture.rs index 973110901..2c3a8b987 100644 --- a/wgpu/tests/external_texture.rs +++ b/tests/tests/external_texture.rs @@ -1,9 +1,9 @@ #![cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] -use crate::common::{fail_if, initialize_test, TestParameters}; use wasm_bindgen::JsCast; use wasm_bindgen_test::*; use wgpu::ExternalImageSource; +use wgpu_test::{fail_if, initialize_test, TestParameters}; #[wasm_bindgen_test] async fn image_bitmap_import() { diff --git a/wgpu/tests/instance.rs b/tests/tests/instance.rs similarity index 100% rename from wgpu/tests/instance.rs rename to tests/tests/instance.rs diff --git a/wgpu/tests/poll.rs b/tests/tests/poll.rs similarity index 97% rename from wgpu/tests/poll.rs rename to tests/tests/poll.rs index 6f2eb70e9..7409dad09 100644 --- a/wgpu/tests/poll.rs +++ b/tests/tests/poll.rs @@ -6,8 +6,8 @@ use wgpu::{ CommandEncoderDescriptor, ComputePassDescriptor, Maintain, ShaderStages, }; -use crate::common::{initialize_test, TestParameters, TestingContext}; use wasm_bindgen_test::*; +use wgpu_test::{initialize_test, TestParameters, TestingContext}; fn generate_dummy_work(ctx: &TestingContext) -> CommandBuffer { let buffer = ctx.device.create_buffer(&BufferDescriptor { diff --git a/wgpu/tests/queue_transfer.rs b/tests/tests/queue_transfer.rs similarity index 96% rename from wgpu/tests/queue_transfer.rs rename to tests/tests/queue_transfer.rs index 714508766..f17030f37 100644 --- a/wgpu/tests/queue_transfer.rs +++ b/tests/tests/queue_transfer.rs @@ -1,7 +1,7 @@ //! Tests for buffer copy validation. -use crate::common::{fail, initialize_test, TestParameters}; use wasm_bindgen_test::*; +use wgpu_test::{fail, initialize_test, TestParameters}; #[test] #[wasm_bindgen_test] diff --git a/wgpu/tests/regression/issue_3457.rs b/tests/tests/regression/issue_3457.rs similarity index 99% rename from wgpu/tests/regression/issue_3457.rs rename to tests/tests/regression/issue_3457.rs index 2fb010103..158227765 100644 --- a/wgpu/tests/regression/issue_3457.rs +++ b/tests/tests/regression/issue_3457.rs @@ -1,4 +1,4 @@ -use crate::common::{initialize_test, TestParameters}; +use wgpu_test::{initialize_test, TestParameters}; use wasm_bindgen_test::wasm_bindgen_test; use wgpu::*; diff --git a/wgpu/tests/regression/issue_3457.wgsl b/tests/tests/regression/issue_3457.wgsl similarity index 100% rename from wgpu/tests/regression/issue_3457.wgsl rename to tests/tests/regression/issue_3457.wgsl diff --git a/wgpu/tests/resource_descriptor_accessor.rs b/tests/tests/resource_descriptor_accessor.rs similarity index 91% rename from wgpu/tests/resource_descriptor_accessor.rs rename to tests/tests/resource_descriptor_accessor.rs index cbb3aac42..5f70258ac 100644 --- a/wgpu/tests/resource_descriptor_accessor.rs +++ b/tests/tests/resource_descriptor_accessor.rs @@ -1,5 +1,5 @@ -use crate::common::{initialize_test, TestParameters}; use wasm_bindgen_test::*; +use wgpu_test::{initialize_test, TestParameters}; /// Buffer's size and usage can be read back. #[test] diff --git a/wgpu/tests/resource_error.rs b/tests/tests/resource_error.rs similarity index 96% rename from wgpu/tests/resource_error.rs rename to tests/tests/resource_error.rs index eb8877910..c02033b33 100644 --- a/wgpu/tests/resource_error.rs +++ b/tests/tests/resource_error.rs @@ -1,5 +1,5 @@ -use crate::common::{fail, initialize_test, valid, TestParameters}; use wasm_bindgen_test::*; +use wgpu_test::{fail, initialize_test, valid, TestParameters}; #[test] #[wasm_bindgen_test] diff --git a/wgpu/tests/root.rs b/tests/tests/root.rs similarity index 92% rename from wgpu/tests/root.rs rename to tests/tests/root.rs index 277b34eb6..27422ffb9 100644 --- a/wgpu/tests/root.rs +++ b/tests/tests/root.rs @@ -1,8 +1,5 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; -// All files containing tests -mod common; - mod regression { mod issue_3457; } diff --git a/wgpu/tests/shader/mod.rs b/tests/tests/shader/mod.rs similarity index 99% rename from wgpu/tests/shader/mod.rs rename to tests/tests/shader/mod.rs index 518b7f940..450803306 100644 --- a/wgpu/tests/shader/mod.rs +++ b/tests/tests/shader/mod.rs @@ -13,7 +13,7 @@ use wgpu::{ ShaderModuleDescriptor, ShaderSource, ShaderStages, }; -use crate::common::TestingContext; +use wgpu_test::TestingContext; mod numeric_builtins; mod struct_layout; diff --git a/wgpu/tests/shader/numeric_builtins.rs b/tests/tests/shader/numeric_builtins.rs similarity index 91% rename from wgpu/tests/shader/numeric_builtins.rs rename to tests/tests/shader/numeric_builtins.rs index c215054cc..2f6981ef7 100644 --- a/wgpu/tests/shader/numeric_builtins.rs +++ b/tests/tests/shader/numeric_builtins.rs @@ -1,10 +1,8 @@ use wasm_bindgen_test::*; use wgpu::{DownlevelFlags, Limits}; -use crate::{ - common::{initialize_test, TestParameters}, - shader::{shader_input_output_test, InputStorageType, ShaderTest}, -}; +use crate::shader::{shader_input_output_test, InputStorageType, ShaderTest}; +use wgpu_test::{initialize_test, TestParameters}; fn create_numeric_builtin_test() -> Vec { let mut tests = Vec::new(); diff --git a/wgpu/tests/shader/shader_test.wgsl b/tests/tests/shader/shader_test.wgsl similarity index 100% rename from wgpu/tests/shader/shader_test.wgsl rename to tests/tests/shader/shader_test.wgsl diff --git a/wgpu/tests/shader/struct_layout.rs b/tests/tests/shader/struct_layout.rs similarity index 98% rename from wgpu/tests/shader/struct_layout.rs rename to tests/tests/shader/struct_layout.rs index c62588ab1..bc433b582 100644 --- a/wgpu/tests/shader/struct_layout.rs +++ b/tests/tests/shader/struct_layout.rs @@ -3,10 +3,8 @@ use std::fmt::Write; use wasm_bindgen_test::*; use wgpu::{Backends, DownlevelFlags, Features, Limits}; -use crate::{ - common::{initialize_test, TestParameters}, - shader::{shader_input_output_test, InputStorageType, ShaderTest, MAX_BUFFER_SIZE}, -}; +use crate::shader::{shader_input_output_test, InputStorageType, ShaderTest, MAX_BUFFER_SIZE}; +use wgpu_test::{initialize_test, TestParameters}; fn create_struct_layout_tests(storage_type: InputStorageType) -> Vec { let input_values: Vec<_> = (0..(MAX_BUFFER_SIZE as u32 / 4)).collect(); diff --git a/wgpu/tests/shader/zero_init_workgroup_mem.rs b/tests/tests/shader/zero_init_workgroup_mem.rs similarity index 98% rename from wgpu/tests/shader/zero_init_workgroup_mem.rs rename to tests/tests/shader/zero_init_workgroup_mem.rs index c951697d5..a666d2aa2 100644 --- a/wgpu/tests/shader/zero_init_workgroup_mem.rs +++ b/tests/tests/shader/zero_init_workgroup_mem.rs @@ -8,7 +8,7 @@ use wgpu::{ ShaderStages, }; -use crate::common::{initialize_test, TestParameters, TestingContext}; +use wgpu_test::{initialize_test, TestParameters, TestingContext}; #[test] fn zero_init_workgroup_mem() { diff --git a/wgpu/tests/shader/zero_init_workgroup_mem.wgsl b/tests/tests/shader/zero_init_workgroup_mem.wgsl similarity index 100% rename from wgpu/tests/shader/zero_init_workgroup_mem.wgsl rename to tests/tests/shader/zero_init_workgroup_mem.wgsl diff --git a/wgpu/tests/shader_primitive_index/mod.rs b/tests/tests/shader_primitive_index/mod.rs similarity index 99% rename from wgpu/tests/shader_primitive_index/mod.rs rename to tests/tests/shader_primitive_index/mod.rs index c10a842cc..fafd4b682 100644 --- a/wgpu/tests/shader_primitive_index/mod.rs +++ b/tests/tests/shader_primitive_index/mod.rs @@ -1,6 +1,6 @@ -use crate::common::{initialize_test, TestParameters, TestingContext}; use wasm_bindgen_test::*; use wgpu::util::{align_to, DeviceExt}; +use wgpu_test::{initialize_test, TestParameters, TestingContext}; // // These tests render two triangles to a 2x2 render target. The first triangle diff --git a/wgpu/tests/shader_primitive_index/primitive_index.wgsl b/tests/tests/shader_primitive_index/primitive_index.wgsl similarity index 100% rename from wgpu/tests/shader_primitive_index/primitive_index.wgsl rename to tests/tests/shader_primitive_index/primitive_index.wgsl diff --git a/wgpu/tests/shader_view_format/mod.rs b/tests/tests/shader_view_format/mod.rs similarity index 98% rename from wgpu/tests/shader_view_format/mod.rs rename to tests/tests/shader_view_format/mod.rs index 045198f1b..04d7467d2 100644 --- a/wgpu/tests/shader_view_format/mod.rs +++ b/tests/tests/shader_view_format/mod.rs @@ -1,5 +1,5 @@ -use crate::common::{image::calc_difference, initialize_test, TestParameters, TestingContext}; use wgpu::{util::DeviceExt, DownlevelFlags, Limits, TextureFormat}; +use wgpu_test::{image::calc_difference, initialize_test, TestParameters, TestingContext}; #[test] fn reinterpret_srgb_ness() { diff --git a/wgpu/tests/shader_view_format/view_format.wgsl b/tests/tests/shader_view_format/view_format.wgsl similarity index 100% rename from wgpu/tests/shader_view_format/view_format.wgsl rename to tests/tests/shader_view_format/view_format.wgsl diff --git a/wgpu/tests/texture_bounds.rs b/tests/tests/texture_bounds.rs similarity index 98% rename from wgpu/tests/texture_bounds.rs rename to tests/tests/texture_bounds.rs index ea6b2a18b..da6cc6b52 100644 --- a/wgpu/tests/texture_bounds.rs +++ b/tests/tests/texture_bounds.rs @@ -1,7 +1,7 @@ //! Tests for texture copy bounds checks. -use crate::common::{fail_if, initialize_test, TestParameters}; use wasm_bindgen_test::*; +use wgpu_test::{fail_if, initialize_test, TestParameters}; #[test] #[wasm_bindgen_test] diff --git a/wgpu/tests/transfer.rs b/tests/tests/transfer.rs similarity index 97% rename from wgpu/tests/transfer.rs rename to tests/tests/transfer.rs index 97d53149c..8263b217b 100644 --- a/wgpu/tests/transfer.rs +++ b/tests/tests/transfer.rs @@ -1,4 +1,4 @@ -use crate::common::{fail, initialize_test, TestParameters}; +use wgpu_test::{fail, initialize_test, TestParameters}; #[test] fn copy_overflow_z() { diff --git a/wgpu/tests/vertex_indices/draw.vert.wgsl b/tests/tests/vertex_indices/draw.vert.wgsl similarity index 100% rename from wgpu/tests/vertex_indices/draw.vert.wgsl rename to tests/tests/vertex_indices/draw.vert.wgsl diff --git a/wgpu/tests/vertex_indices/mod.rs b/tests/tests/vertex_indices/mod.rs similarity index 98% rename from wgpu/tests/vertex_indices/mod.rs rename to tests/tests/vertex_indices/mod.rs index 055e10a40..707a16a90 100644 --- a/wgpu/tests/vertex_indices/mod.rs +++ b/tests/tests/vertex_indices/mod.rs @@ -3,7 +3,7 @@ use std::num::NonZeroU64; use wasm_bindgen_test::*; use wgpu::util::DeviceExt; -use crate::common::{initialize_test, TestParameters, TestingContext}; +use wgpu_test::{initialize_test, TestParameters, TestingContext}; fn pulling_common( ctx: TestingContext, diff --git a/wgpu/tests/write_texture.rs b/tests/tests/write_texture.rs similarity index 99% rename from wgpu/tests/write_texture.rs rename to tests/tests/write_texture.rs index b6fe78761..0578c6035 100644 --- a/wgpu/tests/write_texture.rs +++ b/tests/tests/write_texture.rs @@ -1,6 +1,6 @@ //! Tests for texture copy -use crate::common::{initialize_test, TestParameters}; +use wgpu_test::{initialize_test, TestParameters}; use wasm_bindgen_test::*; diff --git a/wgpu/tests/zero_init_texture_after_discard.rs b/tests/tests/zero_init_texture_after_discard.rs similarity index 99% rename from wgpu/tests/zero_init_texture_after_discard.rs rename to tests/tests/zero_init_texture_after_discard.rs index 74048547b..f83576b1d 100644 --- a/wgpu/tests/zero_init_texture_after_discard.rs +++ b/tests/tests/zero_init_texture_after_discard.rs @@ -1,6 +1,6 @@ -use crate::common::{image::ReadbackBuffers, initialize_test, TestParameters, TestingContext}; use wasm_bindgen_test::*; use wgpu::*; +use wgpu_test::{image::ReadbackBuffers, initialize_test, TestParameters, TestingContext}; // Checks if discarding a color target resets its init state, causing a zero read of this texture when copied in after submit of the encoder. #[test] diff --git a/wgpu-core/src/error.rs b/wgpu-core/src/error.rs index 9a32e1f19..3cdecc536 100644 --- a/wgpu-core/src/error.rs +++ b/wgpu-core/src/error.rs @@ -25,31 +25,31 @@ impl<'a> ErrorFormatter<'a> { pub fn bind_group_label(&mut self, id: &crate::id::BindGroupId) { let global = self.global; - let label = gfx_select!(id => global.bind_group_label(*id)); + let label: String = gfx_select!(id => global.bind_group_label(*id)); self.label("bind group", &label); } pub fn bind_group_layout_label(&mut self, id: &crate::id::BindGroupLayoutId) { let global = self.global; - let label = gfx_select!(id => global.bind_group_layout_label(*id)); + let label: String = gfx_select!(id => global.bind_group_layout_label(*id)); self.label("bind group layout", &label); } pub fn render_pipeline_label(&mut self, id: &crate::id::RenderPipelineId) { let global = self.global; - let label = gfx_select!(id => global.render_pipeline_label(*id)); + let label: String = gfx_select!(id => global.render_pipeline_label(*id)); self.label("render pipeline", &label); } pub fn compute_pipeline_label(&mut self, id: &crate::id::ComputePipelineId) { let global = self.global; - let label = gfx_select!(id => global.compute_pipeline_label(*id)); + let label: String = gfx_select!(id => global.compute_pipeline_label(*id)); self.label("compute pipeline", &label); } pub fn buffer_label_with_key(&mut self, id: &crate::id::BufferId, key: &str) { let global = self.global; - let label = gfx_select!(id => global.buffer_label(*id)); + let label: String = gfx_select!(id => global.buffer_label(*id)); self.label(key, &label); } @@ -59,7 +59,7 @@ impl<'a> ErrorFormatter<'a> { pub fn texture_label_with_key(&mut self, id: &crate::id::TextureId, key: &str) { let global = self.global; - let label = gfx_select!(id => global.texture_label(*id)); + let label: String = gfx_select!(id => global.texture_label(*id)); self.label(key, &label); } @@ -69,7 +69,7 @@ impl<'a> ErrorFormatter<'a> { pub fn texture_view_label_with_key(&mut self, id: &crate::id::TextureViewId, key: &str) { let global = self.global; - let label = gfx_select!(id => global.texture_view_label(*id)); + let label: String = gfx_select!(id => global.texture_view_label(*id)); self.label(key, &label); } @@ -79,19 +79,19 @@ impl<'a> ErrorFormatter<'a> { pub fn sampler_label(&mut self, id: &crate::id::SamplerId) { let global = self.global; - let label = gfx_select!(id => global.sampler_label(*id)); + let label: String = gfx_select!(id => global.sampler_label(*id)); self.label("sampler", &label); } pub fn command_buffer_label(&mut self, id: &crate::id::CommandBufferId) { let global = self.global; - let label = gfx_select!(id => global.command_buffer_label(*id)); + let label: String = gfx_select!(id => global.command_buffer_label(*id)); self.label("command buffer", &label); } pub fn query_set_label(&mut self, id: &crate::id::QuerySetId) { let global = self.global; - let label = gfx_select!(id => global.query_set_label(*id)); + let label: String = gfx_select!(id => global.query_set_label(*id)); self.label("query set", &label); } } diff --git a/wgpu-core/src/hub.rs b/wgpu-core/src/hub.rs index 9588c3013..d3da0be6c 100644 --- a/wgpu-core/src/hub.rs +++ b/wgpu-core/src/hub.rs @@ -692,6 +692,14 @@ pub struct Hubs { pub(crate) dx11: Hub, #[cfg(feature = "gles")] pub(crate) gl: Hub, + #[cfg(all( + not(all(feature = "vulkan", not(target_arch = "wasm32"))), + not(all(feature = "metal", any(target_os = "macos", target_os = "ios"))), + not(all(feature = "dx12", windows)), + not(all(feature = "dx11", windows)), + not(feature = "gles"), + ))] + pub(crate) empty: Hub, } impl Hubs { @@ -707,6 +715,14 @@ impl Hubs { dx11: Hub::new(factory), #[cfg(feature = "gles")] gl: Hub::new(factory), + #[cfg(all( + not(all(feature = "vulkan", not(target_arch = "wasm32"))), + not(all(feature = "metal", any(target_os = "macos", target_os = "ios"))), + not(all(feature = "dx12", windows)), + not(all(feature = "dx11", windows)), + not(feature = "gles"), + ))] + empty: Hub::new(factory), } } } diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index ea91cc57b..b291de78c 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -520,7 +520,11 @@ impl Global { id.0 } - #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] + #[cfg(all( + target_arch = "wasm32", + not(target_os = "emscripten"), + feature = "gles" + ))] pub fn create_surface_webgl_canvas( &self, canvas: web_sys::HtmlCanvasElement, @@ -547,7 +551,11 @@ impl Global { Ok(id.0) } - #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] + #[cfg(all( + target_arch = "wasm32", + not(target_os = "emscripten"), + feature = "gles" + ))] pub fn create_surface_webgl_offscreen_canvas( &self, canvas: web_sys::OffscreenCanvas, diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 542b29941..d14ea9c0b 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -3,6 +3,17 @@ * into other language-specific user-friendly libraries. */ +// When we have no backends, we end up with a lot of dead or otherwise unreachable code. +#![cfg_attr( + all( + not(all(feature = "vulkan", not(target_arch = "wasm32"))), + not(all(feature = "metal", any(target_os = "macos", target_os = "ios"))), + not(all(feature = "dx12", windows)), + not(all(feature = "dx11", windows)), + not(feature = "gles"), + ), + allow(unused, clippy::let_and_return) +)] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![allow( // It is much clearer to assert negative conditions with eq! false diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index d63964522..9b194a68e 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -130,6 +130,7 @@ version = "0.12.0" features = ["wgsl-in"] [dev-dependencies] +cfg-if = "1" env_logger = "0.10" winit = "0.27.1" # for "halmark" example diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 588de6106..61c1584a2 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -751,26 +751,28 @@ impl Example { } } -#[cfg(all(feature = "metal"))] -type Api = hal::api::Metal; -#[cfg(all(feature = "vulkan", not(feature = "metal")))] -type Api = hal::api::Vulkan; -#[cfg(all(feature = "gles", not(feature = "metal"), not(feature = "vulkan")))] -type Api = hal::api::Gles; -#[cfg(all( - feature = "dx12", - not(feature = "metal"), - not(feature = "vulkan"), - not(feature = "gles") -))] -type Api = hal::api::Dx12; -#[cfg(not(any( - feature = "metal", - feature = "vulkan", - feature = "gles", - feature = "dx12" -)))] -type Api = hal::api::Empty; +cfg_if::cfg_if! { + // Apple + Metal + if #[cfg(all(any(target_os = "macos", target_os = "ios"), feature = "metal"))] { + type Api = hal::api::Metal; + } + // Wasm + Vulkan + else if #[cfg(all(not(target_arch = "wasm32"), feature = "vulkan"))] { + type Api = hal::api::Vulkan; + } + // Windows + DX12 + else if #[cfg(all(windows, feature = "dx12"))] { + type Api = hal::api::Dx12; + } + // Anything + GLES + else if #[cfg(feature = "gles")] { + type Api = hal::api::Gles; + } + // Fallback + else { + type Api = hal::api::Empty; + } +} fn main() { env_logger::init(); diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index d9dfc492f..1bf2ead0f 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -119,6 +119,7 @@ fn main() { #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] fn main() {} +#[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] fn fill_screen(exposed: &hal::ExposedAdapter, width: u32, height: u32) { use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 63a646b5d..7ce565238 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -5876,7 +5876,7 @@ pub enum ExternalImageSource { HTMLCanvasElement(web_sys::HtmlCanvasElement), /// Copy from a off-screen canvas. /// - /// Requies [`DownlevelFlags::EXTERNAL_TEXTURE_OFFSCREEN_CANVAS`] + /// Requies [`DownlevelFlags::UNRESTRICTED_EXTERNAL_TEXTURE_COPIES`] OffscreenCanvas(web_sys::OffscreenCanvas), } diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index e63cd19d3..1047e7bf4 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -9,17 +9,8 @@ repository.workspace = true keywords.workspace = true license.workspace = true exclude = [ - "etc/**/*", - "examples/**/*.png", # Image comparison test - "examples/**/*.dds", # Compressed textures - "examples/**/*.ktx2", # Compressed textures - "examples/**/*.mtl", # Material files - "examples/**/*.obj", # Model files - "tests/**/*", "Cargo.lock", - "target/**/*" ] -autotests = false [package.metadata.docs.rs] all-features = true @@ -33,58 +24,6 @@ targets = [ [lib] -[[test]] -name = "wgpu-tests" -path = "tests/root.rs" - -[[example]] -name = "boids" -test = true - -[[example]] -name = "bunnymark" -test = true - -[[example]] -name = "conservative-raster" -test = true - -[[example]] -name = "cube" -test = true - -[[example]] -name = "hello-compute" -test = true - -[[example]] -name = "mipmap" -test = true - -[[example]] -name = "msaa-line" -test = true - -[[example]] -name = "shadow" -test = true - -[[example]] -name = "skybox" -test = true - -[[example]] -name = "texture-arrays" -test = true - -[[example]] -name = "water" -test = true - -[[example]] -name = "stencil-triangles" -test = true - [features] default = ["wgsl"] # Apply run-time checks, even in release builds. These are in addition @@ -159,27 +98,6 @@ smallvec.workspace = true static_assertions.workspace = true cfg-if.workspace = true -[dev-dependencies] -bitflags.workspace = true -bytemuck = { workspace = true, features = ["derive"] } -glam.workspace = true -ddsfile.workspace = true -futures-intrusive.workspace = true -env_logger.workspace = true -image.workspace = true -log.workspace = true -noise = { workspace = true } -obj.workspace = true -pollster.workspace = true -png.workspace = true -nanorand = { workspace = true, features = ["wyrand"] } -wasm-bindgen-test.workspace = true -winit.workspace = true # for "halmark" example - -[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -async-executor.workspace = true -nv-flip.workspace = true - [dependencies.naga] workspace = true features = ["clone"] @@ -328,19 +246,4 @@ web-sys = { workspace = true, features = [ wasm-bindgen.workspace = true js-sys.workspace = true wasm-bindgen-futures.workspace = true -parking_lot.workspace = true - -[target.'cfg(target_arch = "wasm32")'.dev-dependencies] -console_error_panic_hook.workspace = true -console_log.workspace = true -# We need these features in the framework examples and tests -web-sys = { workspace = true, features = [ - "Location", - "Blob", - "RequestInit", - "RequestMode", - "Request", - "Response", - "WebGl2RenderingContext", - "CanvasRenderingContext2d" -] } +parking_lot.workspace = true \ No newline at end of file diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 655993ac3..8e6caa023 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -47,6 +47,21 @@ pub use wgt::{ QUERY_RESOLVE_BUFFER_ALIGNMENT, QUERY_SET_MAX_QUERIES, QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT, }; +#[cfg(any( + not(target_arch = "wasm32"), + feature = "webgl", + target_os = "emscripten" +))] +#[doc(hidden)] +pub use ::hal; +#[cfg(any( + not(target_arch = "wasm32"), + feature = "webgl", + target_os = "emscripten" +))] +#[doc(hidden)] +pub use ::wgc as core; + // wasm-only types, we try to keep as many types non-platform // specific, but these need to depend on web-sys. #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] @@ -4265,7 +4280,7 @@ impl Surface { #[cfg(feature = "expose-ids")] #[cfg_attr(docsrs, doc(cfg(feature = "expose-ids")))] #[repr(transparent)] -pub struct Id(core::num::NonZeroU64, std::marker::PhantomData<*mut T>); +pub struct Id(::core::num::NonZeroU64, std::marker::PhantomData<*mut T>); // SAFETY: `Id` is a bare `NonZeroU64`, the type parameter is a marker purely to avoid confusing Ids // returned for different types , so `Id` can safely implement Send and Sync.