Upgrade wgpu (#676)

* Use the workaround from

https://github.com/gfx-rs/wgpu/issues/1374#issuecomment-839359307

* Upgrade to wgpu 0.9

We can't remove MPL from the deny.toml yes, as wgpu-subscriber
is still MPL

* swap to env-logger and log in all example paths

This also does let us remove MPL-2.0

As of https://github.com/EmbarkStudios/rust-gpu/pull/674, the crate of the
advisory is no longer in our tree

* Add a workaround for our *erm* strange codegen
This commit is contained in:
Daniel McNab 2021-06-23 11:28:20 +01:00 committed by GitHub
parent 06f0aa2c3a
commit 7974817539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 100 additions and 175 deletions

248
Cargo.lock generated
View File

@ -277,10 +277,8 @@ version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [ dependencies = [
"libc",
"num-integer", "num-integer",
"num-traits", "num-traits",
"winapi",
] ]
[[package]] [[package]]
@ -764,6 +762,15 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "drm-fourcc"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebbf3a5ed4671aabffefce172ff43d69c1f27dd2c6aea28e5212a70f32ada0cf"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "either" name = "either"
version = "1.6.1" version = "1.6.1"
@ -827,6 +834,7 @@ dependencies = [
"clap 3.0.0-beta.2", "clap 3.0.0-beta.2",
"console_error_panic_hook", "console_error_panic_hook",
"console_log", "console_log",
"env_logger",
"futures", "futures",
"ndk-glue", "ndk-glue",
"shared", "shared",
@ -835,7 +843,6 @@ dependencies = [
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
"wgpu", "wgpu",
"wgpu-subscriber",
"winit", "winit",
] ]
@ -846,6 +853,16 @@ dependencies = [
"spirv-builder", "spirv-builder",
] ]
[[package]]
name = "external-memory"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4dfe8d292b014422776a8c516862d2bff8a81b223a4461dfdc45f3862dc9d39"
dependencies = [
"bitflags",
"drm-fourcc",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.14" version = "0.2.14"
@ -854,7 +871,7 @@ checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"redox_syscall 0.2.9", "redox_syscall",
"winapi", "winapi",
] ]
@ -1015,9 +1032,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-auxil" name = "gfx-auxil"
version = "0.9.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ccf8711c9994dfa34337466bee3ae1462e172874c432ce4eb120ab2e98d39cf" checksum = "1694991b11d642680e82075a75c7c2bd75556b805efa7660b705689f05b1ab1c"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -1026,14 +1043,15 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f839f27f8c8a6dc553ccca7f5b35a42009432bc25db9688bba7061cd394161f" checksum = "8f9e453baf3aaef2b0c354ce0b3d63d76402e406a59b64b7182d123cfa6635ae"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"gfx-auxil", "gfx-auxil",
"gfx-hal", "gfx-hal",
"gfx-renderdoc",
"libloading 0.7.0", "libloading 0.7.0",
"log", "log",
"parking_lot", "parking_lot",
@ -1048,9 +1066,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3937738b0da5839bba4e33980d29f9a06dbce184d04a3a08c9a949e7953700e3" checksum = "61f09e9d8c2aa69e9a21eb83c0f5d1a286c6d37da011f796e550d180b08090ce"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -1058,6 +1076,7 @@ dependencies = [
"d3d12", "d3d12",
"gfx-auxil", "gfx-auxil",
"gfx-hal", "gfx-hal",
"gfx-renderdoc",
"log", "log",
"parking_lot", "parking_lot",
"range-alloc", "range-alloc",
@ -1070,9 +1089,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ac55ada4bfcd35479b3421eea324d36d7da5f724e2f66ecb36d4efdb7041a5e" checksum = "29c8f813c47791918aa00dc9c9ddf961d23fa8c2a5d869e6cb8ea84f944820f4"
dependencies = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
@ -1081,9 +1100,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-gl" name = "gfx-backend-gl"
version = "0.8.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0caa03d6e0b7b4f202aea1f20c3f3288cfa06d92d24cea9d69c9a7627967244a" checksum = "6bae057fc3a0ab23ecf97ae51d4017d27d5ddf0aab16ee6dcb58981af88c3152"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -1103,15 +1122,16 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.8.2" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "340895ad544ba46433acb3bdabece0ef16f2dbedc030adbd7c9eaf2839fbed41" checksum = "76c10e91bbe274122a9bf196ac16a57dd2db67cd7c4299eeb962503aebacc013"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"block", "block",
"cocoa-foundation", "cocoa-foundation",
"copyless", "copyless",
"core-graphics-types",
"foreign-types", "foreign-types",
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -1128,15 +1148,16 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a353fc6fdb42ec646de49bbb74e4870e37a7e680caf33f3ac0615c30b1146d94" checksum = "a9861ec855acbbc65c0e4f966d761224886e811dc2c6d413a4776e9293d0e5c0"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
"byteorder", "byteorder",
"core-graphics-types", "core-graphics-types",
"gfx-hal", "gfx-hal",
"gfx-renderdoc",
"inplace_it", "inplace_it",
"log", "log",
"naga", "naga",
@ -1149,16 +1170,28 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d285bfd566f6b9134af908446ca350c0a1047495dfb9bbd826e701e8ee1d259" checksum = "7fbb575ea793dd0507b3082f4f2cde62dc9f3cebd98f5cd49ba2a4da97a976fd"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"external-memory",
"naga", "naga",
"raw-window-handle", "raw-window-handle",
"thiserror", "thiserror",
] ]
[[package]]
name = "gfx-renderdoc"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8027995e247e2426d3a00d13f5191dd56c314bff02dc4b54cbf727f1ba9c40a"
dependencies = [
"libloading 0.7.0",
"log",
"renderdoc-sys",
]
[[package]] [[package]]
name = "glam" name = "glam"
version = "0.16.0" version = "0.16.0"
@ -1441,15 +1474,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "matchers"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
dependencies = [
"regex-automata",
]
[[package]] [[package]]
name = "maybe-uninit" name = "maybe-uninit"
version = "2.0.0" version = "2.0.0"
@ -1482,13 +1506,13 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.22.0" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c12e48c737ee9a55e8bb2352bcde588f79ae308d3529ee888f7cc0f469b5777" checksum = "79d7d769f1c104b8388294d6594d491d2e21240636f5f94d37f8a0f3d7904450"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"block", "block",
"cocoa-foundation", "core-graphics-types",
"foreign-types", "foreign-types",
"log", "log",
"objc", "objc",
@ -1574,9 +1598,9 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.4.2" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8d74f2c7ace793a760165ac0679d6830809ad4e85f6886f72e4f8c4aa4291c5" checksum = "ef670817eef03d356d5a509ea275e7dd3a78ea9e24261ea3cb2dfed1abb08f64"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags",
@ -1585,6 +1609,7 @@ dependencies = [
"log", "log",
"num-traits", "num-traits",
"petgraph", "petgraph",
"rose_tree",
"spirv_headers 1.5.0", "spirv_headers 1.5.0",
"thiserror", "thiserror",
] ]
@ -1789,7 +1814,7 @@ checksum = "0c976c5018e7f1db4359616d8b31ef8ae7d9649b11803c0b38fff67fd2999fc8"
dependencies = [ dependencies = [
"libc", "libc",
"raw-window-handle", "raw-window-handle",
"redox_syscall 0.2.9", "redox_syscall",
"sdl2", "sdl2",
"sdl2-sys", "sdl2-sys",
"wasm-bindgen", "wasm-bindgen",
@ -1840,7 +1865,7 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"instant", "instant",
"libc", "libc",
"redox_syscall 0.2.9", "redox_syscall",
"smallvec", "smallvec",
"winapi", "winapi",
] ]
@ -2081,12 +2106,6 @@ dependencies = [
"num_cpus", "num_cpus",
] ]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.9" version = "0.2.9"
@ -2103,7 +2122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"redox_syscall 0.2.9", "redox_syscall",
] ]
[[package]] [[package]]
@ -2117,15 +2136,6 @@ dependencies = [
"regex-syntax", "regex-syntax",
] ]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax",
]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.25" version = "0.6.25"
@ -2141,6 +2151,21 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "renderdoc-sys"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
[[package]]
name = "rose_tree"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284de9dae38774e2813aaabd7e947b4a6fe9b8c58c2309f754a487cdd50de1c2"
dependencies = [
"petgraph",
]
[[package]] [[package]]
name = "rspirv" name = "rspirv"
version = "0.8.0" version = "0.8.0"
@ -2318,15 +2343,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "sharded-slab"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "shared" name = "shared"
version = "0.4.0-alpha.10" version = "0.4.0-alpha.10"
@ -2585,7 +2601,7 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"rand", "rand",
"redox_syscall 0.2.9", "redox_syscall",
"remove_dir_all", "remove_dir_all",
"winapi", "winapi",
] ]
@ -2661,26 +2677,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "thread-id"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1"
dependencies = [
"libc",
"redox_syscall 0.1.57",
"winapi",
]
[[package]]
name = "thread_local"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "thunderdome" name = "thunderdome"
version = "0.4.1" version = "0.4.1"
@ -2702,69 +2698,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c"
[[package]]
name = "tracing"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d"
dependencies = [
"cfg-if 1.0.0",
"pin-project-lite",
"tracing-core",
]
[[package]]
name = "tracing-core"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052"
dependencies = [
"lazy_static",
]
[[package]]
name = "tracing-log"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3"
dependencies = [
"lazy_static",
"log",
"tracing-core",
]
[[package]]
name = "tracing-serde"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b"
dependencies = [
"serde",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa5553bf0883ba7c9cbe493b085c29926bd41b66afc31ff72cf17ff4fb60dcd5"
dependencies = [
"ansi_term 0.12.1",
"chrono",
"lazy_static",
"matchers",
"regex",
"serde",
"serde_json",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
"tracing-serde",
]
[[package]] [[package]]
name = "ttf-parser" name = "ttf-parser"
version = "0.6.2" version = "0.6.2"
@ -2986,9 +2919,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.8.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "215fd50e66f794bd16683e7e0e0b9b53be265eb10fdf02276caf5de3e5743fcf" checksum = "bd247f8b26fd3d42ef2f320d378025cd6e84d782ef749fab45cc3b981fbe3275"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"js-sys", "js-sys",
@ -3006,9 +2939,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.8.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d56c368fc0e6f3927c711d2b55a51ad4321218efc0239c4acf69e456ab70399" checksum = "2af5c8acd3ae5781a277cdf65a17f3a7135de5ae782775620e74ea16c9d47770"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -3034,24 +2967,11 @@ dependencies = [
"wgpu-types", "wgpu-types",
] ]
[[package]]
name = "wgpu-subscriber"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91955b0d6480d86e577bbd0b0d1dd5acd0699c054610dc8673c4c3366295ed27"
dependencies = [
"parking_lot",
"thread-id",
"tracing",
"tracing-log",
"tracing-subscriber",
]
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa248d90c8e6832269b8955bf800e8241f942c25e18a235b7752226804d21556" checksum = "4f5c9678cd533558e28b416d66947b099742df1939307478db54f867137f1b60"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]

