From b9ecc8cd022d9e61a0b94c5a436ff57b461b946c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 23 Jul 2023 22:43:11 +0000 Subject: [PATCH 01/18] Bump winit from 0.27.5 to 0.28.0 (#3950) * Bump winit from 0.27.5 to 0.28.0 Bumps [winit](https://github.com/rust-windowing/winit) from 0.27.5 to 0.28.0. - [Release notes](https://github.com/rust-windowing/winit/releases) - [Changelog](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-windowing/winit/compare/v0.27.5...v0.28.0) --- updated-dependencies: - dependency-name: winit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * no longer check samples for emscripten target * set native activity for Android * fix using workspace for wgpu-hal --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andreas Reich --- .github/workflows/ci.yml | 6 +- Cargo.lock | 284 +++++++++++++++++++++++++++++++++++---- Cargo.toml | 2 +- wgpu-hal/Cargo.toml | 2 +- 4 files changed, 263 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d99a7254ed..f4ed15c4a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,11 +155,7 @@ jobs: # build for Emscripten cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features - # build cube example - cargo clippy --target ${{ matrix.target }} --bin cube - - # build raw-gles example - cargo clippy --target ${{ matrix.target }} --example raw-gles + # Don't check samples since we use winit in our samples which has dropped support for Emscripten. # all features cargo clippy --target ${{ matrix.target }} -p wgpu-hal --all-features diff --git a/Cargo.lock b/Cargo.lock index 6b43267ec9..9c221fac45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5110f1c78cf582855d895ecd0746b653db010cec6d9f5575293f27934d980a39" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" + [[package]] name = "addr2line" version = "0.20.0" @@ -37,6 +53,30 @@ dependencies = [ "memchr", ] +[[package]] +name = "android-activity" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40bc1575e653f158cbdc6ebcd917b9564e66321c5325c232c3591269c257be69" +dependencies = [ + "android-properties", + "bitflags 1.3.2", + "cc", + "jni-sys", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum 0.6.1", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -195,6 +235,25 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + [[package]] name = "bumpalo" version = "3.13.0" @@ -252,6 +311,9 @@ name = "cc" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -259,6 +321,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "cgl" version = "0.3.2" @@ -1098,7 +1166,7 @@ dependencies = [ "wayland-client", "wayland-egl", "winapi", - "winit", + "winit 0.27.5", ] [[package]] @@ -1332,6 +1400,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.64" @@ -1560,7 +1637,7 @@ dependencies = [ "bitflags 1.3.2", "jni-sys", "ndk-sys", - "num_enum", + "num_enum 0.5.11", "raw-window-handle 0.5.2", "thiserror", ] @@ -1722,7 +1799,16 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", ] [[package]] @@ -1737,6 +1823,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.26", +] + [[package]] name = "nv-flip" version = "0.1.2" @@ -1771,6 +1869,32 @@ dependencies = [ "objc_exception", ] +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3.patch-leaks.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -1795,6 +1919,15 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "orbclient" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "221d488cd70617f1bd599ed8ceb659df2147d9393717954d82a0f5e8032a6ab1" +dependencies = [ + "redox_syscall", +] + [[package]] name = "osmesa-sys" version = "0.1.2" @@ -1810,6 +1943,15 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" +[[package]] +name = "owned_ttf_parser" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" +dependencies = [ + "ttf-parser", +] + [[package]] name = "parking" version = "2.1.0" @@ -1916,7 +2058,7 @@ dependencies = [ "serde", "wgpu-core", "wgpu-types", - "winit", + "winit 0.28.6", ] [[package]] @@ -2218,7 +2360,20 @@ dependencies = [ "crossfont", "log", "smithay-client-toolkit", - "tiny-skia", + "tiny-skia 0.7.0", +] + +[[package]] +name = "sctk-adwaita" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia 0.8.4", ] [[package]] @@ -2441,6 +2596,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + [[package]] name = "strsim" version = "0.10.0" @@ -2510,7 +2671,21 @@ dependencies = [ "cfg-if", "png", "safe_arch", - "tiny-skia-path", + "tiny-skia-path 0.7.0", +] + +[[package]] +name = "tiny-skia" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "bytemuck", + "cfg-if", + "png", + "tiny-skia-path 0.8.4", ] [[package]] @@ -2523,6 +2698,17 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "tiny-skia-path" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2586,6 +2772,12 @@ dependencies = [ "winnow", ] +[[package]] +name = "ttf-parser" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a464a4b34948a5f67fddd2b823c62d9d92e44be75058b99939eae6c5b6960b33" + [[package]] name = "unic-char-property" version = "0.9.0" @@ -2965,7 +3157,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -2980,7 +3172,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -2998,7 +3190,7 @@ dependencies = [ "wasm-bindgen-test", "wgpu", "wgpu-example", - "winit", + "winit 0.28.6", ] [[package]] @@ -3009,7 +3201,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3045,7 +3237,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3066,7 +3258,7 @@ dependencies = [ "wgpu", "wgpu-hal", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3109,7 +3301,7 @@ dependencies = [ "web-sys", "wgpu-types", "winapi", - "winit", + "winit 0.28.6", ] [[package]] @@ -3127,7 +3319,7 @@ dependencies = [ "wasm-bindgen-test", "wgpu", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3157,7 +3349,7 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "wgpu", - "winit", + "winit 0.28.6", ] [[package]] @@ -3169,7 +3361,7 @@ dependencies = [ "env_logger", "pollster", "wgpu", - "winit", + "winit 0.28.6", ] [[package]] @@ -3196,7 +3388,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3210,7 +3402,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3223,7 +3415,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3239,7 +3431,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3251,7 +3443,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3288,7 +3480,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3314,7 +3506,7 @@ dependencies = [ "wgpu", "wgpu-example", "wgpu-test", - "winit", + "winit 0.28.6", ] [[package]] @@ -3387,6 +3579,15 @@ dependencies = [ "windows_x86_64_msvc 0.36.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.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -3563,7 +3764,7 @@ dependencies = [ "percent-encoding", "raw-window-handle 0.4.3", "raw-window-handle 0.5.2", - "sctk-adwaita", + "sctk-adwaita 0.4.3", "smithay-client-toolkit", "wasm-bindgen", "wayland-client", @@ -3573,6 +3774,41 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "winit" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "866db3f712fffba75d31bf0cdecf357c8aeafd158c5b7ab51dba2a2b2d47f196" +dependencies = [ + "android-activity", + "bitflags 1.3.2", + "cfg_aliases", + "core-foundation", + "core-graphics", + "dispatch", + "instant", + "libc", + "log", + "mio", + "ndk", + "objc2", + "once_cell", + "orbclient", + "percent-encoding", + "raw-window-handle 0.5.2", + "redox_syscall", + "sctk-adwaita 0.5.4", + "smithay-client-toolkit", + "wasm-bindgen", + "wayland-client", + "wayland-commons", + "wayland-protocols", + "wayland-scanner", + "web-sys", + "windows-sys 0.45.0", + "x11-dl", +] + [[package]] name = "winnow" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index 9c3246f670..96c05cb51f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,7 +98,7 @@ wgpu-core = { version = "0.17.0", path = "./wgpu-core" } wgpu-example = { version = "0.17.0", path = "./examples/common" } wgpu-test = { version = "0.17", path = "./tests"} wgpu-types = { version = "0.17.0", path = "./wgpu-types" } -winit = "0.27.1" +winit = { version = "0.28.6", features = [ "android-native-activity" ] } # Metal dependencies block = "0.1" diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 04459488c4..550752eb37 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -134,7 +134,7 @@ features = ["wgsl-in"] [dev-dependencies] cfg-if = "1" env_logger = "0.10" -winit = "0.27.1" # for "halmark" example +winit = { version = "0.28.6", features = [ "android-native-activity" ] } # for "halmark" example [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] glutin = "0.29.1" # for "gles" example From 7b7626487a1d0575ec6bf30a1586ae9e1e29f9a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:55:36 +0200 Subject: [PATCH 02/18] Bump serde from 1.0.173 to 1.0.174 (#3968) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.173 to 1.0.174. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.173...v1.0.174) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c221fac45..43cf2f8d3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2399,9 +2399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.173" +version = "1.0.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" +checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" dependencies = [ "serde_derive", ] @@ -2417,9 +2417,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.173" +version = "1.0.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" +checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e" dependencies = [ "proc-macro2", "quote", From a7798f2f8ade7829ffc08c47ff12c338a456b0aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:55:47 +0200 Subject: [PATCH 03/18] Bump thiserror from 1.0.43 to 1.0.44 (#3969) Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.43 to 1.0.44. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.43...1.0.44) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43cf2f8d3e..8c57e34b04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2641,18 +2641,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", From 95f2ca7f549bfd12c252ffe56bc1583335bc92b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:10:41 +0200 Subject: [PATCH 04/18] Bump serde from 1.0.174 to 1.0.175 (#3973) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.174 to 1.0.175. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.174...v1.0.175) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c57e34b04..930cee4702 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2399,9 +2399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.174" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] @@ -2417,9 +2417,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.174" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", From adc43b5672d1cc6e3873c1ad9c0409716b9e5edb Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:04:54 +0200 Subject: [PATCH 05/18] Omit texture store bound checks since they are no-ops if out of bounds on all APIs (#3975) --- CHANGELOG.md | 4 ++++ wgpu-hal/src/gles/device.rs | 2 +- wgpu-hal/src/metal/device.rs | 2 +- wgpu-hal/src/vulkan/adapter.rs | 14 ++++++-------- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 932a5eb4c6..72f0c83fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,10 @@ Bottom level categories: ## Unreleased +### Changes + +- Omit texture store bound checks since they are no-ops if out of bounds on all APIs. By @teoxoy in [#3975](https://github.com/gfx-rs/wgpu/pull/3975) + ### Bug Fixes #### Vulkan diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index 54f3003fc9..cc21f14836 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -222,7 +222,7 @@ impl super::Device { index: BoundsCheckPolicy::Unchecked, buffer: BoundsCheckPolicy::Unchecked, image_load: image_check, - image_store: image_check, + image_store: BoundsCheckPolicy::Unchecked, binding_array: BoundsCheckPolicy::Unchecked, }; diff --git a/wgpu-hal/src/metal/device.rs b/wgpu-hal/src/metal/device.rs index b0db65dab2..c3166d26ab 100644 --- a/wgpu-hal/src/metal/device.rs +++ b/wgpu-hal/src/metal/device.rs @@ -100,7 +100,7 @@ impl super::Device { index: bounds_check_policy, buffer: bounds_check_policy, image_load: bounds_check_policy, - image_store: bounds_check_policy, + image_store: naga::proc::BoundsCheckPolicy::Unchecked, // TODO: support bounds checks on binding arrays binding_array: naga::proc::BoundsCheckPolicy::Unchecked, }, diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 9a42d08e93..4bac0eede6 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1212,12 +1212,6 @@ impl super::Adapter { None }; - let image_checks = if self.private_caps.robust_image_access { - naga::proc::BoundsCheckPolicy::Unchecked - } else { - naga::proc::BoundsCheckPolicy::Restrict - }; - let naga_options = { use naga::back::spv; @@ -1279,8 +1273,12 @@ impl super::Adapter { } else { naga::proc::BoundsCheckPolicy::Restrict }, - image_load: image_checks, - image_store: image_checks, + image_load: if self.private_caps.robust_image_access { + naga::proc::BoundsCheckPolicy::Unchecked + } else { + naga::proc::BoundsCheckPolicy::Restrict + }, + image_store: naga::proc::BoundsCheckPolicy::Unchecked, // TODO: support bounds checks on binding arrays binding_array: naga::proc::BoundsCheckPolicy::Unchecked, }, From 2492956014ded0c03c50d04343eff9458d8e3e5d Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 25 Jul 2023 11:19:32 -0400 Subject: [PATCH 06/18] refactor: satisfy `clippy::manual_slice_size_calculation` --- examples/common/src/framework.rs | 4 ++-- examples/hello-compute/src/main.rs | 3 +-- wgpu-hal/src/gles/command.rs | 5 +---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index 482d970563..da8dd415ae 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -12,9 +12,9 @@ use winit::{ #[allow(dead_code)] pub fn cast_slice(data: &[T]) -> &[u8] { - use std::{mem::size_of, slice::from_raw_parts}; + use std::{mem::size_of_val, slice::from_raw_parts}; - unsafe { from_raw_parts(data.as_ptr() as *const u8, data.len() * size_of::()) } + unsafe { from_raw_parts(data.as_ptr() as *const u8, size_of_val(data)) } } #[allow(dead_code)] diff --git a/examples/hello-compute/src/main.rs b/examples/hello-compute/src/main.rs index afdf7744c9..cad0ad6876 100644 --- a/examples/hello-compute/src/main.rs +++ b/examples/hello-compute/src/main.rs @@ -75,8 +75,7 @@ async fn execute_gpu_inner( }); // Gets the size in bytes of the buffer. - let slice_size = numbers.len() * std::mem::size_of::(); - let size = slice_size as wgpu::BufferAddress; + let size = std::mem::size_of_val(numbers) as wgpu::BufferAddress; // Instantiates buffer without data. // `usage` of buffer specifies how it can be used: diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 5e3a1c52c8..c31b577079 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -49,10 +49,7 @@ impl super::CommandBuffer { fn add_push_constant_data(&mut self, data: &[u32]) -> Range { let data_raw = unsafe { - std::slice::from_raw_parts( - data.as_ptr() as *const _, - data.len() * mem::size_of::(), - ) + std::slice::from_raw_parts(data.as_ptr() as *const _, mem::size_of_val(data)) }; let start = self.data_bytes.len(); assert!(start < u32::MAX as usize); From fd2ecdd3600717ace0cf89f3a960e436f379b7dc Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 25 Jul 2023 11:19:56 -0400 Subject: [PATCH 07/18] refactor: gate `allow(clippy::drop_ref)` behind WASM build --- wgpu-hal/src/gles/adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 5594dfa237..ca75bd09ef 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -606,7 +606,7 @@ impl super::Adapter { // Drop the GL guard so we can move the context into AdapterShared // ( on Wasm the gl handle is just a ref so we tell clippy to allow // dropping the ref ) - #[allow(clippy::drop_ref)] + #[cfg_attr(target_arch = "wasm32", allow(clippy::drop_ref))] drop(gl); Some(crate::ExposedAdapter { From 80daf25f20a6f64baa8e37b606ada9f7c387666c Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 25 Jul 2023 11:25:55 -0400 Subject: [PATCH 08/18] refactor: satisfy `clippy::non_minimal_cfg` --- wgpu-hal/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index 910e46ca25..436553b29e 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -60,7 +60,7 @@ pub mod dx12; /// A dummy API implementation. pub mod empty; /// GLES API internals. -#[cfg(all(feature = "gles"))] +#[cfg(feature = "gles")] pub mod gles; /// Metal API internals. #[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))] From eb45d01b509cba3d5d44abc3fcdc88650270dacd Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 25 Jul 2023 11:28:47 -0400 Subject: [PATCH 09/18] refactor: satisfy `clippy::items_after_test_module` --- wgpu/src/lib.rs | 54 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 0e2be70b09..9389fed042 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -2722,33 +2722,6 @@ fn range_to_offset_size>( (offset, size) } -#[cfg(test)] -mod tests { - use crate::BufferSize; - - #[test] - fn range_to_offset_size_works() { - assert_eq!(crate::range_to_offset_size(0..2), (0, BufferSize::new(2))); - assert_eq!(crate::range_to_offset_size(2..5), (2, BufferSize::new(3))); - assert_eq!(crate::range_to_offset_size(..), (0, None)); - assert_eq!(crate::range_to_offset_size(21..), (21, None)); - assert_eq!(crate::range_to_offset_size(0..), (0, None)); - assert_eq!(crate::range_to_offset_size(..21), (0, BufferSize::new(21))); - } - - #[test] - #[should_panic] - fn range_to_offset_size_panics_for_empty_range() { - crate::range_to_offset_size(123..123); - } - - #[test] - #[should_panic] - fn range_to_offset_size_panics_for_unbounded_empty_range() { - crate::range_to_offset_size(..0); - } -} - /// Read only view into a mapped buffer. #[derive(Debug)] pub struct BufferView<'a> { @@ -5047,3 +5020,30 @@ mod send_sync { } } } + +#[cfg(test)] +mod tests { + use crate::BufferSize; + + #[test] + fn range_to_offset_size_works() { + assert_eq!(crate::range_to_offset_size(0..2), (0, BufferSize::new(2))); + assert_eq!(crate::range_to_offset_size(2..5), (2, BufferSize::new(3))); + assert_eq!(crate::range_to_offset_size(..), (0, None)); + assert_eq!(crate::range_to_offset_size(21..), (21, None)); + assert_eq!(crate::range_to_offset_size(0..), (0, None)); + assert_eq!(crate::range_to_offset_size(..21), (0, BufferSize::new(21))); + } + + #[test] + #[should_panic] + fn range_to_offset_size_panics_for_empty_range() { + crate::range_to_offset_size(123..123); + } + + #[test] + #[should_panic] + fn range_to_offset_size_panics_for_unbounded_empty_range() { + crate::range_to_offset_size(..0); + } +} From 8a8e00a5a523311c7576eebf953bcc5ffa56f557 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 25 Jul 2023 11:45:05 -0400 Subject: [PATCH 10/18] refactor(wasm): remove unnecessary `JsCast` import --- examples/common/src/framework.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index da8dd415ae..f26e136d81 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -453,7 +453,7 @@ pub fn run(title: &str) { #[cfg(target_arch = "wasm32")] pub fn run(title: &str) { - use wasm_bindgen::{prelude::*, JsCast}; + use wasm_bindgen::prelude::*; let title = title.to_owned(); wasm_bindgen_futures::spawn_local(async move { From fdfc41372e4e80c710fd49e9f4eec39061bb0b57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:21:55 +0200 Subject: [PATCH 11/18] Bump serde from 1.0.175 to 1.0.176 (#3981) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.175 to 1.0.176. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.175...v1.0.176) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 930cee4702..39eedc7f4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2399,9 +2399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.175" +version = "1.0.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" +checksum = "76dc28c9523c5d70816e393136b86d48909cfb27cecaa902d338c19ed47164dc" dependencies = [ "serde_derive", ] @@ -2417,9 +2417,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.175" +version = "1.0.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" +checksum = "a4e7b8c5dc823e3b90651ff1d3808419cd14e5ad76de04feaf37da114e7a306f" dependencies = [ "proc-macro2", "quote", From 335f40f85a492a5d9a69eda6835a30173f2e6b03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:22:06 +0200 Subject: [PATCH 12/18] Bump serde_json from 1.0.103 to 1.0.104 (#3982) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.103 to 1.0.104. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.103...v1.0.104) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- wgpu-types/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39eedc7f4a..399e3b40d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2428,9 +2428,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ "indexmap 2.0.0", "itoa", diff --git a/Cargo.toml b/Cargo.toml index 96c05cb51f..19a8f80c8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,7 +89,7 @@ raw-window-handle = "0.5" renderdoc-sys = "1.0.0" ron = "0.8" serde = "1" -serde_json = "1.0.96" +serde_json = "1.0.104" smallvec = "1" static_assertions = "1.1.0" thiserror = "1" diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index a782b34dc2..313d67bfb5 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -42,4 +42,4 @@ web-sys = { version = "0.3.64", features = [ [dev-dependencies] serde = { version = "1", features = ["serde_derive"] } -serde_json = "1.0.96" +serde_json = "1.0.104" From 01160c3ad1890d3bcfbb2efca0a34c7943ef7d71 Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Thu, 27 Jul 2023 18:33:05 +0200 Subject: [PATCH 13/18] Revert "Make shader write&read storage buffers match non readonly layouts" (#3984) --- wgpu-core/src/validation.rs | 71 +------------------------------------ 1 file changed, 1 insertion(+), 70 deletions(-) diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index 771adba731..83cb90530a 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -409,7 +409,7 @@ impl Resource { ) } }; - if !address_space_matches(self.class, class) { + if self.class != class { return Err(BindingError::WrongAddressSpace { binding: class, shader: self.class, @@ -1237,72 +1237,3 @@ impl Interface { Ok(outputs) } } - -fn address_space_matches(shader: naga::AddressSpace, binding: naga::AddressSpace) -> bool { - match (shader, binding) { - ( - naga::AddressSpace::Storage { - access: access_shader, - }, - naga::AddressSpace::Storage { - access: access_pipeline, - }, - ) => { - // Allow read- and write-only usages to match read-write layouts: - (access_shader & access_pipeline) == access_shader - } - (a, b) => a == b, - } -} - -#[cfg(test)] -mod test { - use super::address_space_matches; - - #[test] - fn address_space_matches_correctly() { - assert!(address_space_matches( - naga::AddressSpace::Uniform, - naga::AddressSpace::Uniform - )); - - assert!(!address_space_matches( - naga::AddressSpace::Uniform, - naga::AddressSpace::Storage { - access: naga::StorageAccess::LOAD - } - )); - - let test_cases = [ - (naga::StorageAccess::LOAD, naga::StorageAccess::LOAD, true), - (naga::StorageAccess::STORE, naga::StorageAccess::LOAD, false), - (naga::StorageAccess::LOAD, naga::StorageAccess::STORE, false), - (naga::StorageAccess::STORE, naga::StorageAccess::STORE, true), - ( - naga::StorageAccess::LOAD | naga::StorageAccess::STORE, - naga::StorageAccess::LOAD | naga::StorageAccess::STORE, - true, - ), - ( - naga::StorageAccess::STORE, - naga::StorageAccess::LOAD | naga::StorageAccess::STORE, - true, - ), - ( - naga::StorageAccess::LOAD, - naga::StorageAccess::LOAD | naga::StorageAccess::STORE, - true, - ), - ]; - - for (shader, binding, expect_match) in test_cases { - assert_eq!( - expect_match, - address_space_matches( - naga::AddressSpace::Storage { access: shader }, - naga::AddressSpace::Storage { access: binding } - ) - ); - } - } -} From 51e3105faedd208bc3e01716ea1fbdbff3f048f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 02:42:45 +0000 Subject: [PATCH 14/18] Bump serde from 1.0.176 to 1.0.177 (#3986) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 399e3b40d6..9ac6da60a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2399,9 +2399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.176" +version = "1.0.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76dc28c9523c5d70816e393136b86d48909cfb27cecaa902d338c19ed47164dc" +checksum = "63ba2516aa6bf82e0b19ca8b50019d52df58455d3cf9bdaf6315225fdd0c560a" dependencies = [ "serde_derive", ] @@ -2417,9 +2417,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.176" +version = "1.0.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e7b8c5dc823e3b90651ff1d3808419cd14e5ad76de04feaf37da114e7a306f" +checksum = "401797fe7833d72109fedec6bfcbe67c0eed9b99772f26eb8afd261f0abc6fd3" dependencies = [ "proc-macro2", "quote", From 28334ac19b639ffb5ea3ab7858cd14d9f2999a8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 00:45:44 -0400 Subject: [PATCH 15/18] Bump serde from 1.0.177 to 1.0.179 (#3994) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ac6da60a1..bd655dd67e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2399,9 +2399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.177" +version = "1.0.179" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63ba2516aa6bf82e0b19ca8b50019d52df58455d3cf9bdaf6315225fdd0c560a" +checksum = "0a5bf42b8d227d4abf38a1ddb08602e229108a517cd4e5bb28f9c7eaafdce5c0" dependencies = [ "serde_derive", ] @@ -2417,9 +2417,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.177" +version = "1.0.179" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401797fe7833d72109fedec6bfcbe67c0eed9b99772f26eb8afd261f0abc6fd3" +checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" dependencies = [ "proc-macro2", "quote", From 48078a800a2f1de70772641feee100b0506aaeaf Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Mon, 31 Jul 2023 15:30:47 +0200 Subject: [PATCH 16/18] Derive storage bindings via `naga::StorageAccess` instead of `naga::GlobalUse` (#3985) Removes the feature check for read-only and read-write storage textures as it's later checked by `create_bind_group_layout`. https://github.com/gfx-rs/wgpu/blob/335f40f85a492a5d9a69eda6835a30173f2e6b03/wgpu-core/src/device/resource.rs#L1505-L1518 Also removes the `GlobalUse` checks from `check_binding_use` as naga is already checking those. https://github.com/gfx-rs/naga/blob/535701f6b2f38f7e0088701ee4cf6d8024f74a21/src/valid/interface.rs#L639-L669 --- CHANGELOG.md | 4 + wgpu-core/src/device/resource.rs | 3 +- wgpu-core/src/validation.rs | 172 ++++++++++--------------------- 3 files changed, 61 insertions(+), 118 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72f0c83fcf..72aa2022c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,10 @@ Bottom level categories: ### Bug Fixes +#### General + +- Derive storage bindings via `naga::StorageAccess` instead of `naga::GlobalUse`. By @teoxoy in [#3985](https://github.com/gfx-rs/wgpu/pull/3985). + #### Vulkan - Fix enabling `wgpu::Features::PARTIALLY_BOUND_BINDING_ARRAY` not being actually enabled in vulkan backend. By @39ali in[#3772](https://github.com/gfx-rs/wgpu/pull/3772). diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 20e057a934..074170e562 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -1285,8 +1285,7 @@ impl Device { inner: Box::new(inner), }) })?; - let interface = - validation::Interface::new(&module, &info, self.features, self.limits.clone()); + let interface = validation::Interface::new(&module, &info, self.limits.clone()); let hal_shader = hal::ShaderInput::Naga(hal::NagaShader { module, info }); let hal_desc = hal::ShaderModuleDescriptor { diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index 83cb90530a..84e1e71691 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -1,5 +1,4 @@ use crate::{binding_model::BindEntryMap, FastHashMap, FastHashSet}; -use naga::valid::GlobalUse; use std::{collections::hash_map::Entry, fmt}; use thiserror::Error; use wgt::{BindGroupLayoutEntry, BindingType}; @@ -112,7 +111,7 @@ struct SpecializationConstant { struct EntryPoint { inputs: Vec, outputs: Vec, - resources: Vec<(naga::Handle, GlobalUse)>, + resources: Vec>, #[allow(unused)] spec_constants: Vec, sampling_pairs: FastHashSet<(naga::Handle, naga::Handle)>, @@ -121,7 +120,6 @@ struct EntryPoint { #[derive(Debug)] pub struct Interface { - features: wgt::Features, limits: wgt::Limits, resources: naga::Arena, entry_points: FastHashMap<(naga::ShaderStage, String), EntryPoint>, @@ -174,11 +172,6 @@ pub enum BindingError { Missing, #[error("Visibility flags don't include the shader stage")] Invisible, - #[error("The shader requires the load/store access flags {required:?} but only {allowed:?} is allowed")] - WrongUsage { - required: GlobalUse, - allowed: GlobalUse, - }, #[error("Type on the shader side does not match the pipeline binding")] WrongType, #[error("Storage class {binding:?} doesn't match the shader {shader:?}")] @@ -206,9 +199,9 @@ pub enum BindingError { #[error("Texture format {0:?} is not supported for storage use")] BadStorageFormat(wgt::TextureFormat), #[error( - "Storage texture usage {0:?} doesn't have a matching supported `StorageTextureAccess`" + "Storage texture with access {0:?} doesn't have a matching supported `StorageTextureAccess`" )] - UnsupportedTextureStorageAccess(GlobalUse), + UnsupportedTextureStorageAccess(naga::StorageAccess), } #[derive(Clone, Debug, Error)] @@ -379,34 +372,23 @@ fn map_storage_format_from_naga(format: naga::StorageFormat) -> wgt::TextureForm } impl Resource { - fn check_binding_use( - &self, - entry: &BindGroupLayoutEntry, - shader_usage: GlobalUse, - ) -> Result<(), BindingError> { - let allowed_usage = match self.ty { + fn check_binding_use(&self, entry: &BindGroupLayoutEntry) -> Result<(), BindingError> { + match self.ty { ResourceType::Buffer { size } => { - let (allowed_usage, min_size) = match entry.ty { + let min_size = match entry.ty { BindingType::Buffer { ty, has_dynamic_offset: _, min_binding_size, } => { - let (class, global_use) = match ty { - wgt::BufferBindingType::Uniform => { - (naga::AddressSpace::Uniform, GlobalUse::READ) - } + let class = match ty { + wgt::BufferBindingType::Uniform => naga::AddressSpace::Uniform, wgt::BufferBindingType::Storage { read_only } => { - let mut global_use = GlobalUse::READ | GlobalUse::QUERY; - global_use.set(GlobalUse::WRITE, !read_only); let mut naga_access = naga::StorageAccess::LOAD; naga_access.set(naga::StorageAccess::STORE, !read_only); - ( - naga::AddressSpace::Storage { - access: naga_access, - }, - global_use, - ) + naga::AddressSpace::Storage { + access: naga_access, + } } }; if self.class != class { @@ -415,7 +397,7 @@ impl Resource { shader: self.class, }); } - (global_use, min_binding_size) + min_binding_size } _ => return Err(BindingError::WrongType), }; @@ -425,13 +407,10 @@ impl Resource { } _ => (), } - allowed_usage } ResourceType::Sampler { comparison } => match entry.ty { BindingType::Sampler(ty) => { - if (ty == wgt::SamplerBindingType::Comparison) == comparison { - GlobalUse::READ - } else { + if (ty == wgt::SamplerBindingType::Comparison) != comparison { return Err(BindingError::WrongSamplerComparison); } } @@ -480,29 +459,26 @@ impl Resource { } } } - let (expected_class, usage) = match entry.ty { + let expected_class = match entry.ty { BindingType::Texture { sample_type, view_dimension: _, multisampled: multi, - } => { - let class = match sample_type { - wgt::TextureSampleType::Float { .. } => naga::ImageClass::Sampled { - kind: naga::ScalarKind::Float, - multi, - }, - wgt::TextureSampleType::Sint => naga::ImageClass::Sampled { - kind: naga::ScalarKind::Sint, - multi, - }, - wgt::TextureSampleType::Uint => naga::ImageClass::Sampled { - kind: naga::ScalarKind::Uint, - multi, - }, - wgt::TextureSampleType::Depth => naga::ImageClass::Depth { multi }, - }; - (class, GlobalUse::READ | GlobalUse::QUERY) - } + } => match sample_type { + wgt::TextureSampleType::Float { .. } => naga::ImageClass::Sampled { + kind: naga::ScalarKind::Float, + multi, + }, + wgt::TextureSampleType::Sint => naga::ImageClass::Sampled { + kind: naga::ScalarKind::Sint, + multi, + }, + wgt::TextureSampleType::Uint => naga::ImageClass::Sampled { + kind: naga::ScalarKind::Uint, + multi, + }, + wgt::TextureSampleType::Depth => naga::ImageClass::Depth { multi }, + }, BindingType::StorageTexture { access, format, @@ -510,26 +486,15 @@ impl Resource { } => { let naga_format = map_storage_format_to_naga(format) .ok_or(BindingError::BadStorageFormat(format))?; - let (naga_access, usage) = match access { - wgt::StorageTextureAccess::ReadOnly => ( - naga::StorageAccess::LOAD, - GlobalUse::READ | GlobalUse::QUERY, - ), - wgt::StorageTextureAccess::WriteOnly => ( - naga::StorageAccess::STORE, - GlobalUse::WRITE | GlobalUse::QUERY, - ), - wgt::StorageTextureAccess::ReadWrite => { - (naga::StorageAccess::all(), GlobalUse::all()) - } + let naga_access = match access { + wgt::StorageTextureAccess::ReadOnly => naga::StorageAccess::LOAD, + wgt::StorageTextureAccess::WriteOnly => naga::StorageAccess::STORE, + wgt::StorageTextureAccess::ReadWrite => naga::StorageAccess::all(), }; - ( - naga::ImageClass::Storage { - format: naga_format, - access: naga_access, - }, - usage, - ) + naga::ImageClass::Storage { + format: naga_format, + access: naga_access, + } } _ => return Err(BindingError::WrongType), }; @@ -539,31 +504,19 @@ impl Resource { shader: class, }); } - usage } }; - if allowed_usage.contains(shader_usage) { - Ok(()) - } else { - Err(BindingError::WrongUsage { - required: shader_usage, - allowed: allowed_usage, - }) - } + Ok(()) } - fn derive_binding_type( - &self, - shader_usage: GlobalUse, - features: wgt::Features, - ) -> Result { + fn derive_binding_type(&self) -> Result { Ok(match self.ty { ResourceType::Buffer { size } => BindingType::Buffer { ty: match self.class { naga::AddressSpace::Uniform => wgt::BufferBindingType::Uniform, - naga::AddressSpace::Storage { .. } => wgt::BufferBindingType::Storage { - read_only: !shader_usage.contains(GlobalUse::WRITE), + naga::AddressSpace::Storage { access } => wgt::BufferBindingType::Storage { + read_only: access == naga::StorageAccess::LOAD, }, _ => return Err(BindingError::WrongType), }, @@ -606,19 +559,15 @@ impl Resource { view_dimension, multisampled: multi, }, - naga::ImageClass::Storage { format, .. } => BindingType::StorageTexture { - access: if !shader_usage.contains(GlobalUse::READ) { - wgt::StorageTextureAccess::WriteOnly - } else if !features - .contains(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES) - { - return Err(BindingError::UnsupportedTextureStorageAccess( - shader_usage, - )); - } else if shader_usage.contains(GlobalUse::WRITE) { - wgt::StorageTextureAccess::ReadWrite - } else { - wgt::StorageTextureAccess::ReadOnly + naga::ImageClass::Storage { format, access } => BindingType::StorageTexture { + access: { + const LOAD_STORE: naga::StorageAccess = naga::StorageAccess::all(); + match access { + naga::StorageAccess::LOAD => wgt::StorageTextureAccess::ReadOnly, + naga::StorageAccess::STORE => wgt::StorageTextureAccess::WriteOnly, + LOAD_STORE => wgt::StorageTextureAccess::ReadWrite, + _ => unreachable!(), + } }, view_dimension, format: { @@ -880,12 +829,7 @@ impl Interface { list.push(varying); } - pub fn new( - module: &naga::Module, - info: &naga::valid::ModuleInfo, - features: wgt::Features, - limits: wgt::Limits, - ) -> Self { + pub fn new(module: &naga::Module, info: &naga::valid::ModuleInfo, limits: wgt::Limits) -> Self { let mut resources = naga::Arena::new(); let mut resource_mapping = FastHashMap::default(); for (var_handle, var) in module.global_variables.iter() { @@ -949,11 +893,8 @@ impl Interface { for (var_handle, var) in module.global_variables.iter() { let usage = info[var_handle]; - if usage.is_empty() { - continue; - } - if var.binding.is_some() { - ep.resources.push((resource_mapping[&var_handle], usage)); + if !usage.is_empty() && var.binding.is_some() { + ep.resources.push(resource_mapping[&var_handle]); } } @@ -968,7 +909,6 @@ impl Interface { } Self { - features, limits, resources, entry_points, @@ -1000,7 +940,7 @@ impl Interface { .ok_or(StageError::MissingEntryPoint(pair.1))?; // check resources visibility - for &(handle, usage) in entry_point.resources.iter() { + for &handle in entry_point.resources.iter() { let res = &self.resources[handle]; let result = match given_layouts { Some(layouts) => { @@ -1026,13 +966,13 @@ impl Interface { Err(BindingError::Invisible) } }) - .and_then(|entry| res.check_binding_use(entry, usage)) + .and_then(|entry| res.check_binding_use(entry)) } None => derived_layouts .get_mut(res.bind.group as usize) .ok_or(BindingError::Missing) .and_then(|set| { - let ty = res.derive_binding_type(usage, self.features)?; + let ty = res.derive_binding_type()?; match set.entry(res.bind.binding) { Entry::Occupied(e) if e.get().ty != ty => { return Err(BindingError::InconsistentlyDerivedType) From 0af3734c9d15743ce999613f079090e1ea3dd9c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 23:47:28 -0400 Subject: [PATCH 17/18] Bump serde from 1.0.179 to 1.0.180 (#3996) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd655dd67e..8835c76b5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -159,7 +159,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -277,7 +277,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -915,7 +915,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -1053,7 +1053,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -1832,7 +1832,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -2026,7 +2026,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -2399,9 +2399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.179" +version = "1.0.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5bf42b8d227d4abf38a1ddb08602e229108a517cd4e5bb28f9c7eaafdce5c0" +checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed" dependencies = [ "serde_derive", ] @@ -2417,13 +2417,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.179" +version = "1.0.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" +checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -2621,9 +2621,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.26" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -2656,7 +2656,7 @@ checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -2752,7 +2752,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", ] [[package]] @@ -2962,7 +2962,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -2996,7 +2996,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From 09b010b26af6876ce84991576a168a572172f08d Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 1 Aug 2023 05:47:42 +0200 Subject: [PATCH 18/18] Update Dx12Compiler documentation even more. (#3995) --- wgpu-types/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 180dd095ae..29619210e1 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -6311,7 +6311,7 @@ pub enum Dx12Compiler { Dxc { /// Path to the `dxil.dll` file, or path to the directory containing `dxil.dll` file. Passing `None` will use standard platform specific dll loading rules. dxil_path: Option, - /// Path to the `dxcompiler.dll` file, or path to the directory containing `dxil.dll` file. Passing `None` will use standard platform specific dll loading rules. + /// Path to the `dxcompiler.dll` file, or path to the directory containing `dxcompiler.dll` file. Passing `None` will use standard platform specific dll loading rules. dxc_path: Option, }, }