diff --git a/Cargo.lock b/Cargo.lock index 0c653df2..4953f9a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -98,7 +98,7 @@ version = "0.37.2+1.3.238" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28bf19c1f0a470be5fbf7522a308a05df06610252c5bcf5143e1b23f629a9a03" dependencies = [ - "libloading", + "libloading 0.7.3", ] [[package]] @@ -272,6 +272,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" + [[package]] name = "block" version = "0.1.6" @@ -409,7 +415,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", @@ -425,7 +431,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", @@ -527,7 +533,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types 0.3.2", @@ -540,7 +546,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "foreign-types 0.3.2", "libc", @@ -705,8 +711,8 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" dependencies = [ - "bitflags", - "libloading", + "bitflags 1.3.2", + "libloading 0.7.3", "winapi", ] @@ -763,7 +769,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" dependencies = [ - "libloading", + "libloading 0.7.3", ] [[package]] @@ -989,7 +995,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "freetype-sys", "libc", ] @@ -1082,15 +1088,6 @@ dependencies = [ "pin-utils", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "getrandom" version = "0.2.7" @@ -1159,9 +1156,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8edf6019dff2d92ad27c1e3ff82ad50a0aea5b01370353cc928bfdc33e95925c" +checksum = "807edf58b70c0b5b2181dd39fe1839dbdb3ba02645630dc5f753e23da307f762" dependencies = [ "js-sys", "slotmap", @@ -1175,7 +1172,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gpu-alloc-types", ] @@ -1185,14 +1182,14 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "gpu-allocator" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434618454f74b63f9b39328298097256977c41ea0ba9d75a47238b77790b6163" +checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" dependencies = [ "backtrace", "log", @@ -1207,7 +1204,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gpu-descriptor-types", "hashbrown", ] @@ -1218,7 +1215,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1260,14 +1257,14 @@ dependencies = [ [[package]] name = "hassle-rs" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90601c6189668c7345fc53842cb3f3a3d872203d523be1b3cb44a36a3e62fb85" +checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "com-rs", "libc", - "libloading", + "libloading 0.7.3", "thiserror", "widestring", "winapi", @@ -1450,9 +1447,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -1521,9 +1518,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -1535,7 +1532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" dependencies = [ "libc", - "libloading", + "libloading 0.7.3", "pkg-config", ] @@ -1582,6 +1579,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "link-cplusplus" version = "1.0.7" @@ -1675,7 +1682,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-graphics-types", "foreign-types 0.3.2", @@ -1758,7 +1765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f50357e1167a3ab92d6b3c7f4bf5f7fd13fde3f4b28bf0d5ea07b5100fdb6c0" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "indexmap", "log", "num-traits", @@ -1771,12 +1778,12 @@ dependencies = [ [[package]] name = "naga" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eafe22a23b797c9bc227c6c896419b26b5bb88fa903417a3adaed08778850d5" +checksum = "80cd00bd6180a8790f1c020ed258a46b8d73dd5bd6af104a238c9d71f806938e" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "codespan-reporting", "hexf-parse", "indexmap", @@ -1823,7 +1830,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "jni-sys", "ndk-sys", "num_enum", @@ -1881,7 +1888,7 @@ version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset", @@ -1998,7 +2005,7 @@ version = "0.10.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types 0.3.2", "libc", @@ -2157,7 +2164,7 @@ version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f0e7f4c94ec26ff209cee506314212639d6c91b80afb82984819fafce9df01c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "flate2", "miniz_oxide 0.5.4", @@ -2287,7 +2294,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2327,9 +2334,9 @@ dependencies = [ [[package]] name = "renderdoc-sys" -version = "0.7.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" +checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" [[package]] name = "reqwest" @@ -2402,7 +2409,7 @@ version = "0.36.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -2483,7 +2490,7 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -2624,7 +2631,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ - "bitflags", + "bitflags 1.3.2", "calloop", "dlib", "lazy_static", @@ -2670,7 +2677,7 @@ version = "0.2.0+1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" dependencies = [ - "bitflags", + "bitflags 1.3.2", "num-traits", ] @@ -3472,9 +3479,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -3594,7 +3601,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "libc", "nix", @@ -3633,7 +3640,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-client", "wayland-commons", "wayland-scanner", @@ -3663,9 +3670,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -3688,15 +3695,15 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d14c6bfcf3b10f4273f522a95994553c0a5f2934976e62e61a720ae4bc2eb8f2" +checksum = "3059ea4ddec41ca14f356833e2af65e7e38c0a8f91273867ed526fb9bafcca95" dependencies = [ "arrayvec 0.7.2", "cfg-if", "js-sys", "log", - "naga 0.11.0", + "naga 0.12.2", "parking_lot 0.12.1", "profiling", "raw-window-handle 0.5.0", @@ -3712,20 +3719,20 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f61be28e557a6ecb2506cac06c63fae3b6d302a006f38195a7a80995abeb9" +checksum = "8f478237b4bf0d5b70a39898a66fa67ca3a007d79f2520485b8b0c3dfc46f8c2" dependencies = [ "arrayvec 0.7.2", "bit-vec", - "bitflags", + "bitflags 2.3.1", "codespan-reporting", - "fxhash", "log", - "naga 0.11.0", + "naga 0.12.2", "parking_lot 0.12.1", "profiling", "raw-window-handle 0.5.0", + "rustc-hash", "smallvec", "thiserror", "web-sys", @@ -3735,20 +3742,19 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.15.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e95792925fe3d58950b9a5c2a191caa145e2bc570e2d233f0d7320f6a8e814" +checksum = "74851c2c8e5d97652e74c241d41b0656b31c924a45dcdecde83975717362cfa4" dependencies = [ "android_system_properties", "arrayvec 0.7.2", "ash", "bit-set", - "bitflags", + "bitflags 2.3.1", "block", "core-graphics-types", "d3d12", "foreign-types 0.3.2", - "fxhash", "glow", "gpu-alloc", "gpu-allocator", @@ -3757,16 +3763,17 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading", + "libloading 0.8.0", "log", "metal", - "naga 0.11.0", + "naga 0.12.2", "objc", "parking_lot 0.12.1", "profiling", "range-alloc", "raw-window-handle 0.5.0", "renderdoc-sys", + "rustc-hash", "smallvec", "thiserror", "wasm-bindgen", @@ -3790,20 +3797,20 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf8cfcbf98f94cc8bd5981544c687140cf9d3948e2ab83849367ead2cd737cf" +checksum = "5bd33a976130f03dcdcd39b3810c0c3fc05daf86f0aaf867db14bfb7c4a9a32b" dependencies = [ - "bitflags", + "bitflags 2.3.1", "js-sys", "web-sys", ] [[package]] name = "widestring" -version = "0.5.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" @@ -3849,17 +3856,11 @@ dependencies = [ [[package]] name = "windows" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows-targets 0.42.2", ] [[package]] @@ -3881,20 +3882,65 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "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]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "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]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" @@ -3904,9 +3950,15 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" @@ -3916,9 +3968,15 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" @@ -3928,9 +3986,15 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" @@ -3940,15 +4004,27 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" @@ -3958,9 +4034,15 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winit" @@ -3968,7 +4050,7 @@ version = "0.27.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37f64802920c4c35d12a53dad5e0c55bbc3004d8dc4f2e4dd64ad02c5665d7aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cocoa", "core-foundation", "core-graphics", diff --git a/code/beginner/tutorial1-window/Cargo.toml b/code/beginner/tutorial1-window/Cargo.toml index faab06b5..d113a45e 100644 --- a/code/beginner/tutorial1-window/Cargo.toml +++ b/code/beginner/tutorial1-window/Cargo.toml @@ -16,13 +16,13 @@ cfg-if = "1" winit = "0.27" env_logger = "0.10" log = "0.4" -wgpu = "0.15" +wgpu = "0.16" pollster = "0.2" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.6" console_log = "0.2.0" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "=0.2.84" wasm-bindgen-futures = "0.4.30" web-sys = { version = "0.3.53", features = [ diff --git a/code/beginner/tutorial1-window/src/lib.rs b/code/beginner/tutorial1-window/src/lib.rs index 2ac752d4..7d9595d2 100644 --- a/code/beginner/tutorial1-window/src/lib.rs +++ b/code/beginner/tutorial1-window/src/lib.rs @@ -4,10 +4,10 @@ use winit::{ window::WindowBuilder, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -19,9 +19,7 @@ pub fn run() { } let event_loop = EventLoop::new(); - let window = WindowBuilder::new() - .build(&event_loop) - .unwrap(); + let window = WindowBuilder::new().build(&event_loop).unwrap(); #[cfg(target_arch = "wasm32")] { @@ -29,7 +27,7 @@ pub fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) diff --git a/code/beginner/tutorial1-window/src/main.rs b/code/beginner/tutorial1-window/src/main.rs index 7d702ffd..ef731b5d 100644 --- a/code/beginner/tutorial1-window/src/main.rs +++ b/code/beginner/tutorial1-window/src/main.rs @@ -2,4 +2,4 @@ use tutorial1_window::run; fn main() { run(); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial2-surface/Cargo.toml b/code/beginner/tutorial2-surface/Cargo.toml index 8dcc9a30..bf2cd661 100644 --- a/code/beginner/tutorial2-surface/Cargo.toml +++ b/code/beginner/tutorial2-surface/Cargo.toml @@ -12,13 +12,13 @@ cfg-if = "1" winit = "0.27" env_logger = "0.10" log = "0.4" -wgpu = "0.15" +wgpu = "0.16" pollster = "0.2" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.6" console_log = "0.2.0" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial2-surface/src/challenge.rs b/code/beginner/tutorial2-surface/src/challenge.rs index 890d496b..60045b30 100644 --- a/code/beginner/tutorial2-surface/src/challenge.rs +++ b/code/beginner/tutorial2-surface/src/challenge.rs @@ -30,7 +30,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -68,9 +68,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -208,7 +210,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial2-surface/src/lib.rs b/code/beginner/tutorial2-surface/src/lib.rs index 98587f26..dca003aa 100644 --- a/code/beginner/tutorial2-surface/src/lib.rs +++ b/code/beginner/tutorial2-surface/src/lib.rs @@ -34,7 +34,7 @@ impl State { // The surface needs to live as long as the window that created it. // State owns the window so this should be safe. let surface = unsafe { instance.create_surface(&window) }.unwrap(); - + let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::default(), @@ -67,9 +67,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -222,10 +224,12 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, - + Err(wgpu::SurfaceError::Timeout) => log::warn!("Surface timeout"), } } diff --git a/code/beginner/tutorial2-surface/src/main.rs b/code/beginner/tutorial2-surface/src/main.rs index af60590e..9a267666 100644 --- a/code/beginner/tutorial2-surface/src/main.rs +++ b/code/beginner/tutorial2-surface/src/main.rs @@ -2,4 +2,4 @@ use tutorial2_surface::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial3-pipeline/Cargo.toml b/code/beginner/tutorial3-pipeline/Cargo.toml index 9e7a2e2a..8b29c9d0 100644 --- a/code/beginner/tutorial3-pipeline/Cargo.toml +++ b/code/beginner/tutorial3-pipeline/Cargo.toml @@ -12,13 +12,13 @@ cfg-if = "1" winit = "0.27" env_logger = "0.10" log = "0.4" -wgpu = "0.15" +wgpu = "0.16" pollster = "0.2" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.6" console_log = "0.2.0" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial3-pipeline/src/challenge.rs b/code/beginner/tutorial3-pipeline/src/challenge.rs index 48871a76..88721822 100644 --- a/code/beginner/tutorial3-pipeline/src/challenge.rs +++ b/code/beginner/tutorial3-pipeline/src/challenge.rs @@ -28,7 +28,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -66,9 +66,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -320,7 +322,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial3-pipeline/src/lib.rs b/code/beginner/tutorial3-pipeline/src/lib.rs index 73553f2e..95341fdb 100644 --- a/code/beginner/tutorial3-pipeline/src/lib.rs +++ b/code/beginner/tutorial3-pipeline/src/lib.rs @@ -6,7 +6,7 @@ use winit::{ window::{Window, WindowBuilder}, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; struct State { @@ -30,7 +30,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -68,9 +68,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -212,7 +214,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -232,7 +234,7 @@ pub async fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -244,7 +246,7 @@ pub async fn run() { }) .expect("Couldn't append canvas to document body."); } - + // State::new uses async code, so we're going to wait for it to finish let mut state = State::new(window).await; @@ -282,7 +284,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial3-pipeline/src/main.rs b/code/beginner/tutorial3-pipeline/src/main.rs index 4be6a898..60df2667 100644 --- a/code/beginner/tutorial3-pipeline/src/main.rs +++ b/code/beginner/tutorial3-pipeline/src/main.rs @@ -2,4 +2,4 @@ use tutorial3_pipeline::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial4-buffer/Cargo.toml b/code/beginner/tutorial4-buffer/Cargo.toml index 5c89c041..1dafca30 100644 --- a/code/beginner/tutorial4-buffer/Cargo.toml +++ b/code/beginner/tutorial4-buffer/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] cfg-if = "1" winit = "0.27" -wgpu = "0.15" +wgpu = "0.16" env_logger = "0.10" log = "0.4" pollster = "0.2" @@ -21,7 +21,7 @@ bytemuck = { version = "1.12", features = [ "derive" ] } [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial4-buffer/src/challenge.rs b/code/beginner/tutorial4-buffer/src/challenge.rs index efa51d82..a6dd4d60 100644 --- a/code/beginner/tutorial4-buffer/src/challenge.rs +++ b/code/beginner/tutorial4-buffer/src/challenge.rs @@ -91,7 +91,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -129,9 +129,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -397,7 +399,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial4-buffer/src/lib.rs b/code/beginner/tutorial4-buffer/src/lib.rs index cf254da3..3475034f 100644 --- a/code/beginner/tutorial4-buffer/src/lib.rs +++ b/code/beginner/tutorial4-buffer/src/lib.rs @@ -7,7 +7,7 @@ use winit::{ window::{Window, WindowBuilder}, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; #[repr(C)] @@ -87,7 +87,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -125,9 +125,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -286,7 +288,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -306,7 +308,7 @@ pub async fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -356,7 +358,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial4-buffer/src/main.rs b/code/beginner/tutorial4-buffer/src/main.rs index 6cfe71a9..d204f1d5 100644 --- a/code/beginner/tutorial4-buffer/src/main.rs +++ b/code/beginner/tutorial4-buffer/src/main.rs @@ -2,4 +2,4 @@ use tutorial4_buffer::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial5-textures/Cargo.toml b/code/beginner/tutorial5-textures/Cargo.toml index 69757f7f..3e75e826 100644 --- a/code/beginner/tutorial5-textures/Cargo.toml +++ b/code/beginner/tutorial5-textures/Cargo.toml @@ -14,7 +14,7 @@ bytemuck = { version = "1.12", features = [ "derive" ] } env_logger = "0.10" log = "0.4" pollster = "0.2" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" [dependencies.image] @@ -25,7 +25,7 @@ features = ["png", "jpeg"] [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial5-textures/src/challenge.rs b/code/beginner/tutorial5-textures/src/challenge.rs index d9c28db4..26765def 100644 --- a/code/beginner/tutorial5-textures/src/challenge.rs +++ b/code/beginner/tutorial5-textures/src/challenge.rs @@ -93,7 +93,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -130,9 +130,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -424,7 +426,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial5-textures/src/lib.rs b/code/beginner/tutorial5-textures/src/lib.rs index ca86973c..8a5b5542 100644 --- a/code/beginner/tutorial5-textures/src/lib.rs +++ b/code/beginner/tutorial5-textures/src/lib.rs @@ -7,7 +7,7 @@ use winit::{ window::{Window, WindowBuilder}, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod texture; @@ -93,7 +93,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -130,9 +130,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -336,7 +338,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -356,7 +358,7 @@ pub async fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -368,7 +370,7 @@ pub async fn run() { }) .expect("Couldn't append canvas to document body."); } - + // State::new uses async code, so we're going to wait for it to finish let mut state = State::new(window).await; @@ -406,7 +408,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial5-textures/src/main.rs b/code/beginner/tutorial5-textures/src/main.rs index 0a0a9594..60b8b4f6 100644 --- a/code/beginner/tutorial5-textures/src/main.rs +++ b/code/beginner/tutorial5-textures/src/main.rs @@ -2,4 +2,4 @@ use tutorial5_textures::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial5-textures/src/texture.rs b/code/beginner/tutorial5-textures/src/texture.rs index e51c0885..1c639b6b 100644 --- a/code/beginner/tutorial5-textures/src/texture.rs +++ b/code/beginner/tutorial5-textures/src/texture.rs @@ -56,8 +56,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/beginner/tutorial6-uniforms/Cargo.toml b/code/beginner/tutorial6-uniforms/Cargo.toml index 9e2fdeec..564b3ccf 100644 --- a/code/beginner/tutorial6-uniforms/Cargo.toml +++ b/code/beginner/tutorial6-uniforms/Cargo.toml @@ -15,7 +15,7 @@ cgmath = "0.18" env_logger = "0.10" log = "0.4" pollster = "0.2" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" [dependencies.image] @@ -26,7 +26,7 @@ features = ["png", "jpeg"] [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial6-uniforms/src/challenge.rs b/code/beginner/tutorial6-uniforms/src/challenge.rs index 74ac5c08..f4050037 100644 --- a/code/beginner/tutorial6-uniforms/src/challenge.rs +++ b/code/beginner/tutorial6-uniforms/src/challenge.rs @@ -243,7 +243,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -280,9 +280,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -595,7 +597,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial6-uniforms/src/lib.rs b/code/beginner/tutorial6-uniforms/src/lib.rs index 1e6d599f..d5856b71 100644 --- a/code/beginner/tutorial6-uniforms/src/lib.rs +++ b/code/beginner/tutorial6-uniforms/src/lib.rs @@ -7,7 +7,7 @@ use winit::{ window::{Window, WindowBuilder}, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod texture; @@ -243,7 +243,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -280,9 +280,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -545,7 +547,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -565,7 +567,7 @@ pub async fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -615,7 +617,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial6-uniforms/src/main.rs b/code/beginner/tutorial6-uniforms/src/main.rs index 6e79c5f2..1751f862 100644 --- a/code/beginner/tutorial6-uniforms/src/main.rs +++ b/code/beginner/tutorial6-uniforms/src/main.rs @@ -2,4 +2,4 @@ use tutorial6_uniforms::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial6-uniforms/src/texture.rs b/code/beginner/tutorial6-uniforms/src/texture.rs index e51c0885..1c639b6b 100644 --- a/code/beginner/tutorial6-uniforms/src/texture.rs +++ b/code/beginner/tutorial6-uniforms/src/texture.rs @@ -56,8 +56,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/beginner/tutorial7-instancing/Cargo.toml b/code/beginner/tutorial7-instancing/Cargo.toml index dc6217b1..737a50a5 100644 --- a/code/beginner/tutorial7-instancing/Cargo.toml +++ b/code/beginner/tutorial7-instancing/Cargo.toml @@ -15,7 +15,7 @@ cgmath = "0.18" env_logger = "0.10" log = "0.4" pollster = "0.2" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" [dependencies.image] @@ -26,7 +26,7 @@ features = ["png", "jpeg"] [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial7-instancing/src/challenge.rs b/code/beginner/tutorial7-instancing/src/challenge.rs index af9f9bc5..3419e3a3 100644 --- a/code/beginner/tutorial7-instancing/src/challenge.rs +++ b/code/beginner/tutorial7-instancing/src/challenge.rs @@ -297,7 +297,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -334,9 +334,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -696,7 +698,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial7-instancing/src/lib.rs b/code/beginner/tutorial7-instancing/src/lib.rs index a637c529..3220595a 100644 --- a/code/beginner/tutorial7-instancing/src/lib.rs +++ b/code/beginner/tutorial7-instancing/src/lib.rs @@ -8,7 +8,7 @@ use winit::{ window::{Window, WindowBuilder}, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod texture; @@ -304,7 +304,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -341,9 +341,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -663,7 +665,7 @@ pub async fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -713,7 +715,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial7-instancing/src/main.rs b/code/beginner/tutorial7-instancing/src/main.rs index eeafa71a..4f96958e 100644 --- a/code/beginner/tutorial7-instancing/src/main.rs +++ b/code/beginner/tutorial7-instancing/src/main.rs @@ -2,4 +2,4 @@ use tutorial7_instancing::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial7-instancing/src/texture.rs b/code/beginner/tutorial7-instancing/src/texture.rs index e51c0885..1c639b6b 100644 --- a/code/beginner/tutorial7-instancing/src/texture.rs +++ b/code/beginner/tutorial7-instancing/src/texture.rs @@ -56,8 +56,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/beginner/tutorial8-depth/Cargo.toml b/code/beginner/tutorial8-depth/Cargo.toml index 3fe536a8..8f3b63c1 100644 --- a/code/beginner/tutorial8-depth/Cargo.toml +++ b/code/beginner/tutorial8-depth/Cargo.toml @@ -15,7 +15,7 @@ cgmath = "0.18" env_logger = "0.10" pollster = "0.2" log = "0.4" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" [dependencies.image] @@ -26,7 +26,7 @@ features = ["png", "jpeg"] [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial8-depth/src/challenge.rs b/code/beginner/tutorial8-depth/src/challenge.rs index 101e8fa6..dbae5328 100644 --- a/code/beginner/tutorial8-depth/src/challenge.rs +++ b/code/beginner/tutorial8-depth/src/challenge.rs @@ -1,7 +1,7 @@ use std::iter; use cgmath::prelude::*; -use wgpu::{include_spirv_raw}; +use wgpu::include_spirv_raw; use wgpu::util::DeviceExt; use winit::{ event::*, @@ -296,7 +296,11 @@ struct DepthPass { impl DepthPass { fn new(device: &wgpu::Device, config: &wgpu::SurfaceConfiguration) -> Self { - let texture = texture::Texture::create_depth_texture_non_comparison_sampler(device, config, "depth_texture"); + let texture = texture::Texture::create_depth_texture_non_comparison_sampler( + device, + config, + "depth_texture", + ); let layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { label: Some("Depth Pass Layout"), @@ -413,7 +417,11 @@ impl DepthPass { } fn resize(&mut self, device: &wgpu::Device, config: &wgpu::SurfaceConfiguration) { - self.texture = texture::Texture::create_depth_texture_non_comparison_sampler(device, config, "depth_texture"); + self.texture = texture::Texture::create_depth_texture_non_comparison_sampler( + device, + config, + "depth_texture", + ); self.bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { layout: &self.layout, entries: &[ @@ -486,7 +494,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -523,9 +531,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -893,7 +903,9 @@ async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial8-depth/src/lib.rs b/code/beginner/tutorial8-depth/src/lib.rs index a4ba5b49..1709a08e 100644 --- a/code/beginner/tutorial8-depth/src/lib.rs +++ b/code/beginner/tutorial8-depth/src/lib.rs @@ -8,7 +8,7 @@ use winit::{ window::{Window, WindowBuilder}, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod texture; @@ -314,7 +314,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -351,9 +351,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -670,7 +672,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -690,7 +692,7 @@ pub async fn run() { // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -702,7 +704,7 @@ pub async fn run() { }) .expect("Couldn't append canvas to document body."); } - + // State::new uses async code, so we're going to wait for it to finish let mut state = State::new(window).await; @@ -740,7 +742,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial8-depth/src/main.rs b/code/beginner/tutorial8-depth/src/main.rs index ad085e68..051add52 100644 --- a/code/beginner/tutorial8-depth/src/main.rs +++ b/code/beginner/tutorial8-depth/src/main.rs @@ -2,4 +2,4 @@ use tutorial8_depth::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial8-depth/src/texture.rs b/code/beginner/tutorial8-depth/src/texture.rs index 490f0541..1e5dbfdc 100644 --- a/code/beginner/tutorial8-depth/src/texture.rs +++ b/code/beginner/tutorial8-depth/src/texture.rs @@ -142,8 +142,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/beginner/tutorial9-models/Cargo.toml b/code/beginner/tutorial9-models/Cargo.toml index 8e5f6d72..945ccc69 100644 --- a/code/beginner/tutorial9-models/Cargo.toml +++ b/code/beginner/tutorial9-models/Cargo.toml @@ -16,7 +16,7 @@ env_logger = "0.10" pollster = "0.2" log = "0.4" tobj = { version = "3.2", features = ["async"]} -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" [dependencies.image] @@ -28,7 +28,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/beginner/tutorial9-models/src/lib.rs b/code/beginner/tutorial9-models/src/lib.rs index a96fe206..35894543 100644 --- a/code/beginner/tutorial9-models/src/lib.rs +++ b/code/beginner/tutorial9-models/src/lib.rs @@ -8,12 +8,12 @@ use winit::{ window::Window, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod model; -mod texture; mod resources; +mod texture; use model::{DrawModel, Vertex}; @@ -254,7 +254,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -294,9 +294,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -408,12 +410,10 @@ impl State { }); log::warn!("Load model"); - let obj_model = resources::load_model( - "cube.obj", - &device, - &queue, - &texture_bind_group_layout, - ).await.unwrap(); + let obj_model = + resources::load_model("cube.obj", &device, &queue, &texture_bind_group_layout) + .await + .unwrap(); let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("shader.wgsl"), @@ -583,7 +583,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -601,14 +601,13 @@ pub async fn run() { .build(&event_loop) .unwrap(); - #[cfg(target_arch = "wasm32")] { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -659,7 +658,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/beginner/tutorial9-models/src/main.rs b/code/beginner/tutorial9-models/src/main.rs index adb476a6..6aa74946 100644 --- a/code/beginner/tutorial9-models/src/main.rs +++ b/code/beginner/tutorial9-models/src/main.rs @@ -2,4 +2,4 @@ use tutorial9_models::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/beginner/tutorial9-models/src/texture.rs b/code/beginner/tutorial9-models/src/texture.rs index adf2cdbe..9727d225 100644 --- a/code/beginner/tutorial9-models/src/texture.rs +++ b/code/beginner/tutorial9-models/src/texture.rs @@ -100,8 +100,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/intermediate/tutorial10-lighting/Cargo.toml b/code/intermediate/tutorial10-lighting/Cargo.toml index 9ac6e887..7167d0aa 100644 --- a/code/intermediate/tutorial10-lighting/Cargo.toml +++ b/code/intermediate/tutorial10-lighting/Cargo.toml @@ -16,7 +16,7 @@ env_logger = "0.10" pollster = "0.2" log = "0.4" tobj = { version = "3.2", features = ["async"]} -wgpu = { version = "0.15"} +wgpu = { version = "0.16"} winit = "0.27" [dependencies.image] @@ -28,7 +28,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/intermediate/tutorial10-lighting/src/lib.rs b/code/intermediate/tutorial10-lighting/src/lib.rs index 7b01abdc..09d13082 100644 --- a/code/intermediate/tutorial10-lighting/src/lib.rs +++ b/code/intermediate/tutorial10-lighting/src/lib.rs @@ -8,7 +8,7 @@ use winit::{ window::Window, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod model; @@ -349,7 +349,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -386,9 +386,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -500,12 +502,10 @@ impl State { label: Some("camera_bind_group"), }); - let obj_model = resources::load_model( - "cube.obj", - &device, - &queue, - &texture_bind_group_layout, - ).await.unwrap(); + let obj_model = + resources::load_model("cube.obj", &device, &queue, &texture_bind_group_layout) + .await + .unwrap(); let light_uniform = LightUniform { position: [2.0, 2.0, 2.0], @@ -720,7 +720,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -738,14 +738,13 @@ pub async fn run() { .build(&event_loop) .unwrap(); - #[cfg(target_arch = "wasm32")] { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -799,7 +798,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/intermediate/tutorial10-lighting/src/main.rs b/code/intermediate/tutorial10-lighting/src/main.rs index 5c7c8096..cc96706f 100644 --- a/code/intermediate/tutorial10-lighting/src/main.rs +++ b/code/intermediate/tutorial10-lighting/src/main.rs @@ -2,4 +2,4 @@ use tutorial10_lighting::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/intermediate/tutorial10-lighting/src/model.rs b/code/intermediate/tutorial10-lighting/src/model.rs index cb3d39ca..dddda381 100644 --- a/code/intermediate/tutorial10-lighting/src/model.rs +++ b/code/intermediate/tutorial10-lighting/src/model.rs @@ -140,7 +140,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -218,7 +224,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/intermediate/tutorial10-lighting/src/texture.rs b/code/intermediate/tutorial10-lighting/src/texture.rs index adf2cdbe..9727d225 100644 --- a/code/intermediate/tutorial10-lighting/src/texture.rs +++ b/code/intermediate/tutorial10-lighting/src/texture.rs @@ -100,8 +100,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/intermediate/tutorial11-normals/Cargo.toml b/code/intermediate/tutorial11-normals/Cargo.toml index 5769bebf..aaf4f732 100644 --- a/code/intermediate/tutorial11-normals/Cargo.toml +++ b/code/intermediate/tutorial11-normals/Cargo.toml @@ -16,7 +16,7 @@ env_logger = "0.10" pollster = "0.2" log = "0.4" tobj = { version = "3.2", features = ["async"]} -wgpu = { version = "0.15"} +wgpu = { version = "0.16"} winit = "0.27" [dependencies.image] @@ -28,7 +28,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/intermediate/tutorial11-normals/src/lib.rs b/code/intermediate/tutorial11-normals/src/lib.rs index a1837a6e..4fa0f8e8 100644 --- a/code/intermediate/tutorial11-normals/src/lib.rs +++ b/code/intermediate/tutorial11-normals/src/lib.rs @@ -8,7 +8,7 @@ use winit::{ window::Window, }; -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; mod model; @@ -349,7 +349,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -386,9 +386,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -517,12 +519,10 @@ impl State { label: Some("camera_bind_group"), }); - let obj_model = resources::load_model( - "cube.obj", - &device, - &queue, - &texture_bind_group_layout, - ).await.unwrap(); + let obj_model = + resources::load_model("cube.obj", &device, &queue, &texture_bind_group_layout) + .await + .unwrap(); let light_uniform = LightUniform { position: [2.0, 2.0, 2.0], @@ -771,7 +771,7 @@ impl State { } } -#[cfg_attr(target_arch="wasm32", wasm_bindgen(start))] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] pub async fn run() { cfg_if::cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -789,14 +789,13 @@ pub async fn run() { .build(&event_loop) .unwrap(); - #[cfg(target_arch = "wasm32")] { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; window.set_inner_size(PhysicalSize::new(450, 400)); - + use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) @@ -847,7 +846,9 @@ pub async fn run() { match state.render() { Ok(_) => {} // Reconfigure the surface if it's lost or outdated - Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => state.resize(state.size), + Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { + state.resize(state.size) + } // The system is out of memory, we should probably quit Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit, // We're ignoring timeouts diff --git a/code/intermediate/tutorial11-normals/src/main.rs b/code/intermediate/tutorial11-normals/src/main.rs index 16326e4f..dda52f7e 100644 --- a/code/intermediate/tutorial11-normals/src/main.rs +++ b/code/intermediate/tutorial11-normals/src/main.rs @@ -2,4 +2,4 @@ use tutorial11_normals::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/intermediate/tutorial11-normals/src/model.rs b/code/intermediate/tutorial11-normals/src/model.rs index bfcf276d..4074e2dd 100644 --- a/code/intermediate/tutorial11-normals/src/model.rs +++ b/code/intermediate/tutorial11-normals/src/model.rs @@ -203,7 +203,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } @@ -216,7 +222,13 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -294,7 +306,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/intermediate/tutorial11-normals/src/texture.rs b/code/intermediate/tutorial11-normals/src/texture.rs index a39c248f..c1a1c1a2 100644 --- a/code/intermediate/tutorial11-normals/src/texture.rs +++ b/code/intermediate/tutorial11-normals/src/texture.rs @@ -105,8 +105,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/intermediate/tutorial12-camera/Cargo.toml b/code/intermediate/tutorial12-camera/Cargo.toml index 267c2e52..21db8b57 100644 --- a/code/intermediate/tutorial12-camera/Cargo.toml +++ b/code/intermediate/tutorial12-camera/Cargo.toml @@ -16,7 +16,7 @@ env_logger = "0.10" pollster = "0.2" log = "0.4" tobj = { version = "3.2", features = ["async"]} -wgpu = { version = "0.15"} +wgpu = { version = "0.16"} winit = "0.27" instant = "0.1" @@ -29,7 +29,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/intermediate/tutorial12-camera/src/lib.rs b/code/intermediate/tutorial12-camera/src/lib.rs index 3b08fb4f..f2e62c31 100644 --- a/code/intermediate/tutorial12-camera/src/lib.rs +++ b/code/intermediate/tutorial12-camera/src/lib.rs @@ -229,7 +229,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -266,9 +266,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, diff --git a/code/intermediate/tutorial12-camera/src/main.rs b/code/intermediate/tutorial12-camera/src/main.rs index 8d7fdb8d..91bed13c 100644 --- a/code/intermediate/tutorial12-camera/src/main.rs +++ b/code/intermediate/tutorial12-camera/src/main.rs @@ -2,4 +2,4 @@ use tutorial12_camera::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/intermediate/tutorial12-camera/src/model.rs b/code/intermediate/tutorial12-camera/src/model.rs index 64c6e23c..e3ec0e61 100644 --- a/code/intermediate/tutorial12-camera/src/model.rs +++ b/code/intermediate/tutorial12-camera/src/model.rs @@ -202,7 +202,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } @@ -215,7 +221,13 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -293,7 +305,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/intermediate/tutorial12-camera/src/texture.rs b/code/intermediate/tutorial12-camera/src/texture.rs index 38100184..24f0ffc3 100644 --- a/code/intermediate/tutorial12-camera/src/texture.rs +++ b/code/intermediate/tutorial12-camera/src/texture.rs @@ -106,8 +106,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/intermediate/tutorial13-terrain/Cargo.toml b/code/intermediate/tutorial13-terrain/Cargo.toml index dd1eed79..7062505c 100644 --- a/code/intermediate/tutorial13-terrain/Cargo.toml +++ b/code/intermediate/tutorial13-terrain/Cargo.toml @@ -16,7 +16,7 @@ env_logger = "0.10" pollster = "0.2" log = "0.4" tobj = { version = "3.2", features = ["async"]} -wgpu = { version = "0.15"} +wgpu = { version = "0.16"} winit = "0.27" instant = "0.1" @@ -29,7 +29,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/intermediate/tutorial13-terrain/src/lib.rs b/code/intermediate/tutorial13-terrain/src/lib.rs index 4cc5c87c..25e4b5d9 100644 --- a/code/intermediate/tutorial13-terrain/src/lib.rs +++ b/code/intermediate/tutorial13-terrain/src/lib.rs @@ -14,8 +14,8 @@ use wasm_bindgen::prelude::*; mod camera; mod model; mod resources; -mod texture; mod terrain; +mod texture; use model::{DrawLight, DrawModel, Vertex}; @@ -231,7 +231,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -268,9 +268,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -540,9 +542,24 @@ impl State { let mut terrain = terrain::Terrain::new(chunk_size, min_max_height); terrain.gen_chunk(&device, &queue, &terrain_pipeline, cgmath::Vector3::zero()); - terrain.gen_chunk(&device, &queue, &terrain_pipeline, (0.0, 0.0, -(chunk_size.y as f32)).into()); - terrain.gen_chunk(&device, &queue, &terrain_pipeline, (-(chunk_size.x as f32), 0.0, -(chunk_size.y as f32)).into()); - terrain.gen_chunk(&device, &queue, &terrain_pipeline, (-(chunk_size.x as f32), 0.0, 0.0).into()); + terrain.gen_chunk( + &device, + &queue, + &terrain_pipeline, + (0.0, 0.0, -(chunk_size.y as f32)).into(), + ); + terrain.gen_chunk( + &device, + &queue, + &terrain_pipeline, + (-(chunk_size.x as f32), 0.0, -(chunk_size.y as f32)).into(), + ); + terrain.gen_chunk( + &device, + &queue, + &terrain_pipeline, + (-(chunk_size.x as f32), 0.0, 0.0).into(), + ); Self { window, @@ -699,7 +716,12 @@ impl State { // &self.light_bind_group, // ); - self.terrain_pipeline.render(&mut render_pass, &self.terrain, &self.camera_bind_group, &self.light_bind_group); + self.terrain_pipeline.render( + &mut render_pass, + &self.terrain, + &self.camera_bind_group, + &self.light_bind_group, + ); } self.queue.submit(iter::once(encoder.finish())); output.present(); diff --git a/code/intermediate/tutorial13-terrain/src/main.rs b/code/intermediate/tutorial13-terrain/src/main.rs index c26ebe25..b81f5e12 100644 --- a/code/intermediate/tutorial13-terrain/src/main.rs +++ b/code/intermediate/tutorial13-terrain/src/main.rs @@ -2,4 +2,4 @@ use tutorial13_terrain::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/intermediate/tutorial13-terrain/src/model.rs b/code/intermediate/tutorial13-terrain/src/model.rs index 45183812..15e343d6 100644 --- a/code/intermediate/tutorial13-terrain/src/model.rs +++ b/code/intermediate/tutorial13-terrain/src/model.rs @@ -203,7 +203,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } @@ -216,7 +222,13 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -294,7 +306,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/intermediate/tutorial13-terrain/src/resources.rs b/code/intermediate/tutorial13-terrain/src/resources.rs index 325cdf0c..092cd0da 100644 --- a/code/intermediate/tutorial13-terrain/src/resources.rs +++ b/code/intermediate/tutorial13-terrain/src/resources.rs @@ -256,7 +256,7 @@ pub async fn load_model( // println!("data.len(): {}", data.len()); // let data_t: &[T] = bytemuck::cast_slice(&data[..]); - + // output.extend(data_t.iter().map(f)); // }); // device.poll(wgpu::Maintain::Wait); @@ -264,4 +264,4 @@ pub async fn load_model( // } // buffer.unmap(); // output -// } \ No newline at end of file +// } diff --git a/code/intermediate/tutorial13-terrain/src/terrain.rs b/code/intermediate/tutorial13-terrain/src/terrain.rs index 03021a90..198f6fa2 100644 --- a/code/intermediate/tutorial13-terrain/src/terrain.rs +++ b/code/intermediate/tutorial13-terrain/src/terrain.rs @@ -568,8 +568,8 @@ impl GenerateChunk for TerrainHackPipeline { buffer: &chunk.mesh.vertex_buffer, layout: wgpu::ImageDataLayout { offset: 0, - bytes_per_row: std::num::NonZeroU32::new(std::mem::size_of::() as u32 * self.texture_size), - rows_per_image: std::num::NonZeroU32::new(self.texture_size), + bytes_per_row: Some(std::mem::size_of::() as u32 * self.texture_size), + rows_per_image: Some(self.texture_size), }, }, wgpu::Extent3d { @@ -589,8 +589,8 @@ impl GenerateChunk for TerrainHackPipeline { buffer: &chunk.mesh.index_buffer, layout: wgpu::ImageDataLayout { offset: 0, - bytes_per_row: std::num::NonZeroU32::new(std::mem::size_of::() as u32 * self.texture_size), - rows_per_image: std::num::NonZeroU32::new(self.texture_size), + bytes_per_row: Some(std::mem::size_of::() as u32 * self.texture_size), + rows_per_image: Some(self.texture_size), }, }, wgpu::Extent3d { @@ -613,15 +613,28 @@ impl GenerateChunk for TerrainHackPipeline { let data = bs.get_mapped_range(); let indices: &[u32] = bytemuck::cast_slice(&data); - let mut f = std::fs::File::create(format!("Chunk ({}, {}) Indices.txt", chunk.corner.x, chunk.corner.y)).unwrap(); + let mut f = std::fs::File::create(format!( + "Chunk ({}, {}) Indices.txt", + chunk.corner.x, chunk.corner.y + )) + .unwrap(); use std::io::Write; for quad in indices.chunks(6) { writeln!(f, "{:?}", quad); } drop(f); - let img = image::ImageBuffer::, _>::from_raw(self.texture_size, self.texture_size, data).unwrap(); - img.save(format!("Chunk ({}, {}) Vertex Data.png", chunk.corner.x, chunk.corner.y)).unwrap(); + let img = image::ImageBuffer::, _>::from_raw( + self.texture_size, + self.texture_size, + data, + ) + .unwrap(); + img.save(format!( + "Chunk ({}, {}) Vertex Data.png", + chunk.corner.x, chunk.corner.y + )) + .unwrap(); } chunk.mesh.index_buffer.unmap(); diff --git a/code/intermediate/tutorial13-terrain/src/texture.rs b/code/intermediate/tutorial13-terrain/src/texture.rs index 13e01fca..24f0ffc3 100644 --- a/code/intermediate/tutorial13-terrain/src/texture.rs +++ b/code/intermediate/tutorial13-terrain/src/texture.rs @@ -106,8 +106,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); @@ -129,4 +129,4 @@ impl Texture { sampler, }) } -} \ No newline at end of file +} diff --git a/code/md-builder/Cargo.toml b/code/md-builder/Cargo.toml new file mode 100644 index 00000000..d97c8292 --- /dev/null +++ b/code/md-builder/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "md-builder" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +markdown = "0.3.0" +rayon = "1.7.0" +thiserror = "1.0.40" diff --git a/code/md-builder/src/main.rs b/code/md-builder/src/main.rs new file mode 100644 index 00000000..2d1ada17 --- /dev/null +++ b/code/md-builder/src/main.rs @@ -0,0 +1,28 @@ +use std::path::Path; + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error("Error processing file: {0}")] + Io(#[from] std::io::Error), +} + +fn main() -> Result<(), Error> { + let dir_path = match std::env::args().skip(1).next() { + Some(s) => s, + None => { + println!("Usage: md-builder 'directory with markdown'"); + std::process::exit(1); + } + }; + + let dir = std::fs::read_dir(dir_path)?; + + + + Ok(()) +} + +fn process_file>(path: P) -> Result<(), Error> { + let path = path.as_ref(); + Ok(()) +} \ No newline at end of file diff --git a/code/showcase/compute/Cargo.toml b/code/showcase/compute/Cargo.toml index ea949b26..916180e5 100644 --- a/code/showcase/compute/Cargo.toml +++ b/code/showcase/compute/Cargo.toml @@ -14,7 +14,7 @@ image = "0.24" log = "0.4" rayon = "1.4" tobj = "2.0" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" [build-dependencies] diff --git a/code/showcase/compute/build.rs b/code/showcase/compute/build.rs index 15fef156..17e559da 100644 --- a/code/showcase/compute/build.rs +++ b/code/showcase/compute/build.rs @@ -7,8 +7,8 @@ use naga::front::glsl::Options; use naga::front::glsl::Parser; use rayon::prelude::*; use std::env; -use std::{fs::read_to_string, path::PathBuf}; use std::result::Result::Ok; +use std::{fs::read_to_string, path::PathBuf}; pub fn load_shader(src_path: PathBuf) -> Result<()> { let extension = src_path @@ -48,7 +48,6 @@ pub fn load_shader(src_path: PathBuf) -> Result<()> { let flags = wgsl::WriterFlags::empty(); std::fs::write(wgsl_path, wgsl::write_string(&module, &info, flags)?)?; - Ok(()) } diff --git a/code/showcase/compute/src/main.rs b/code/showcase/compute/src/main.rs index 77ac32be..224e81f9 100644 --- a/code/showcase/compute/src/main.rs +++ b/code/showcase/compute/src/main.rs @@ -168,7 +168,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -205,9 +205,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, diff --git a/code/showcase/compute/src/model.rs b/code/showcase/compute/src/model.rs index edf23eb1..3d658e2b 100644 --- a/code/showcase/compute/src/model.rs +++ b/code/showcase/compute/src/model.rs @@ -472,7 +472,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } @@ -485,7 +491,13 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -563,7 +575,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/showcase/compute/src/texture.rs b/code/showcase/compute/src/texture.rs index 03842c6b..75cd1fcc 100644 --- a/code/showcase/compute/src/texture.rs +++ b/code/showcase/compute/src/texture.rs @@ -120,8 +120,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/showcase/framework/Cargo.toml b/code/showcase/framework/Cargo.toml index 7b59b2f3..5fe1eb15 100644 --- a/code/showcase/framework/Cargo.toml +++ b/code/showcase/framework/Cargo.toml @@ -14,7 +14,7 @@ pollster = "0.2" image = "0.24.2" log = "0.4" tobj = "2.0" -wgpu = "0.15" +wgpu = "0.16" wgpu-subscriber = "0.1" winit = "0.27" diff --git a/code/showcase/framework/build.rs b/code/showcase/framework/build.rs index c32a9d78..842f4472 100644 --- a/code/showcase/framework/build.rs +++ b/code/showcase/framework/build.rs @@ -1,10 +1,10 @@ +use anyhow::Context; use glob::glob; use naga::back::wgsl; use naga::front::glsl::Options; use naga::front::glsl::Parser; use rayon::prelude::*; use std::{fs::read_to_string, path::PathBuf}; -use anyhow::Context; pub fn load_shader(src_path: PathBuf) -> anyhow::Result<()> { let extension = src_path diff --git a/code/showcase/framework/src/lib.rs b/code/showcase/framework/src/lib.rs index 3dd9b1e0..393c8635 100644 --- a/code/showcase/framework/src/lib.rs +++ b/code/showcase/framework/src/lib.rs @@ -68,9 +68,11 @@ impl Display { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, diff --git a/code/showcase/framework/src/model.rs b/code/showcase/framework/src/model.rs index 6407110d..0b9a4d72 100644 --- a/code/showcase/framework/src/model.rs +++ b/code/showcase/framework/src/model.rs @@ -331,7 +331,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } @@ -344,7 +350,13 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -422,7 +434,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/showcase/framework/src/shader_canvas.rs b/code/showcase/framework/src/shader_canvas.rs index 7737acab..1f6d6b20 100644 --- a/code/showcase/framework/src/shader_canvas.rs +++ b/code/showcase/framework/src/shader_canvas.rs @@ -107,7 +107,6 @@ pub struct ShaderCanvasBuilder<'a> { impl<'a> ShaderCanvasBuilder<'a> { pub fn new() -> Self { - Self { canvas_size: [256.0; 2], clear_color: [0.0, 0.0, 0.0, 1.0], diff --git a/code/showcase/framework/src/texture.rs b/code/showcase/framework/src/texture.rs index 5c37f1d8..8aad4b1a 100644 --- a/code/showcase/framework/src/texture.rs +++ b/code/showcase/framework/src/texture.rs @@ -105,8 +105,8 @@ impl<'a> Texture<'a> { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/showcase/gifs/Cargo.toml b/code/showcase/gifs/Cargo.toml index 5fe7324a..e4bebee3 100644 --- a/code/showcase/gifs/Cargo.toml +++ b/code/showcase/gifs/Cargo.toml @@ -14,7 +14,7 @@ pollster = "0.2" image = "0.24.2" log = "0.4" tobj = "3.1" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" gif = "0.11.4" futures-intrusive = "0.4" diff --git a/code/showcase/gifs/src/main.rs b/code/showcase/gifs/src/main.rs index 0daf36ad..fbe1e6af 100644 --- a/code/showcase/gifs/src/main.rs +++ b/code/showcase/gifs/src/main.rs @@ -5,9 +5,9 @@ use std::{iter, mem, num::NonZeroU32}; async fn run() { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::all(), - dx12_shader_compiler: Default::default(), - }); + backends: wgpu::Backends::all(), + dx12_shader_compiler: Default::default(), + }); let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions::default()) .await @@ -18,12 +18,12 @@ async fn run() { label: Some("Device"), features: wgpu::Features::empty(), // WebGL doesn't support all of wgpu's features, so if - // we're building for the web we'll have to disable some. - limits: if cfg!(target_arch = "wasm32") { - wgpu::Limits::downlevel_webgl2_defaults() - } else { - wgpu::Limits::default() - }, + // we're building for the web we'll have to disable some. + limits: if cfg!(target_arch = "wasm32") { + wgpu::Limits::downlevel_webgl2_defaults() + } else { + wgpu::Limits::default() + }, }, None, // Trace path ) @@ -122,8 +122,8 @@ async fn run() { buffer: &output_buffer, layout: wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(padded_bytes_per_row), - rows_per_image: NonZeroU32::new(texture_size), + bytes_per_row: Some(padded_bytes_per_row), + rows_per_image: Some(texture_size), }, }, render_target.desc.size, diff --git a/code/showcase/imgui-demo/Cargo.toml b/code/showcase/imgui-demo/Cargo.toml index 12c2f7fc..f3e07a7b 100644 --- a/code/showcase/imgui-demo/Cargo.toml +++ b/code/showcase/imgui-demo/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] anyhow = "1.0" -wgpu = "0.15" +wgpu = "0.16" pollster = "0.2" imgui = "0.7" imgui-wgpu = "0.17" diff --git a/code/showcase/lost-window/Cargo.toml b/code/showcase/lost-window/Cargo.toml index 0fe322f2..888bedb8 100644 --- a/code/showcase/lost-window/Cargo.toml +++ b/code/showcase/lost-window/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] anyhow = "1" -wgpu = "0.15" +wgpu = "0.16" winit = "0.27" pollster = "0.2" \ No newline at end of file diff --git a/code/showcase/mouse-picking/Cargo.toml b/code/showcase/mouse-picking/Cargo.toml index 31786404..e5356df0 100644 --- a/code/showcase/mouse-picking/Cargo.toml +++ b/code/showcase/mouse-picking/Cargo.toml @@ -16,7 +16,7 @@ env_logger = "0.10" pollster = "0.2" log = "0.4" tobj = { version = "3.2", features = ["async"]} -wgpu = { version = "0.15"} +wgpu = { version = "0.16"} winit = "0.27" instant = "0.1" @@ -29,7 +29,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/showcase/mouse-picking/src/lib.rs b/code/showcase/mouse-picking/src/lib.rs index e4414f37..bcb26b5f 100644 --- a/code/showcase/mouse-picking/src/lib.rs +++ b/code/showcase/mouse-picking/src/lib.rs @@ -234,7 +234,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -271,9 +271,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -621,7 +623,12 @@ impl State { self.mouse_ray = Ray::with_start_end(mouse_world_pos, self.camera.position.to_vec()); self.selected_mesh = None; - if self.obj_model.bounding_box.intersect(&self.mouse_ray).is_some() { + if self + .obj_model + .bounding_box + .intersect(&self.mouse_ray) + .is_some() + { let mut t = f32::NEG_INFINITY; for (i, mesh) in self.obj_model.meshes.iter().enumerate() { if let Some((_, ti)) = mesh.bounding_box.intersect(&self.mouse_ray) { diff --git a/code/showcase/mouse-picking/src/main.rs b/code/showcase/mouse-picking/src/main.rs index c52e0fb1..1b58d809 100644 --- a/code/showcase/mouse-picking/src/main.rs +++ b/code/showcase/mouse-picking/src/main.rs @@ -2,4 +2,4 @@ use mouse_picking::run; fn main() { pollster::block_on(run()); -} \ No newline at end of file +} diff --git a/code/showcase/mouse-picking/src/math.rs b/code/showcase/mouse-picking/src/math.rs index e30055d9..12d36766 100644 --- a/code/showcase/mouse-picking/src/math.rs +++ b/code/showcase/mouse-picking/src/math.rs @@ -1,11 +1,7 @@ use cgmath::InnerSpace; fn vmul(a: cgmath::Vector3, b: cgmath::Vector3) -> cgmath::Vector3 { - cgmath::Vector3::new( - a.x * b.x, - a.y * b.y, - a.z * b.z, - ) + cgmath::Vector3::new(a.x * b.x, a.y * b.y, a.z * b.z) } pub struct BoundingBox { @@ -79,11 +75,7 @@ pub struct Ray { impl Ray { pub fn new(dir: cgmath::Vector3, orig: cgmath::Vector3) -> Self { let invdir = 1.0 / dir; - Self { - dir, - orig, - invdir, - } + Self { dir, orig, invdir } } pub fn with_start_end(start: cgmath::Vector3, end: cgmath::Vector3) -> Self { @@ -97,14 +89,22 @@ mod tests { use super::*; fn vec3(x: f32, y: f32, z: f32) -> cgmath::Vector3 { - return cgmath::Vector3 { x, y, z } + return cgmath::Vector3 { x, y, z }; } #[test] fn box_ray_intersect() { let b = BoundingBox { - min: cgmath::Vector3 { x: -1.0, y: -1.0, z: -1.0 }, - max: cgmath::Vector3 { x: 1.0, y: 1.0, z: 1.0 }, + min: cgmath::Vector3 { + x: -1.0, + y: -1.0, + z: -1.0, + }, + max: cgmath::Vector3 { + x: 1.0, + y: 1.0, + z: 1.0, + }, }; let test_data = [ @@ -116,4 +116,4 @@ mod tests { assert_eq!(b.intersect(&r).is_some(), expected); } } -} \ No newline at end of file +} diff --git a/code/showcase/mouse-picking/src/model.rs b/code/showcase/mouse-picking/src/model.rs index affca973..41f9af72 100644 --- a/code/showcase/mouse-picking/src/model.rs +++ b/code/showcase/mouse-picking/src/model.rs @@ -206,7 +206,13 @@ where ) { for mesh in &model.meshes { let material = &model.materials[mesh.material]; - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } @@ -219,7 +225,13 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group, light_bind_group); + self.draw_mesh_instanced( + mesh, + material, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } @@ -297,7 +309,12 @@ where light_bind_group: &'b wgpu::BindGroup, ) { for mesh in &model.meshes { - self.draw_light_mesh_instanced(mesh, instances.clone(), camera_bind_group, light_bind_group); + self.draw_light_mesh_instanced( + mesh, + instances.clone(), + camera_bind_group, + light_bind_group, + ); } } } diff --git a/code/showcase/mouse-picking/src/texture.rs b/code/showcase/mouse-picking/src/texture.rs index 38100184..24f0ffc3 100644 --- a/code/showcase/mouse-picking/src/texture.rs +++ b/code/showcase/mouse-picking/src/texture.rs @@ -106,8 +106,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/showcase/pong/Cargo.toml b/code/showcase/pong/Cargo.toml index ad3df043..3fe6c9b5 100644 --- a/code/showcase/pong/Cargo.toml +++ b/code/showcase/pong/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0" bytemuck = { version = "1.12", features = [ "derive" ] } cgmath = "0.18" pollster = "0.2" -wgpu = { version = "0.15", features = ["spirv"]} +wgpu = { version = "0.16", features = ["spirv"]} wgpu_glyph = "0.18" rand = "0.8" rodio = { version = "0.16", default-features = false, features = ["wav"] } @@ -34,7 +34,7 @@ web-sys = { version = "0.3.53", features = [ "Window", "Element", ]} -wgpu = { version = "0.15", features = ["spirv", "webgl"]} +wgpu = { version = "0.16", features = ["spirv", "webgl"]} [build-dependencies] anyhow = "1.0" diff --git a/code/showcase/pong/src/render/mod.rs b/code/showcase/pong/src/render/mod.rs index 89acd770..d5a72042 100644 --- a/code/showcase/pong/src/render/mod.rs +++ b/code/showcase/pong/src/render/mod.rs @@ -77,7 +77,7 @@ impl Render { // Srgb surfaces, you'll need to account for that when drawing to the frame. let surface_format = surface_caps.formats.iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, diff --git a/code/showcase/snow/src/main.rs b/code/showcase/snow/src/main.rs index 99fc00e9..b4e2e6c6 100644 --- a/code/showcase/snow/src/main.rs +++ b/code/showcase/snow/src/main.rs @@ -1,31 +1,19 @@ -use anyhow::{Result, Error}; +use anyhow::{Error, Result}; -struct Snow { - -} +struct Snow {} impl framework::Demo for Snow { fn init(display: &framework::Display) -> Result { - Ok(Self { - - }) + Ok(Self {}) } - fn process_mouse(&mut self, dx: f64, dy: f64) { - - } + fn process_mouse(&mut self, dx: f64, dy: f64) {} - fn resize(&mut self, display: &framework::Display) { - - } + fn resize(&mut self, display: &framework::Display) {} - fn update(&mut self, display: &framework::Display, dt: std::time::Duration) { - - } + fn update(&mut self, display: &framework::Display, dt: std::time::Duration) {} - fn render(&mut self, display: &mut framework::Display) { - - } + fn render(&mut self, display: &mut framework::Display) {} } fn main() { diff --git a/code/showcase/threading/Cargo.toml b/code/showcase/threading/Cargo.toml index 4f8f37be..8bbf7133 100644 --- a/code/showcase/threading/Cargo.toml +++ b/code/showcase/threading/Cargo.toml @@ -17,7 +17,7 @@ pollster = "0.2" log = "0.4" rayon = "1.4" # NEW! tobj = { version = "3.2", features = ["async"]} -wgpu = { version = "0.15"} +wgpu = { version = "0.16"} winit = "0.27" instant = "0.1" async-std = "1" @@ -31,7 +31,7 @@ features = ["png", "jpeg"] reqwest = { version = "0.11" } console_error_panic_hook = "0.1" console_log = "0.2" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/code/showcase/threading/src/lib.rs b/code/showcase/threading/src/lib.rs index f02db027..7909fd33 100644 --- a/code/showcase/threading/src/lib.rs +++ b/code/showcase/threading/src/lib.rs @@ -228,7 +228,7 @@ impl State { backends: wgpu::Backends::all(), dx12_shader_compiler: Default::default(), }); - + // # Safety // // The surface needs to live as long as the window that created it. @@ -265,9 +265,11 @@ impl State { // Shader code in this tutorial assumes an Srgb surface texture. Using a different // one will result all the colors comming out darker. If you want to support non // Srgb surfaces, you'll need to account for that when drawing to the frame. - let surface_format = surface_caps.formats.iter() + let surface_format = surface_caps + .formats + .iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, diff --git a/code/showcase/threading/src/main.rs b/code/showcase/threading/src/main.rs index 20037b43..8c8632d9 100644 --- a/code/showcase/threading/src/main.rs +++ b/code/showcase/threading/src/main.rs @@ -2,4 +2,4 @@ use threading::run; fn main() { async_std::task::block_on(run()); -} \ No newline at end of file +} diff --git a/code/showcase/threading/src/texture.rs b/code/showcase/threading/src/texture.rs index 38100184..24f0ffc3 100644 --- a/code/showcase/threading/src/texture.rs +++ b/code/showcase/threading/src/texture.rs @@ -106,8 +106,8 @@ impl Texture { &rgba, wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(4 * dimensions.0), - rows_per_image: NonZeroU32::new(dimensions.1), + bytes_per_row: Some(4 * dimensions.0), + rows_per_image: Some(dimensions.1), }, size, ); diff --git a/code/showcase/windowless/Cargo.toml b/code/showcase/windowless/Cargo.toml index ed65ddab..be8b6a89 100644 --- a/code/showcase/windowless/Cargo.toml +++ b/code/showcase/windowless/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" [dependencies] image = "0.24" shaderc = "0.8" -wgpu = { version = "0.15", features = ["spirv"] } +wgpu = { version = "0.16", features = ["spirv"] } pollster = "0.2" futures-intrusive = "0.4" diff --git a/code/showcase/windowless/src/main.rs b/code/showcase/windowless/src/main.rs index 5e84421c..49023989 100644 --- a/code/showcase/windowless/src/main.rs +++ b/code/showcase/windowless/src/main.rs @@ -2,9 +2,9 @@ use std::num::NonZeroU32; async fn run() { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::all(), - dx12_shader_compiler: Default::default(), - }); + backends: wgpu::Backends::all(), + dx12_shader_compiler: Default::default(), + }); let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::default(), @@ -169,8 +169,8 @@ async fn run() { buffer: &output_buffer, layout: wgpu::ImageDataLayout { offset: 0, - bytes_per_row: NonZeroU32::new(u32_size * texture_size), - rows_per_image: NonZeroU32::new(texture_size), + bytes_per_row: Some(u32_size * texture_size), + rows_per_image: Some(texture_size), }, }, texture_desc.size, @@ -198,10 +198,8 @@ async fn run() { let buffer = ImageBuffer::, _>::from_raw(texture_size, texture_size, data).unwrap(); buffer.save("image.png").unwrap(); - } output_buffer.unmap(); - } fn main() { diff --git a/code/wasm-builder/src/main.rs b/code/wasm-builder/src/main.rs index 5edc093d..e9a889d0 100644 --- a/code/wasm-builder/src/main.rs +++ b/code/wasm-builder/src/main.rs @@ -1,4 +1,4 @@ -use std::{process::Command, path::PathBuf}; +use std::{path::PathBuf, process::Command}; use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; use wasm_bindgen_cli_support::Bindgen; @@ -69,7 +69,11 @@ fn main() -> anyhow::Result<()> { } let time_taken = std::time::Instant::now() - start_time; - log::info!("Success fully processed {} target(s) in {:?}", targets.len(), time_taken); + log::info!( + "Success fully processed {} target(s) in {:?}", + targets.len(), + time_taken + ); Ok(()) } diff --git a/docs/beginner/tutorial1-window/README.md b/docs/beginner/tutorial1-window/README.md index 1a47f2b4..f3c38357 100644 --- a/docs/beginner/tutorial1-window/README.md +++ b/docs/beginner/tutorial1-window/README.md @@ -11,7 +11,7 @@ For the beginner stuff, we're going to keep things very simple, we'll add things winit = "0.27" env_logger = "0.10" log = "0.4" -wgpu = "0.15" +wgpu = "0.16" ``` ## Using Rust's new resolver @@ -110,7 +110,7 @@ cfg-if = "1" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.6" console_log = "0.2.0" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4.30" web-sys = { version = "0.3", features = [ diff --git a/docs/beginner/tutorial2-surface/README.md b/docs/beginner/tutorial2-surface/README.md index 345be2de..c279409f 100644 --- a/docs/beginner/tutorial2-surface/README.md +++ b/docs/beginner/tutorial2-surface/README.md @@ -158,7 +158,7 @@ The `limits` field describes the limit of certain types of resources that we can // sRGB surfaces, you'll need to account for that when drawing to the frame. let surface_format = surface_caps.formats.iter() .copied() - .find(|f| f.describe().srgb) + .find(|f| f.is_srgb()) .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, @@ -261,13 +261,13 @@ cfg-if = "1" winit = "0.27" env_logger = "0.10" log = "0.4" -wgpu = "0.15" +wgpu = "0.16" pollster = "0.2" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.6" console_log = "0.2.0" -wgpu = { version = "0.15", features = ["webgl"]} +wgpu = { version = "0.16", features = ["webgl"]} wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = [ diff --git a/docs/beginner/tutorial5-textures/README.md b/docs/beginner/tutorial5-textures/README.md index 59130853..0ec873a5 100644 --- a/docs/beginner/tutorial5-textures/README.md +++ b/docs/beginner/tutorial5-textures/README.md @@ -450,7 +450,7 @@ winit = "0.27" env_logger = "0.10" log = "0.4" pollster = "0.2" -wgpu = "0.15" +wgpu = "0.16" bytemuck = { version = "1.12", features = [ "derive" ] } anyhow = "1.0" # NEW! ``` diff --git a/docs/news/0.15/readme.md b/docs/news/0.15/readme.md index ab71cdce..f298283f 100644 --- a/docs/news/0.15/readme.md +++ b/docs/news/0.15/readme.md @@ -20,7 +20,7 @@ let surface_caps = surface.get_capabilities(&adapter); // Srgb surfaces, you'll need to account for that when drawing to the frame. let surface_format = surface_caps.formats.iter() .copied() - .filter(|f| f.describe().srgb) + .filter(|f| f.is_srgb()) .next() .unwrap_or(surface_caps.formats[0]); let config = wgpu::SurfaceConfiguration { diff --git a/docs/showcase/imgui-demo/README.md b/docs/showcase/imgui-demo/README.md index 79423c91..ccc08f59 100644 --- a/docs/showcase/imgui-demo/README.md +++ b/docs/showcase/imgui-demo/README.md @@ -14,7 +14,7 @@ This is not an in-depth guide on how to use Imgui. But here are some of the basi ```toml imgui = "0.7" -imgui-wgpu = "0.15" +imgui-wgpu = "0.16" imgui-winit-support = "0.7" ``` diff --git a/docs/showcase/pong/README.md b/docs/showcase/pong/README.md index d320f530..2cd3d21d 100644 --- a/docs/showcase/pong/README.md +++ b/docs/showcase/pong/README.md @@ -274,7 +274,7 @@ anyhow = "1.0" bytemuck = { version = "1.12", features = [ "derive" ] } cgmath = "0.18" pollster = "0.2" -wgpu = { version = "0.15", features = ["spirv"]} +wgpu = { version = "0.16", features = ["spirv"]} wgpu_glyph = "0.17" rand = "0.8" rodio = { version = "0.15", default-features = false, features = ["wav"] } @@ -293,7 +293,7 @@ web-sys = { version = "0.3.53", features = [ "Window", "Element", ]} -wgpu = { version = "0.15", features = ["spirv", "webgl"]} +wgpu = { version = "0.16", features = ["spirv", "webgl"]} [build-dependencies] anyhow = "1.0" diff --git a/docs/showcase/windowless/README.md b/docs/showcase/windowless/README.md index 0f5a13f4..fd7361e6 100644 --- a/docs/showcase/windowless/README.md +++ b/docs/showcase/windowless/README.md @@ -100,7 +100,7 @@ Update dependencies to support SPIR-V module. [dependencies] image = "0.23" shaderc = "0.7" -wgpu = { version = "0.15", features = ["spirv"] } +wgpu = { version = "0.16", features = ["spirv"] } pollster = "0.2" ```