View File

@ -6,11 +6,7 @@ vulnerability = "deny"
unmaintained = "warn" unmaintained = "warn"
yanked = "warn" yanked = "warn"
notice = "warn" notice = "warn"
ignore = [ ignore = []
# net2 is deprecated in favor of socket2
# but hyper, mio, miow crates are still using net2
"RUSTSEC-2020-0016",
]
# This section is considered when running `cargo deny check bans`. # This section is considered when running `cargo deny check bans`.
# More documentation about the 'bans' section can be found here: # More documentation about the 'bans' section can be found here:
@ -59,7 +55,7 @@ allow = [
"BSD-2-Clause", "BSD-2-Clause",
"BSD-3-Clause", "BSD-3-Clause",
"ISC", "ISC",
"MPL-2.0",
"Zlib", "Zlib",
] ]
# Allow 1 or more licenses on a per-crate basis, so that particular licenses # Allow 1 or more licenses on a per-crate basis, so that particular licenses

View File

@ -19,7 +19,7 @@ use-compiled-tools = ["spirv-builder/use-compiled-tools"]
cfg-if = "1.0.0" cfg-if = "1.0.0"
shared = { path = "../../shaders/shared" } shared = { path = "../../shaders/shared" }
futures = { version = "0.3", default-features = false, features = ["std", "executor"] } futures = { version = "0.3", default-features = false, features = ["std", "executor"] }
wgpu = "0.8.1" wgpu = "0.9"
winit = { version = "0.25.0", features = ["web-sys"] } winit = { version = "0.25.0", features = ["web-sys"] }
clap = "3.0.0-beta.2" clap = "3.0.0-beta.2"
strum = { version = "0.21.0", default_features = false, features = ["derive"] } strum = { version = "0.21.0", default_features = false, features = ["derive"] }
@ -32,7 +32,7 @@ spirv-builder = { path = "../../../crates/spirv-builder", default-features = fal
ndk-glue = "0.3" ndk-glue = "0.3"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wgpu-subscriber = "0.1.0" env_logger = "0.8.4"
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = "=0.3.50" web-sys = "=0.3.50"

View File

@ -113,8 +113,9 @@ pub async fn start_internal(
label: Some("Timestamps buffer"), label: Some("Timestamps buffer"),
size: 16, size: 16,
usage: wgpu::BufferUsage::MAP_READ | wgpu::BufferUsage::COPY_DST, usage: wgpu::BufferUsage::MAP_READ | wgpu::BufferUsage::COPY_DST,
mapped_at_creation: false, mapped_at_creation: true,
}); });
timestamp_buffer.unmap();
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: None, label: None,

