diff --git a/Cargo.lock b/Cargo.lock index babf6b9..30bd5b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,11 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9fe5e32de01730eb1f6b7f5b51c17e03e2325bf40a74f754f04f130043affff" + [[package]] name = "adler32" version = "1.2.0" @@ -8,33 +14,17 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "andrew" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7f09f89872c2b6b29e319377b1fbe91c6f5947df19a25596e121cf19a7b35e" +checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" dependencies = [ "bitflags", - "line_drawing", - "rusttype 0.7.9", + "rusttype", "walkdir", "xdg", "xml-rs", ] -[[package]] -name = "android_glue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" - -[[package]] -name = "approx" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" -dependencies = [ - "num-traits", -] - [[package]] name = "arrayvec" version = "0.5.1" @@ -47,7 +37,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38" dependencies = [ - "libloading", + "libloading 0.6.3", ] [[package]] @@ -66,6 +56,21 @@ dependencies = [ "serde", ] +[[package]] +name = "bit-set" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.2.1" @@ -98,13 +103,12 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "calloop" -version = "0.4.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aa2097be53a00de9e8fc349fea6d76221f398f5c4fa550d420669906962d160" +checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" dependencies = [ - "mio", - "mio-extras", - "nix", + "log", + "nix 0.18.0", ] [[package]] @@ -123,13 +127,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] -name = "cloudabi" -version = "0.0.3" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cloudabi" @@ -151,14 +152,15 @@ dependencies = [ [[package]] name = "cocoa" -version = "0.19.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29f7768b2d1be17b96158e3285951d366b40211320fb30826a76cb7a0da6400" +checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" dependencies = [ "bitflags", "block", - "core-foundation 0.6.4", - "core-graphics 0.17.3", + "cocoa-foundation", + "core-foundation 0.9.1", + "core-graphics 0.22.2", "foreign-types", "libc", "objc", @@ -191,16 +193,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" -[[package]] -name = "core-foundation" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" -dependencies = [ - "core-foundation-sys 0.6.2", - "libc", -] - [[package]] name = "core-foundation" version = "0.7.0" @@ -221,12 +213,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" - [[package]] name = "core-foundation-sys" version = "0.7.0" @@ -241,24 +227,25 @@ checksum = "c0af3b5e4601de3837c9332e29e0aae47a0d46ebfa246d12b82f564bac233393" [[package]] name = "core-graphics" -version = "0.17.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" dependencies = [ "bitflags", - "core-foundation 0.6.4", + "core-foundation 0.7.0", "foreign-types", "libc", ] [[package]] name = "core-graphics" -version = "0.19.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +checksum = "269f35f69b542b80e736a20a89a05215c0ce80c2c03c514abb2e318b78379d86" dependencies = [ "bitflags", - "core-foundation 0.7.0", + "core-foundation 0.9.1", + "core-graphics-types", "foreign-types", "libc", ] @@ -281,7 +268,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "core-foundation-sys 0.7.0", "core-graphics 0.19.2", "libc", @@ -294,7 +281,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -325,7 +312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ "autocfg", - "cfg-if", + "cfg-if 0.1.10", "crossbeam-utils", "lazy_static", "maybe-uninit", @@ -340,7 +327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ "autocfg", - "cfg-if", + "cfg-if 0.1.10", "lazy_static", ] @@ -351,10 +338,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4" dependencies = [ "bitflags", - "libloading", + "libloading 0.6.3", "winapi 0.3.9", ] +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "deflate" version = "0.8.6" @@ -365,11 +387,22 @@ dependencies = [ "byteorder", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dispatch" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dlib" @@ -377,7 +410,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" dependencies = [ - "libloading", + "libloading 0.6.3", +] + +[[package]] +name = "dlib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +dependencies = [ + "libloading 0.7.0", ] [[package]] @@ -392,6 +434,12 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foreign-types" version = "0.3.2" @@ -434,9 +482,9 @@ dependencies = [ [[package]] name = "gfx-auxil" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ec012a32036c6439180b688b15a24dc8a3fbdb3b1cd02eb55266201db4c1b0f" +checksum = "e7b33ecf067f2117668d91c9b0f2e5f223ebd1ffec314caa2f3de27bb580186d" dependencies = [ "fxhash", "gfx-hal", @@ -445,15 +493,18 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfc194d9a1540073f181bae94087ffc9d84a5586b71962cd1b46b86e5a6d697" +checksum = "36dc6ba2b7647e2c2b27b8f74ff5ccdd53c703776588eee5b1de515fdcbd6bc9" dependencies = [ + "arrayvec", + "bit-set", "bitflags", "d3d12", "gfx-auxil", "gfx-hal", "log", + "parking_lot", "range-alloc", "raw-window-handle", "smallvec", @@ -463,9 +514,9 @@ dependencies = [ [[package]] name = "gfx-backend-metal" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b2b1e2510c8a283beac1e680cd152edc05d138c00dfabc0e3f636e143ffd66" +checksum = "8dc54b456ece69ef49f8893269ebf24ac70969ed34ba2719c3f3abcc8fbff14e" dependencies = [ "arrayvec", "bitflags", @@ -475,23 +526,21 @@ dependencies = [ "foreign-types", "gfx-auxil", "gfx-hal", - "lazy_static", "log", "metal", "objc", - "parking_lot 0.11.0", + "parking_lot", "range-alloc", "raw-window-handle", - "smallvec", "spirv_cross", "storage-map", ] [[package]] name = "gfx-backend-vulkan" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84bda4200a82e1912d575801e2bb76ae19c6256359afbc0adfbbaec02fcadc6" +checksum = "dabe88b1a5c91e0f969b441cc57e70364858066e4ba937deeb62065654ef9bd9" dependencies = [ "arrayvec", "ash", @@ -499,9 +548,9 @@ dependencies = [ "core-graphics-types", "gfx-hal", "inplace_it", - "lazy_static", "log", "objc", + "parking_lot", "raw-window-handle", "smallvec", "winapi 0.3.9", @@ -509,12 +558,14 @@ dependencies = [ [[package]] name = "gfx-hal" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d0754f5b7a43915fd7466883b2d1bb0800d7cc4609178d0b27bf143b9e5123" +checksum = "c1d9cc8d3b573dda62d0baca4f02e0209786e22c562caff001d77c389008781d" dependencies = [ "bitflags", + "naga", "raw-window-handle", + "thiserror", ] [[package]] @@ -551,6 +602,12 @@ dependencies = [ "libc", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "image" version = "0.23.10" @@ -571,9 +628,9 @@ dependencies = [ [[package]] name = "inplace_it" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd01a2a73f2f399df96b22dc88ea687ef4d76226284e7531ae3c7ee1dc5cb534" +checksum = "90953f308a79fe6d62a4643e51f848fbfddcd05975a38e69fdf4ab86a7baf7ca" [[package]] name = "instant" @@ -581,7 +638,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -593,6 +650,12 @@ dependencies = [ "libc", ] +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "jobserver" version = "0.1.21" @@ -645,9 +708,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.77" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" +checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" [[package]] name = "libloading" @@ -655,26 +718,18 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2443d8f0478b16759158b2f66d525991a05491138bc05814ef52a250148ef4f9" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "winapi 0.3.9", ] [[package]] -name = "line_drawing" +name = "libloading" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" -dependencies = [ - "num-traits", -] - -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" dependencies = [ - "scopeguard", + "cfg-if 1.0.0", + "winapi 0.3.9", ] [[package]] @@ -692,7 +747,7 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -717,13 +772,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] -name = "memmap" -version = "0.7.0" +name = "memchr" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "memmap2" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" dependencies = [ "libc", - "winapi 0.3.9", ] [[package]] @@ -737,9 +797,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4e8a431536529327e28c9ba6992f2cb0c15d4222f0602a16e6d7695ff3bccf" +checksum = "4598d719460ade24c7d91f335daf055bf2a7eec030728ce751814c50cdd6a26c" dependencies = [ "bitflags", "block", @@ -764,7 +824,7 @@ version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "fuchsia-zircon", "fuchsia-zircon-sys", "iovec", @@ -801,28 +861,108 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "naga" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05089b2acdf0e6a962cdbf5e328402345a27f59fcde1a59fe97a73e8149d416f" +dependencies = [ + "bit-set", + "bitflags", + "fxhash", + "log", + "num-traits", + "thiserror", +] + +[[package]] +name = "ndk" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb167c1febed0a496639034d0c76b3b74263636045db5489eee52143c246e73" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-glue" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ndk-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" + [[package]] name = "net2" version = "0.2.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "winapi 0.3.9", ] [[package]] name = "nix" -version = "0.14.1" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", +] + +[[package]] +name = "nix" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 1.0.0", "libc", - "void", +] + +[[package]] +name = "nom" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +dependencies = [ + "memchr", + "version_check", ] [[package]] @@ -876,6 +1016,28 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "objc" version = "0.2.7" @@ -896,22 +1058,18 @@ dependencies = [ ] [[package]] -name = "ordered-float" -version = "1.1.0" +name = "once_cell" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579" -dependencies = [ - "num-traits", -] +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" [[package]] -name = "parking_lot" -version = "0.10.2" +name = "owned_ttf_parser" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +checksum = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", + "ttf-parser", ] [[package]] @@ -921,22 +1079,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" dependencies = [ "instant", - "lock_api 0.4.1", - "parking_lot_core 0.8.0", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if", - "cloudabi 0.0.3", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] @@ -945,8 +1089,8 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ - "cfg-if", - "cloudabi 0.1.0", + "cfg-if 0.1.10", + "cloudabi", "instant", "libc", "redox_syscall", @@ -979,12 +1123,12 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "proc-macro-crate" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" dependencies = [ - "unicode-xid 0.1.0", + "toml", ] [[package]] @@ -993,16 +1137,7 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" dependencies = [ - "unicode-xid 0.2.1", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", + "unicode-xid", ] [[package]] @@ -1011,7 +1146,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.23", + "proc-macro2", ] [[package]] @@ -1062,22 +1197,12 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "rusttype" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5" -dependencies = [ - "rusttype 0.8.3", -] - -[[package]] -name = "rusttype" -version = "0.8.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0" +checksum = "dc7c727aded0be18c5b80c1640eae0ac8e396abf6fa8477d96cb37d18ee5ec59" dependencies = [ - "approx", - "ordered-float", - "stb_truetype", + "ab_glyph_rasterizer", + "owned_ttf_parser", ] [[package]] @@ -1089,6 +1214,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scoped_threadpool" version = "0.1.9" @@ -1116,16 +1247,16 @@ version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" dependencies = [ - "proc-macro2 1.0.23", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] [[package]] name = "shaderc" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed344938df2d7fa3cc6bfb4af0b578f00f9b389d5fe7be0250fa657c442a8281" +checksum = "1ca37955a53b37fa20380c414aec5343ab76b6993ebfd86e74facd7209bac577" dependencies = [ "libc", "shaderc-sys", @@ -1133,9 +1264,9 @@ dependencies = [ [[package]] name = "shaderc-sys" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30075c712b08798cb2b5e54e4434970a4a3a3a3e838b0642590c74605d3cc528" +checksum = "da6962db4d543df2fb613d76e6f4c7bcf58ff3300709c92f2349239955ce0a9f" dependencies = [ "cmake", "libc", @@ -1155,25 +1286,28 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "smithay-client-toolkit" -version = "0.6.6" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "421c8dc7acf5cb205b88160f8b4cc2c5cfabe210e43b2f80f009f4c1ef910f1d" +checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" dependencies = [ "andrew", "bitflags", - "dlib", + "calloop", + "dlib 0.4.2", "lazy_static", - "memmap", - "nix", + "log", + "memmap2", + "nix 0.18.0", "wayland-client", + "wayland-cursor", "wayland-protocols", ] [[package]] name = "spirv_cross" -version = "0.21.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b631bd956108f3e34a4fb7e39621711ac15ce022bc567da2d953c6df13f00e00" +checksum = "60647fadbf83c4a72f0d7ea67a7ca3a81835cf442b8deae5c134c3e0055b2e14" dependencies = [ "cc", "js-sys", @@ -1181,32 +1315,49 @@ dependencies = [ ] [[package]] -name = "stb_truetype" -version = "0.3.1" +name = "storage-map" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51" +checksum = "418bb14643aa55a7841d5303f72cf512cfb323b8cc221d51580500a1ca75206c" dependencies = [ - "byteorder", + "lock_api", ] [[package]] -name = "storage-map" -version = "0.3.0" +name = "strsim" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418bb14643aa55a7841d5303f72cf512cfb323b8cc221d51580500a1ca75206c" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" + +[[package]] +name = "syn" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" dependencies = [ - "lock_api 0.4.1", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] -name = "syn" -version = "1.0.42" +name = "thiserror" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "proc-macro2 1.0.23", - "quote 1.0.7", - "unicode-xid 0.2.1", + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1221,10 +1372,19 @@ dependencies = [ ] [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "toml" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "ttf-parser" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" [[package]] name = "unicode-xid" @@ -1233,10 +1393,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] -name = "void" -version = "1.0.2" +name = "version_check" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "walkdir" @@ -1255,7 +1415,7 @@ version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "wasm-bindgen-macro", ] @@ -1268,8 +1428,8 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.23", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "wasm-bindgen-shared", ] @@ -1280,7 +1440,7 @@ version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ - "quote 1.0.7", + "quote", "wasm-bindgen-macro-support", ] @@ -1290,8 +1450,8 @@ version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ - "proc-macro2 1.0.23", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -1305,16 +1465,15 @@ checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "wayland-client" -version = "0.23.6" +version = "0.28.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1080ebe0efabcf12aef2132152f616038f2d7dcbbccf7b2d8c5270fe14bcda" +checksum = "06ca44d86554b85cf449f1557edc6cc7da935cc748c8e4bf1c507cbd43bae02c" dependencies = [ "bitflags", - "calloop", "downcast-rs", "libc", - "mio", - "nix", + "nix 0.20.0", + "scoped-tls", "wayland-commons", "wayland-scanner", "wayland-sys", @@ -1322,19 +1481,32 @@ dependencies = [ [[package]] name = "wayland-commons" -version = "0.23.6" +version = "0.28.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb66b0d1a27c39bbce712b6372131c6e25149f03ffb0cd017cf8f7de8d66dbdb" +checksum = "8bd75ae380325dbcff2707f0cd9869827ea1d2d6d534cff076858d3f0460fd5a" dependencies = [ - "nix", + "nix 0.20.0", + "once_cell", + "smallvec", "wayland-sys", ] +[[package]] +name = "wayland-cursor" +version = "0.28.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b37e5455ec72f5de555ec39b5c3704036ac07c2ecd50d0bffe02d5fe2d4e65ab" +dependencies = [ + "nix 0.20.0", + "wayland-client", + "xcursor", +] + [[package]] name = "wayland-protocols" -version = "0.23.6" +version = "0.28.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cc286643656742777d55dc8e70d144fa4699e426ca8e9d4ef454f4bf15ffcf9" +checksum = "95df3317872bcf9eec096c864b69aa4769a1d5d6291a5b513f8ba0af0efbd52c" dependencies = [ "bitflags", "wayland-client", @@ -1344,23 +1516,24 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.23.6" +version = "0.28.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93b02247366f395b9258054f964fe293ddd019c3237afba9be2ccbe9e1651c3d" +checksum = "389d680d7bd67512dc9c37f39560224327038deb0f0e8d33f870900441b68720" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", + "proc-macro2", + "quote", "xml-rs", ] [[package]] name = "wayland-sys" -version = "0.23.6" +version = "0.28.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d94e89a86e6d6d7c7c9b19ebf48a03afaac4af6bc22ae570e9a24124b75358f4" +checksum = "2907bd297eef464a95ba9349ea771611771aa285b932526c633dc94d5400a8e2" dependencies = [ - "dlib", + "dlib 0.5.0", "lazy_static", + "pkg-config", ] [[package]] @@ -1414,15 +1587,14 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winit" -version = "0.20.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba128780050481f453bec2a115b916dbc6ae79c303dee9bad8b9080bdccd4f5" +checksum = "da4eda6fce0eb84bd0a33e3c8794eb902e1033d0a1d5a31bc4f19b1b4bbff597" dependencies = [ - "android_glue", "bitflags", "cocoa", - "core-foundation 0.6.4", - "core-graphics 0.17.3", + "core-foundation 0.9.1", + "core-graphics 0.22.2", "core-video-sys", "dispatch", "instant", @@ -1431,8 +1603,11 @@ dependencies = [ "log", "mio", "mio-extras", + "ndk", + "ndk-glue", + "ndk-sys", "objc", - "parking_lot 0.10.2", + "parking_lot", "percent-encoding", "raw-window-handle", "smithay-client-toolkit", @@ -1463,6 +1638,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "xcursor" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9a231574ae78801646617cefd13bfe94be907c0e4fa979cfd8b770aa3c5d08" +dependencies = [ + "nom", +] + [[package]] name = "xdg" version = "2.2.0" diff --git a/Cargo.toml b/Cargo.toml index 1fa47b4..ea4334b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,20 +7,20 @@ license = "CC0-1.0" [dependencies] bincode = "~1.3.1" -gfx-hal = "=0.6.0" -shaderc = "=0.6.2" +gfx-hal = "=0.7.0" +shaderc = "=0.7.2" image = "~0.23.9" serde = { version = "~1.0.115", features = ["derive"] } -winit = "~0.20.0" +winit = "~0.24.0" [target.'cfg(target_os = "macos")'.dependencies.backend] package = "gfx-backend-metal" -version = "=0.6.2" +version = "=0.7.0" [target.'cfg(windows)'.dependencies.backend] package = "gfx-backend-dx12" -version = "=0.6.3" +version = "=0.7.0" [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies.backend] package = "gfx-backend-vulkan" -version = "=0.6.1" \ No newline at end of file +version = "=0.7.0" \ No newline at end of file diff --git a/src/bin/part-1-triangle.rs b/src/bin/part-1-triangle.rs index e98ff9d..d2f97e5 100644 --- a/src/bin/part-1-triangle.rs +++ b/src/bin/part-1-triangle.rs @@ -1,4 +1,5 @@ fn main() { + use std::iter; use std::mem::ManuallyDrop; use gfx_hal::{ @@ -10,6 +11,10 @@ fn main() { const APP_NAME: &'static str = "Part 1: Drawing a triangle"; const WINDOW_SIZE: [u32; 2] = [512, 512]; + const DIMS: gfx_hal::window::Extent2D = gfx_hal::window::Extent2D { + width: 512, + height: 512, + }; // Any `winit` application starts with an event loop. You need one of these // to create a window. @@ -26,7 +31,11 @@ fn main() { let (logical_window_size, physical_window_size) = { use winit::dpi::{LogicalSize, PhysicalSize}; - let dpi = event_loop.primary_monitor().scale_factor(); + let dpi = event_loop + .primary_monitor() + .or_else(|| event_loop.available_monitors().next()) + .expect("No primary monitor") + .scale_factor(); let logical: LogicalSize = WINDOW_SIZE.into(); let physical: PhysicalSize = logical.to_physical(dpi); @@ -222,14 +231,18 @@ fn main() { // The third parameter is for expressing `dependencies` between // subpasses, which we don't need. device - .create_render_pass(&[color_attachment], &[subpass], &[]) + .create_render_pass( + iter::once(color_attachment), + iter::once(subpass), + iter::empty(), + ) .expect("Out of memory") } }; let pipeline_layout = unsafe { device - .create_pipeline_layout(&[], &[]) + .create_pipeline_layout(iter::empty(), iter::empty()) .expect("Out of memory") }; @@ -359,7 +372,7 @@ fn main() { device.destroy_shader_module(fragment_shader_module); pipeline - }; + } let pipeline = unsafe { make_pipeline::( @@ -524,7 +537,7 @@ fn main() { // Once the fence has been signalled, we must reset it res.device - .reset_fence(&res.submission_complete_fence) + .reset_fence(&mut res.submission_complete_fence) .expect("Out of memory"); // This clears out the previous frame's command buffer and @@ -598,14 +611,18 @@ fn main() { // In practice, there may be no difference in our case, but // it's somthing to be aware of. let framebuffer = unsafe { - use std::borrow::Borrow; - use gfx_hal::image::Extent; + use gfx_hal::window; + + let caps = res.surface.capabilities(&adapter.physical_device); + let swap_config = + window::SwapchainConfig::from_caps(&caps, surface_color_format, DIMS); + let fat = swap_config.framebuffer_attachment(); res.device .create_framebuffer( render_pass, - vec![surface_image.borrow()], + iter::once(fat), Extent { width: surface_extent.width, height: surface_extent.height, @@ -634,8 +651,10 @@ fn main() { unsafe { use gfx_hal::command::{ - ClearColor, ClearValue, CommandBuffer, CommandBufferFlags, SubpassContents, + ClearColor, ClearValue, CommandBuffer, CommandBufferFlags, + RenderAttachmentInfo, SubpassContents, }; + use std::borrow::Borrow; // This is how we start our command buffer. We set a // flag telling it we're only going to submit it once, @@ -646,8 +665,8 @@ fn main() { // we are drawing into. Changing the viewport will stretch // the resulting image into that rect. Changing the scissor // will crop it. - command_buffer.set_viewports(0, &[viewport.clone()]); - command_buffer.set_scissors(0, &[viewport.rect]); + command_buffer.set_viewports(0, iter::once(viewport.clone())); + command_buffer.set_scissors(0, iter::once(viewport.rect)); // Here we say which render pass we're in. This // defines which framebuffer (images) we'll draw to, and @@ -657,11 +676,14 @@ fn main() { render_pass, &framebuffer, viewport.rect, - &[ClearValue { - color: ClearColor { - float32: [0.0, 0.0, 0.0, 1.0], + iter::once(RenderAttachmentInfo { + image_view: surface_image.borrow(), + clear_value: ClearValue { + color: ClearColor { + float32: [0.0, 0.0, 0.0, 1.0], + }, }, - }], + }), SubpassContents::Inline, ); @@ -688,7 +710,7 @@ fn main() { } unsafe { - use gfx_hal::queue::{CommandQueue, Submission}; + use gfx_hal::queue::CommandQueue; // A `Submission` contains references to the command // buffers to submit, and also any semaphores used for @@ -700,11 +722,6 @@ fn main() { // // In our case though, all we want to do is tell // `rendering_complete_semaphore` when we're done. - let submission = Submission { - command_buffers: vec![&command_buffer], - wait_semaphores: None, - signal_semaphores: vec![&res.rendering_complete_semaphore], - }; // Commands must be submitted to an appropriate queue. We // requested a graphics queue, and so we are submitting @@ -714,7 +731,12 @@ fn main() { // `submission_complete_fence` when the submission is // complete, at which point we can reclaim the command // buffer we used for next frame. - queue_group.queues[0].submit(submission, Some(&res.submission_complete_fence)); + queue_group.queues[0].submit( + iter::once(&command_buffer), + iter::empty(), + iter::once(&res.rendering_complete_semaphore), + Some(&mut res.submission_complete_fence), + ); // Finally, the `present` takes the output of our // rendering and displays it onscreen. We pass the @@ -723,7 +745,7 @@ fn main() { let result = queue_group.queues[0].present( &mut res.surface, surface_image, - Some(&res.rendering_complete_semaphore), + Some(&mut res.rendering_complete_semaphore), ); // If presenting failed, it could be a problem with the diff --git a/src/bin/part-2-push-constants.rs b/src/bin/part-2-push-constants.rs index bf0dc3f..3ef7cd0 100644 --- a/src/bin/part-2-push-constants.rs +++ b/src/bin/part-2-push-constants.rs @@ -11,10 +11,12 @@ struct PushConstants { } fn main() { + use std::iter; use std::mem::ManuallyDrop; use gfx_hal::{ device::Device, + window, window::{Extent2D, PresentationSurface, Surface}, Instance, }; @@ -22,13 +24,21 @@ fn main() { const APP_NAME: &'static str = "Part 2: Push constants"; const WINDOW_SIZE: [u32; 2] = [512, 512]; + const DIMS: gfx_hal::window::Extent2D = gfx_hal::window::Extent2D { + width: 512, + height: 512, + }; let event_loop = winit::event_loop::EventLoop::new(); let (logical_window_size, physical_window_size) = { use winit::dpi::{LogicalSize, PhysicalSize}; - let dpi = event_loop.primary_monitor().scale_factor(); + let dpi = event_loop + .primary_monitor() + .or_else(|| event_loop.available_monitors().next()) + .expect("No primary monitor") + .scale_factor(); let logical: LogicalSize = WINDOW_SIZE.into(); let physical: PhysicalSize = logical.to_physical(dpi); @@ -135,7 +145,11 @@ fn main() { unsafe { device - .create_render_pass(&[color_attachment], &[subpass], &[]) + .create_render_pass( + iter::once(color_attachment), + iter::once(subpass), + iter::empty(), + ) .expect("Out of memory") } }; @@ -153,7 +167,10 @@ fn main() { // but here we can start at zero since there's no data before our // struct. device - .create_pipeline_layout(&[], &[(ShaderStageFlags::VERTEX, 0..push_constant_bytes)]) + .create_pipeline_layout( + iter::empty(), + iter::once((ShaderStageFlags::VERTEX, 0..push_constant_bytes)), + ) .expect("Out of memory") }; @@ -247,7 +264,7 @@ fn main() { device.destroy_shader_module(fragment_shader_module); pipeline - }; + } let pipeline = unsafe { make_pipeline::( @@ -368,7 +385,7 @@ fn main() { .expect("Out of memory or device lost"); res.device - .reset_fence(&res.submission_complete_fence) + .reset_fence(&mut res.submission_complete_fence) .expect("Out of memory"); res.command_pool.reset(false); @@ -412,14 +429,17 @@ fn main() { }; let framebuffer = unsafe { - use std::borrow::Borrow; - use gfx_hal::image::Extent; + let caps = res.surface.capabilities(&adapter.physical_device); + let swap_config = + window::SwapchainConfig::from_caps(&caps, surface_color_format, DIMS); + let fat = swap_config.framebuffer_attachment(); + res.device .create_framebuffer( render_pass, - vec![surface_image.borrow()], + iter::once(fat), Extent { width: surface_extent.width, height: surface_extent.height, @@ -506,23 +526,28 @@ fn main() { unsafe { use gfx_hal::command::{ - ClearColor, ClearValue, CommandBuffer, CommandBufferFlags, SubpassContents, + ClearColor, ClearValue, CommandBuffer, CommandBufferFlags, + RenderAttachmentInfo, SubpassContents, }; + use std::borrow::Borrow; command_buffer.begin_primary(CommandBufferFlags::ONE_TIME_SUBMIT); - command_buffer.set_viewports(0, &[viewport.clone()]); - command_buffer.set_scissors(0, &[viewport.rect]); + command_buffer.set_viewports(0, iter::once(viewport.clone())); + command_buffer.set_scissors(0, iter::once(viewport.rect)); command_buffer.begin_render_pass( render_pass, &framebuffer, viewport.rect, - &[ClearValue { - color: ClearColor { - float32: [0.0, 0.0, 0.0, 1.0], + iter::once(RenderAttachmentInfo { + image_view: surface_image.borrow(), + clear_value: ClearValue { + color: ClearColor { + float32: [0.0, 0.0, 0.0, 1.0], + }, }, - }], + }), SubpassContents::Inline, ); @@ -549,20 +574,19 @@ fn main() { } unsafe { - use gfx_hal::queue::{CommandQueue, Submission}; + use gfx_hal::queue::CommandQueue; - let submission = Submission { - command_buffers: vec![&command_buffer], - wait_semaphores: None, - signal_semaphores: vec![&res.rendering_complete_semaphore], - }; - - queue_group.queues[0].submit(submission, Some(&res.submission_complete_fence)); + queue_group.queues[0].submit( + iter::once(&command_buffer), + iter::empty(), + iter::once(&res.rendering_complete_semaphore), + Some(&mut res.submission_complete_fence), + ); let result = queue_group.queues[0].present( &mut res.surface, surface_image, - Some(&res.rendering_complete_semaphore), + Some(&mut res.rendering_complete_semaphore), ); should_configure_swapchain |= result.is_err(); diff --git a/src/bin/part-3-vertex-buffers.rs b/src/bin/part-3-vertex-buffers.rs index c2642f2..45653c8 100644 --- a/src/bin/part-3-vertex-buffers.rs +++ b/src/bin/part-3-vertex-buffers.rs @@ -20,24 +20,33 @@ struct Vertex { } fn main() { + use std::iter; use std::mem::ManuallyDrop; use gfx_hal::{ device::Device, - window::{Extent2D, PresentationSurface, Surface}, + window::{self, Extent2D, PresentationSurface, Surface}, Instance, }; use shaderc::ShaderKind; const APP_NAME: &'static str = "Part 3: Vertex buffers"; const WINDOW_SIZE: [u32; 2] = [512, 512]; + const DIMS: gfx_hal::window::Extent2D = gfx_hal::window::Extent2D { + width: 512, + height: 512, + }; let event_loop = winit::event_loop::EventLoop::new(); let (logical_window_size, physical_window_size) = { use winit::dpi::{LogicalSize, PhysicalSize}; - let dpi = event_loop.primary_monitor().scale_factor(); + let dpi = event_loop + .primary_monitor() + .or_else(|| event_loop.available_monitors().next()) + .expect("No primary monitor") + .scale_factor(); let logical: LogicalSize = WINDOW_SIZE.into(); let physical: PhysicalSize = logical.to_physical(dpi); @@ -202,7 +211,7 @@ fn main() { // We create a buffer, specifying that it should be used to store vertex // data (hence the `Usage::VERTEX`) and that it should be visible to the // CPU so we can load data into it (hence the `Properties::CPU_VISIBLE`). - let (vertex_buffer_memory, vertex_buffer) = unsafe { + let (mut vertex_buffer_memory, vertex_buffer) = unsafe { use gfx_hal::buffer::Usage; use gfx_hal::memory::Properties; @@ -224,7 +233,7 @@ fn main() { // We pass `Segment::ALL` to say that we want to map the *whole* // buffer, as opposed to just part of it. let mapped_memory = device - .map_memory(&vertex_buffer_memory, Segment::ALL) + .map_memory(&mut vertex_buffer_memory, Segment::ALL) .expect("Failed to map memory"); // Here we just copy `vertex_buffer_len` *from* the `mesh` data @@ -238,10 +247,10 @@ fn main() { // Again, we could supply multiple ranges (of multiple buffers even) // but instead we just flush `ALL` of our single buffer. device - .flush_mapped_memory_ranges(vec![(&vertex_buffer_memory, Segment::ALL)]) + .flush_mapped_memory_ranges(iter::once((&vertex_buffer_memory, Segment::ALL))) .expect("Out of memory"); - device.unmap_memory(&vertex_buffer_memory); + device.unmap_memory(&mut vertex_buffer_memory); } let render_pass = { @@ -268,7 +277,11 @@ fn main() { unsafe { device - .create_render_pass(&[color_attachment], &[subpass], &[]) + .create_render_pass( + iter::once(color_attachment), + iter::once(subpass), + iter::empty(), + ) .expect("Out of memory") } }; @@ -279,7 +292,10 @@ fn main() { let push_constant_bytes = std::mem::size_of::() as u32; device - .create_pipeline_layout(&[], &[(ShaderStageFlags::VERTEX, 0..push_constant_bytes)]) + .create_pipeline_layout( + iter::empty(), + iter::once((ShaderStageFlags::VERTEX, 0..push_constant_bytes)), + ) .expect("Out of memory") }; @@ -428,7 +444,7 @@ fn main() { device.destroy_shader_module(fragment_shader_module); pipeline - }; + } let pipeline = unsafe { make_pipeline::( @@ -556,7 +572,7 @@ fn main() { .expect("Out of memory or device lost"); res.device - .reset_fence(&res.submission_complete_fence) + .reset_fence(&mut res.submission_complete_fence) .expect("Out of memory"); res.command_pool.reset(false); @@ -600,14 +616,17 @@ fn main() { }; let framebuffer = unsafe { - use std::borrow::Borrow; - use gfx_hal::image::Extent; + let caps = res.surface.capabilities(&adapter.physical_device); + let swap_config = + window::SwapchainConfig::from_caps(&caps, surface_color_format, DIMS); + let fat = swap_config.framebuffer_attachment(); + res.device .create_framebuffer( render_pass, - vec![surface_image.borrow()], + iter::once(fat), Extent { width: surface_extent.width, height: surface_extent.height, @@ -665,13 +684,15 @@ fn main() { unsafe { use gfx_hal::command::{ - ClearColor, ClearValue, CommandBuffer, CommandBufferFlags, SubpassContents, + ClearColor, ClearValue, CommandBuffer, CommandBufferFlags, + RenderAttachmentInfo, SubpassContents, }; + use std::borrow::Borrow; command_buffer.begin_primary(CommandBufferFlags::ONE_TIME_SUBMIT); - command_buffer.set_viewports(0, &[viewport.clone()]); - command_buffer.set_scissors(0, &[viewport.rect]); + command_buffer.set_viewports(0, iter::once(viewport.clone())); + command_buffer.set_scissors(0, iter::once(viewport.rect)); // This sets which vertex buffers will be used to render // from. For now we're only going to bind one. @@ -682,18 +703,21 @@ fn main() { // In our case, we bind the `WHOLE` buffer. command_buffer.bind_vertex_buffers( 0, - vec![(&res.vertex_buffer, gfx_hal::buffer::SubRange::WHOLE)], + iter::once((&res.vertex_buffer, gfx_hal::buffer::SubRange::WHOLE)), ); command_buffer.begin_render_pass( render_pass, &framebuffer, viewport.rect, - &[ClearValue { - color: ClearColor { - float32: [0.0, 0.0, 0.0, 1.0], + iter::once(RenderAttachmentInfo { + image_view: surface_image.borrow(), + clear_value: ClearValue { + color: ClearColor { + float32: [0.0, 0.0, 0.0, 1.0], + }, }, - }], + }), SubpassContents::Inline, ); @@ -719,20 +743,19 @@ fn main() { } unsafe { - use gfx_hal::queue::{CommandQueue, Submission}; + use gfx_hal::queue::CommandQueue; - let submission = Submission { - command_buffers: vec![&command_buffer], - wait_semaphores: None, - signal_semaphores: vec![&res.rendering_complete_semaphore], - }; - - queue_group.queues[0].submit(submission, Some(&res.submission_complete_fence)); + queue_group.queues[0].submit( + iter::once(&command_buffer), + iter::empty(), + iter::once(&res.rendering_complete_semaphore), + Some(&mut res.submission_complete_fence), + ); let result = queue_group.queues[0].present( &mut res.surface, surface_image, - Some(&res.rendering_complete_semaphore), + Some(&mut res.rendering_complete_semaphore), ); should_configure_swapchain |= result.is_err();