View File

@ -343,7 +343,6 @@ pub fn start(options: &Options) {
initial_shader, initial_shader,
)); ));
} else { } else {
wgpu_subscriber::initialize_default_subscriber(None);
futures::executor::block_on(run( futures::executor::block_on(run(
event_loop, event_loop,
window, window,

View File

@ -169,6 +169,7 @@ pub struct Options {
#[cfg_attr(target_os = "android", ndk_glue::main(backtrace = "on"))] #[cfg_attr(target_os = "android", ndk_glue::main(backtrace = "on"))]
pub fn main() { pub fn main() {
env_logger::init();
let options: Options = Options::parse(); let options: Options = Options::parse();
if is_compute_shader(options.shader) { if is_compute_shader(options.shader) {

View File

@ -44,5 +44,13 @@ pub fn main_cs(
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] prime_indices: &mut [u32], #[spirv(storage_buffer, descriptor_set = 0, binding = 0)] prime_indices: &mut [u32],
) { ) {
let index = id.x as usize; let index = id.x as usize;
prime_indices[index] = collatz(prime_indices[index]).unwrap_or(u32::MAX); prime_indices[index] = unwrap_or_max(collatz(prime_indices[index]));
}
// Work around https://github.com/EmbarkStudios/rust-gpu/issues/677
fn unwrap_or_max(option: Option<u32>) -> u32 {
match option {
Some(inner) => inner,
None => u32::MAX,
}
} }