mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
Add rustfmt.toml and enable auto formatting (Fixes #7)
This commit is contained in:
parent
d616bfa8a1
commit
35ff5f55ea
20 changed files with 541 additions and 439 deletions
12
.vscode/settings.json
vendored
Normal file
12
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"[rust]": {
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": true
|
||||
},
|
||||
"rust-analyzer.rustfmt.extraArgs": [
|
||||
"--config", // Remove when rustfmt 2.0
|
||||
"match_block_trailing_comma=true", // is released
|
||||
"--config", // Remove when control_brace_style
|
||||
"control_brace_style=ClosingNextLine" // becomes stable
|
||||
]
|
||||
}
|
||||
384
Cargo.lock
generated
384
Cargo.lock
generated
|
|
@ -2,24 +2,30 @@
|
|||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.12.1"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543"
|
||||
checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.0.4"
|
||||
name = "adler"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
||||
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.10"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
|
||||
checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
@ -67,11 +73,11 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
|||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.30.0"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69daec0742947f33a85931fa3cb0ce5f07929159dcbd1f0cbb5b2912e2978509"
|
||||
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
"libloading 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -88,7 +94,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -105,13 +111,14 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.48"
|
||||
version = "0.3.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130"
|
||||
checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
|
@ -140,9 +147,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.3.0"
|
||||
version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6"
|
||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||
|
||||
[[package]]
|
||||
name = "byte-tools"
|
||||
|
|
@ -175,9 +182,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.54"
|
||||
version = "1.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
|
||||
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
|
@ -231,14 +238,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.20.1"
|
||||
version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f7b6f3f7f4f0b3ec5c5039aaa9e8c3cef97a7a480a400fd62944841314f293d"
|
||||
checksum = "0c49e86fc36d5704151f5996b7b3795385f50ce09e3be0f47a0cfde869681cf8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
"core-foundation 0.7.0",
|
||||
"core-graphics 0.19.0",
|
||||
"core-graphics 0.19.2",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"objc",
|
||||
|
|
@ -252,9 +259,9 @@ checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd"
|
|||
|
||||
[[package]]
|
||||
name = "copyless"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127"
|
||||
checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
|
|
@ -302,9 +309,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.19.0"
|
||||
version = "0.19.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd"
|
||||
checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation 0.7.0",
|
||||
|
|
@ -320,7 +327,7 @@ checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys 0.7.0",
|
||||
"core-graphics 0.19.0",
|
||||
"core-graphics 0.19.2",
|
||||
"libc",
|
||||
"objc",
|
||||
]
|
||||
|
|
@ -362,12 +369,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
|
||||
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -392,13 +400,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "d3d12"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc7ed48e89905e5e146bcc1951cc3facb9e44aea9adf5dc01078cda1bd24b662"
|
||||
checksum = "c1324bc4eae34f03b0ced586da5ae2b1ab46acfdae68b5b26d2e23dadae376a2"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libloading",
|
||||
"winapi 0.3.8",
|
||||
"libloading 0.6.2",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -428,18 +436,18 @@ checksum = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605"
|
|||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a"
|
||||
checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
"libloading 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6"
|
||||
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
|
|
@ -476,9 +484,9 @@ version = "0.1.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
|
@ -580,9 +588,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -669,22 +677,22 @@ dependencies = [
|
|||
"bitflags",
|
||||
"gfx-auxil",
|
||||
"gfx-hal",
|
||||
"libloading",
|
||||
"libloading 0.5.2",
|
||||
"log",
|
||||
"parking_lot",
|
||||
"range-alloc",
|
||||
"raw-window-handle",
|
||||
"smallvec",
|
||||
"spirv_cross",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
"wio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-dx12"
|
||||
version = "0.5.3"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37365e2927d55cefac0d3f78dfd1d3119fbb13a8bd7afe2409d729961fee22fc"
|
||||
checksum = "05218b5c94539f22ac7d6feb4b2482431b89f6cc897132494701ac48619218d7"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"d3d12",
|
||||
|
|
@ -695,31 +703,32 @@ dependencies = [
|
|||
"raw-window-handle",
|
||||
"smallvec",
|
||||
"spirv_cross",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-empty"
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67bd2d7bc022b257ddbdabc5fa3b10c29c292372c3409f2b6a6e3f4e11cdb85"
|
||||
checksum = "2e0f922b263916801583b7a1d58213f51c46a225c1cdf29f6d10135a23945f07"
|
||||
dependencies = [
|
||||
"gfx-hal",
|
||||
"log",
|
||||
"raw-window-handle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.5.2"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "205f3ca8e74ed814ea2c0206d47d8925077673cab2e21f9b12d48ff781cf87ee"
|
||||
checksum = "412a1e0e53e9e325a7c2e0316f1a4e8a14cbe8d8bfb5f030bc3895692f8a8254"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
"block",
|
||||
"cocoa 0.20.1",
|
||||
"cocoa 0.20.2",
|
||||
"copyless",
|
||||
"core-graphics 0.19.0",
|
||||
"core-graphics 0.19.2",
|
||||
"foreign-types",
|
||||
"gfx-auxil",
|
||||
"gfx-hal",
|
||||
|
|
@ -737,21 +746,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gfx-backend-vulkan"
|
||||
version = "0.5.6"
|
||||
version = "0.5.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45ff36feae801fa23d29acd74082603a0145a697a23595757dd4e78828ab33da"
|
||||
checksum = "84ab530c440abee3e8bb31c3920a9e7047a3a676f8fe9f2541416dd407cf956a"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ash",
|
||||
"byteorder",
|
||||
"core-graphics 0.19.0",
|
||||
"core-graphics 0.19.2",
|
||||
"gfx-hal",
|
||||
"lazy_static 1.4.0",
|
||||
"log",
|
||||
"objc",
|
||||
"raw-window-handle",
|
||||
"smallvec",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
"x11",
|
||||
]
|
||||
|
||||
|
|
@ -768,9 +777,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gfx-hal"
|
||||
version = "0.5.0"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc96180204064c9493e0fe4a9efeb721e0ac59fe8e1906d0c659142a93114fb1"
|
||||
checksum = "a18534b23d4c262916231511309bc1f307c74cda8dcb68b93a10ca213a22814b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"raw-window-handle",
|
||||
|
|
@ -801,9 +810,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.21.0"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
|
||||
checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
|
||||
|
||||
[[package]]
|
||||
name = "glsl-to-spirv"
|
||||
|
|
@ -838,9 +847,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.13"
|
||||
version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
|
||||
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
|
@ -891,9 +900,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.4"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7777a24a1ce5de49fcdde84ec46efa487c3af49d5b6e6e0a50367cc5c1096182"
|
||||
checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485"
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
|
|
@ -906,9 +915,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "jpeg-decoder"
|
||||
version = "0.1.19"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704"
|
||||
checksum = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"rayon",
|
||||
|
|
@ -916,9 +925,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.39"
|
||||
version = "0.3.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa5a448de267e7358beaf4a5d849518fe9a0c13fce7afd44b06e68550e5562a7"
|
||||
checksum = "c4b9172132a62451e56142bff9afc91c8e4a4500aa5b847da36815b63bfda916"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
|
@ -953,9 +962,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.71"
|
||||
version = "0.2.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
|
||||
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
|
@ -964,7 +973,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cadb8e769f070c45df05c78c7520eb4cd17061d4ab262e43cfc68b4d00ac71c"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1028,14 +1046,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.5.4"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8"
|
||||
checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
]
|
||||
|
|
@ -1048,13 +1066,22 @@ checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
"cocoa 0.20.1",
|
||||
"core-graphics 0.19.0",
|
||||
"cocoa 0.20.2",
|
||||
"core-graphics 0.19.2",
|
||||
"foreign-types",
|
||||
"log",
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.22"
|
||||
|
|
@ -1106,7 +1133,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1135,9 +1162,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.42"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
|
||||
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"num-traits",
|
||||
|
|
@ -1145,9 +1172,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.40"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00"
|
||||
checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"num-integer",
|
||||
|
|
@ -1167,9 +1194,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
]
|
||||
|
|
@ -1205,9 +1232,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.19.0"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
|
||||
checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
|
|
@ -1217,9 +1244,9 @@ checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
|
|||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
version = "1.0.2"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
|
||||
checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
|
@ -1243,9 +1270,9 @@ version = "0.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b4b5f600e60dd3a147fb57b4547033d382d1979eb087af310e91cb45a63b1f4"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1269,7 +1296,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1287,11 +1314,11 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fb44a25c5bba983be0fc8592dfaf3e6d0935ce8be0c6b15b2a39507af34a926"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
"synstructure",
|
||||
"unicode-xid 0.2.0",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1340,22 +1367,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "0.4.17"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
|
||||
checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "0.4.17"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
|
||||
checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1366,9 +1393,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
|||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||
checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
|
|
@ -1396,9 +1423,9 @@ checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro-nested"
|
||||
version = "0.1.4"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
|
||||
checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
|
|
@ -1411,11 +1438,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101"
|
||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1435,11 +1462,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
|
||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"proc-macro2 1.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1458,7 +1485,7 @@ dependencies = [
|
|||
"rand_os",
|
||||
"rand_pcg 0.1.2",
|
||||
"rand_xorshift",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1554,7 +1581,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1568,7 +1595,7 @@ dependencies = [
|
|||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"rdrand",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1601,9 +1628,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "range-alloc"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd5927936723a9e8b715d37d7e4b390455087c4bdf25b9f702309460577b14f9"
|
||||
checksum = "a871f1e45a3a3f0c73fb60343c811238bb5143a81642e27c2ac7aac27ff01a63"
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
|
|
@ -1616,10 +1643,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098"
|
||||
checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"crossbeam-deque",
|
||||
"either",
|
||||
"rayon-core",
|
||||
|
|
@ -1627,9 +1655,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.7.0"
|
||||
version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9"
|
||||
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-queue",
|
||||
|
|
@ -1655,15 +1683,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.56"
|
||||
version = "0.1.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.3.7"
|
||||
version = "1.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
|
||||
checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
|
@ -1673,17 +1701,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.17"
|
||||
version = "0.6.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
|
||||
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1759,9 +1787,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
|||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
|
||||
checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
|
|
@ -1821,25 +1849,25 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.27"
|
||||
version = "1.0.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de"
|
||||
checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"unicode-xid 0.2.0",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synstructure"
|
||||
version = "0.12.3"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
||||
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"unicode-xid 0.2.0",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1853,7 +1881,7 @@ dependencies = [
|
|||
"rand 0.7.3",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1900,9 +1928,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
|
|
@ -1923,7 +1951,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
|
|
@ -1935,9 +1963,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.62"
|
||||
version = "0.2.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3c7d40d09cdbf0f4895ae58cf57d92e1e57a9dd8ed2e8390514b54a47cc5551"
|
||||
checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
|
|
@ -1945,47 +1973,47 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.62"
|
||||
version = "0.2.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3972e137ebf830900db522d6c8fd74d1900dcfc733462e9a12e942b00b4ac94"
|
||||
checksum = "3e53963b583d18a5aa3aaae4b4c1cb535218246131ba22a71f05b518098571df"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static 1.4.0",
|
||||
"log",
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.62"
|
||||
version = "0.2.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776"
|
||||
checksum = "3fcfd5ef6eec85623b4c6e844293d4516470d8f19cd72d0d12246017eb9060b8"
|
||||
dependencies = [
|
||||
"quote 1.0.6",
|
||||
"quote 1.0.7",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.62"
|
||||
version = "0.2.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a"
|
||||
checksum = "9adff9ee0e94b926ca81b57f57f86d5545cdcb1d259e21ec9bdd95b901754c75"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.17",
|
||||
"quote 1.0.6",
|
||||
"syn 1.0.27",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.34",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.62"
|
||||
version = "0.2.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a91c2916119c17a8e316507afaaa2dd94b47646048014bbdf6bef098c1bb58ad"
|
||||
checksum = "7f7b90ea6c632dd06fd765d44542e234d5e63d9bb917ecd64d79778a13bd79ae"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
|
|
@ -2049,9 +2077,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf715eb8571da470b856ecc67b057221360d9fce16f3e38001b2fb158d04012"
|
||||
checksum = "b5dece29f3cd403aabf4056595eabe4b9af56b8bfae12445f097cf8666a41829"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"parking_lot",
|
||||
|
|
@ -2064,9 +2092,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.5.5"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b093098e0782b0f46f154fac5c670ba27b7a5bff98dc943422c13852c696a2b0"
|
||||
checksum = "f07fd0b6b3b340465bce96286350d34b7661fb623ef24c3c2b8902ea654cd4e0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
|
|
@ -2090,9 +2118,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wgpu-native"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19a5051a357d071fd69c24671e0ea6d644a83c7418e47eac3511427379007403"
|
||||
checksum = "5f1ac9838b0715d7911352db1268e34dfd05ef347fbef0b65ae211268316a432"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"lazy_static 1.4.0",
|
||||
|
|
@ -2122,9 +2150,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
|||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
|
|
@ -2148,7 +2176,7 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2182,7 +2210,7 @@ dependencies = [
|
|||
"raw-window-handle",
|
||||
"smithay-client-toolkit",
|
||||
"wayland-client",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
"x11-dl",
|
||||
]
|
||||
|
||||
|
|
@ -2192,7 +2220,7 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2241,6 +2269,6 @@ checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"
|
|||
|
||||
[[package]]
|
||||
name = "xmlparser"
|
||||
version = "0.13.1"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccb4240203dadf40be2de9369e5c6dec1bf427528115b030baca3334c18362d7"
|
||||
checksum = "52613e655f6f11f63c0fe7d1c3b5ef69e44d96df9b65dab296b441ed0e1125f5"
|
||||
|
|
|
|||
19
rustfmt.toml
Normal file
19
rustfmt.toml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
edition = "2018"
|
||||
hard_tabs = true
|
||||
max_width = 180
|
||||
newline_style = "Unix"
|
||||
use_try_shorthand = true
|
||||
|
||||
# Enable when 2.0 is released:
|
||||
# match_block_trailing_comma = true
|
||||
|
||||
# Enable when control_brace_style becomes stable:
|
||||
# control_brace_style = "ClosingNextLine"
|
||||
|
||||
# Maybe enable these in the future when they're stabilized
|
||||
# normalize_comments = true
|
||||
# normalize_doc_attributes = true
|
||||
# struct_lit_width = 35
|
||||
# where_single_line = true
|
||||
|
||||
# For now run: cargo fmt -- --config match_block_trailing_comma=true --config control_brace_style=ClosingNextLine
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
use crate::color_palette::ColorPalette;
|
||||
use crate::window_events;
|
||||
use crate::pipeline::Pipeline;
|
||||
use crate::texture::Texture;
|
||||
use crate::resource_cache::ResourceCache;
|
||||
use crate::layout_system::LayoutSystem;
|
||||
use crate::gui_node::GuiNode;
|
||||
use crate::layout_system::LayoutSystem;
|
||||
use crate::pipeline::Pipeline;
|
||||
use crate::resource_cache::ResourceCache;
|
||||
use crate::texture::Texture;
|
||||
use crate::window_events;
|
||||
use futures::executor::block_on;
|
||||
use winit::event::*;
|
||||
use winit::event_loop::*;
|
||||
use winit::window::Window;
|
||||
use futures::executor::block_on;
|
||||
|
||||
pub struct Application {
|
||||
pub surface: wgpu::Surface,
|
||||
|
|
@ -35,7 +35,8 @@ impl Application {
|
|||
compatible_surface: Some(&surface),
|
||||
},
|
||||
wgpu::BackendBit::PRIMARY,
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
// Requests the device and queue from the adapter
|
||||
let requested_device = block_on(adapter.request_device(&wgpu::DeviceDescriptor {
|
||||
|
|
@ -48,7 +49,7 @@ impl Application {
|
|||
|
||||
// Represents the GPU command queue, to submit CommandBuffers
|
||||
let queue = requested_device.1;
|
||||
|
||||
|
||||
// Properties for the swap chain frame buffers
|
||||
let swap_chain_descriptor = wgpu::SwapChainDescriptor {
|
||||
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
|
||||
|
|
@ -70,7 +71,11 @@ impl Application {
|
|||
|
||||
// Data structure maintaining the user interface
|
||||
let gui_rect_pipeline = Pipeline::new(
|
||||
&device, swap_chain_descriptor.format, Vec::new(), &mut shader_cache, ("shaders/shader.vert", "shaders/shader.frag"),
|
||||
&device,
|
||||
swap_chain_descriptor.format,
|
||||
Vec::new(),
|
||||
&mut shader_cache,
|
||||
("shaders/shader.vert", "shaders/shader.frag"),
|
||||
);
|
||||
pipeline_cache.set("gui_rect", gui_rect_pipeline);
|
||||
|
||||
|
|
@ -127,15 +132,13 @@ impl Application {
|
|||
}
|
||||
}
|
||||
|
||||
fn update_gui(&mut self) {
|
||||
|
||||
}
|
||||
fn update_gui(&mut self) {}
|
||||
|
||||
// Render the queue of pipeline draw commands over the current window
|
||||
fn render(&mut self) {
|
||||
// Get a frame buffer to render on
|
||||
let frame = self.swap_chain.get_next_texture().expect("Timeout getting frame buffer texture");
|
||||
|
||||
|
||||
// Generates a render pass that commands are applied to, then generates a command buffer when finished
|
||||
let mut command_encoder = self.device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: Some("Render Encoder") });
|
||||
|
||||
|
|
@ -144,21 +147,19 @@ impl Application {
|
|||
|
||||
// Recording of commands while in "rendering mode" that go into a command buffer
|
||||
let mut render_pass = command_encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
color_attachments: &[
|
||||
wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &frame.view,
|
||||
resolve_target: None,
|
||||
load_op: wgpu::LoadOp::Clear,
|
||||
store_op: wgpu::StoreOp::Store,
|
||||
clear_color: wgpu::Color::BLACK,
|
||||
}
|
||||
],
|
||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &frame.view,
|
||||
resolve_target: None,
|
||||
load_op: wgpu::LoadOp::Clear,
|
||||
store_op: wgpu::StoreOp::Store,
|
||||
clear_color: wgpu::Color::BLACK,
|
||||
}],
|
||||
depth_stencil_attachment: None,
|
||||
});
|
||||
|
||||
// Prepare a variable to reuse the pipeline based on its name
|
||||
let mut pipeline_name = String::new();
|
||||
|
||||
|
||||
// Turn the queue of pipelines each into a command buffer and submit it to the render queue
|
||||
for i in 0..commands.len() {
|
||||
// If the previously set pipeline can't be reused, send the GPU the new pipeline to draw with
|
||||
|
|
@ -179,7 +180,7 @@ impl Application {
|
|||
|
||||
// Draw call
|
||||
render_pass.draw_indexed(0..commands[i].index_count, 0, 0..1);
|
||||
};
|
||||
}
|
||||
|
||||
// Done sending render pass commands so we can give up mutation rights to command_encoder
|
||||
drop(render_pass);
|
||||
|
|
|
|||
65
src/color.rs
65
src/color.rs
|
|
@ -13,74 +13,29 @@ impl Color {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const TRANSPARENT: Self = Color {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 0.0,
|
||||
};
|
||||
pub const TRANSPARENT: Self = Color { r: 0.0, g: 0.0, b: 0.0, a: 0.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const BLACK: Self = Color {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const BLACK: Self = Color { r: 0.0, g: 0.0, b: 0.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const WHITE: Self = Color {
|
||||
r: 1.0,
|
||||
g: 1.0,
|
||||
b: 1.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const WHITE: Self = Color { r: 1.0, g: 1.0, b: 1.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const RED: Self = Color {
|
||||
r: 1.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const RED: Self = Color { r: 1.0, g: 0.0, b: 0.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const YELLOW: Self = Color {
|
||||
r: 1.0,
|
||||
g: 1.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const YELLOW: Self = Color { r: 1.0, g: 1.0, b: 0.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const GREEN: Self = Color {
|
||||
r: 0.0,
|
||||
g: 1.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const GREEN: Self = Color { r: 0.0, g: 1.0, b: 0.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const CYAN: Self = Color {
|
||||
r: 0.0,
|
||||
g: 1.0,
|
||||
b: 1.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const CYAN: Self = Color { r: 0.0, g: 1.0, b: 1.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const BLUE: Self = Color {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 1.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const BLUE: Self = Color { r: 0.0, g: 0.0, b: 1.0, a: 1.0 };
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const MAGENTA: Self = Color {
|
||||
r: 1.0,
|
||||
g: 0.0,
|
||||
b: 1.0,
|
||||
a: 1.0,
|
||||
};
|
||||
}
|
||||
pub const MAGENTA: Self = Color { r: 1.0, g: 0.0, b: 1.0, a: 1.0 };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,22 +25,22 @@ impl ColorPalette {
|
|||
#[allow(dead_code)]
|
||||
pub fn into_color_srgb(&self) -> Color {
|
||||
let grayscale = match self {
|
||||
ColorPalette::Black => 0 * 17, // #000000
|
||||
ColorPalette::NearBlack => 1 * 17, // #111111
|
||||
ColorPalette::MildBlack => 2 * 17, // #222222
|
||||
ColorPalette::DarkGray => 3 * 17, // #333333
|
||||
ColorPalette::DimGray => 4 * 17, // #444444
|
||||
ColorPalette::DullGray => 5 * 17, // #555555
|
||||
ColorPalette::LowerGray => 6 * 17, // #666666
|
||||
ColorPalette::MiddleGray => 7 * 17, // #777777
|
||||
ColorPalette::UpperGray => 8 * 17, // #888888
|
||||
ColorPalette::PaleGray => 9 * 17, // #999999
|
||||
ColorPalette::SoftGray => 10 * 17, // #aaaaaa
|
||||
ColorPalette::LightGray => 11 * 17, // #bbbbbb
|
||||
ColorPalette::Black => 0 * 17, // #000000
|
||||
ColorPalette::NearBlack => 1 * 17, // #111111
|
||||
ColorPalette::MildBlack => 2 * 17, // #222222
|
||||
ColorPalette::DarkGray => 3 * 17, // #333333
|
||||
ColorPalette::DimGray => 4 * 17, // #444444
|
||||
ColorPalette::DullGray => 5 * 17, // #555555
|
||||
ColorPalette::LowerGray => 6 * 17, // #666666
|
||||
ColorPalette::MiddleGray => 7 * 17, // #777777
|
||||
ColorPalette::UpperGray => 8 * 17, // #888888
|
||||
ColorPalette::PaleGray => 9 * 17, // #999999
|
||||
ColorPalette::SoftGray => 10 * 17, // #aaaaaa
|
||||
ColorPalette::LightGray => 11 * 17, // #bbbbbb
|
||||
ColorPalette::BrightGray => 12 * 17, // #cccccc
|
||||
ColorPalette::MildWhite => 13 * 17, // #dddddd
|
||||
ColorPalette::NearWhite => 14 * 17, // #eeeeee
|
||||
ColorPalette::White => 15 * 17, // #ffffff
|
||||
ColorPalette::MildWhite => 13 * 17, // #dddddd
|
||||
ColorPalette::NearWhite => 14 * 17, // #eeeeee
|
||||
ColorPalette::White => 15 * 17, // #ffffff
|
||||
_ => -1,
|
||||
};
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ impl ColorPalette {
|
|||
|
||||
let rgba = match self {
|
||||
ColorPalette::Accent => (75, 121, 167, 255), // #4b79a7
|
||||
_ => (0, 0, 0, 255), // Unimplemented returns black
|
||||
_ => (0, 0, 0, 255), // Unimplemented returns black
|
||||
};
|
||||
|
||||
Color::new(rgba.0 as f32 / 255.0, rgba.1 as f32 / 255.0, rgba.2 as f32 / 255.0, rgba.3 as f32 / 255.0)
|
||||
|
|
@ -88,4 +88,4 @@ impl ColorPalette {
|
|||
_ => panic!("Invalid color lookup of `{}` from the color palette", name_in_palette),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,4 +22,4 @@ impl DrawCommand {
|
|||
index_count,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,12 @@ pub struct Corners<T> {
|
|||
|
||||
impl<T> Corners<T> {
|
||||
pub fn new(top_left: T, top_right: T, bottom_right: T, bottom_left: T) -> Self {
|
||||
Self { top_left, top_right, bottom_right, bottom_left }
|
||||
Self {
|
||||
top_left,
|
||||
top_right,
|
||||
bottom_right,
|
||||
bottom_left,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::resource_cache::ResourceCache;
|
||||
use crate::draw_command::DrawCommand;
|
||||
use crate::color::Color;
|
||||
use crate::texture::Texture;
|
||||
use crate::pipeline::Pipeline;
|
||||
use crate::draw_command::DrawCommand;
|
||||
use crate::gui_attributes::*;
|
||||
use crate::pipeline::Pipeline;
|
||||
use crate::resource_cache::ResourceCache;
|
||||
use crate::texture::Texture;
|
||||
|
||||
pub struct GuiNode {
|
||||
pub form_factor: GuiNodeUniform,
|
||||
|
|
@ -18,7 +18,13 @@ impl GuiNode {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn build_draw_commands_recursive(node: &rctree::Node<GuiNode>, device: &wgpu::Device, queue: &mut wgpu::Queue, pipeline_cache: &ResourceCache<Pipeline>, texture_cache: &mut ResourceCache<Texture>) -> Vec<DrawCommand> {
|
||||
pub fn build_draw_commands_recursive(
|
||||
node: &rctree::Node<GuiNode>,
|
||||
device: &wgpu::Device,
|
||||
queue: &mut wgpu::Queue,
|
||||
pipeline_cache: &ResourceCache<Pipeline>,
|
||||
texture_cache: &mut ResourceCache<Texture>,
|
||||
) -> Vec<DrawCommand> {
|
||||
let mut draw_commands: Vec<DrawCommand> = Vec::new();
|
||||
|
||||
for mut subnode in node.descendants() {
|
||||
|
|
@ -32,19 +38,11 @@ impl GuiNode {
|
|||
}
|
||||
|
||||
pub fn build_draw_command(&mut self, device: &wgpu::Device, queue: &mut wgpu::Queue, pipeline: &Pipeline, texture_cache: &mut ResourceCache<Texture>) -> DrawCommand {
|
||||
const VERTICES: &[[f32; 2]] = &[
|
||||
[-0.5, 0.5],
|
||||
[0.5, 0.5],
|
||||
[0.5, 1.0],
|
||||
[-0.5, 1.0],
|
||||
];
|
||||
const INDICES: &[u16] = &[
|
||||
0, 1, 2,
|
||||
0, 2, 3,
|
||||
];
|
||||
const VERTICES: &[[f32; 2]] = &[[-0.5, 0.5], [0.5, 0.5], [0.5, 1.0], [-0.5, 1.0]];
|
||||
const INDICES: &[u16] = &[0, 1, 2, 0, 2, 3];
|
||||
|
||||
let bind_groups = self.build_bind_groups(device, queue, pipeline, texture_cache);
|
||||
|
||||
|
||||
// Create a draw command with the vertex data then push it to the GPU command queue
|
||||
DrawCommand::new(device, self.pipeline_name.clone(), bind_groups, VERTICES, INDICES)
|
||||
}
|
||||
|
|
@ -57,15 +55,17 @@ impl GuiNode {
|
|||
let binding_staging_buffer = Pipeline::build_binding_staging_buffer(device, &self.form_factor);
|
||||
|
||||
// Construct the bind group for this GUI node
|
||||
let bind_group = Pipeline::build_bind_group(device, &pipeline.bind_group_layout, vec![
|
||||
Pipeline::build_binding_resource(&binding_staging_buffer),
|
||||
wgpu::BindingResource::TextureView(&texture.texture_view),
|
||||
wgpu::BindingResource::Sampler(&texture.sampler),
|
||||
]);
|
||||
|
||||
vec![
|
||||
bind_group,
|
||||
]
|
||||
let bind_group = Pipeline::build_bind_group(
|
||||
device,
|
||||
&pipeline.bind_group_layout,
|
||||
vec![
|
||||
Pipeline::build_binding_resource(&binding_staging_buffer),
|
||||
wgpu::BindingResource::TextureView(&texture.texture_view),
|
||||
wgpu::BindingResource::Sampler(&texture.sampler),
|
||||
],
|
||||
);
|
||||
|
||||
vec![bind_group]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
use crate::layout_abstract_types::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -26,7 +25,11 @@ pub struct LayoutAbstractTag {
|
|||
|
||||
impl LayoutAbstractTag {
|
||||
pub fn new(namespace: String, name: String) -> Self {
|
||||
Self { namespace, name, attributes: Vec::new() }
|
||||
Self {
|
||||
namespace,
|
||||
name,
|
||||
attributes: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_attribute(&mut self, attribute: Attribute) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ pub struct VariableParameter {
|
|||
|
||||
impl VariableParameter {
|
||||
pub fn new(name: String, valid_types: Vec<Vec<TypeName>>, default: Vec<TypeValue>) -> Self {
|
||||
Self { name, type_sequence_options: valid_types, type_sequence_default: default }
|
||||
Self {
|
||||
name,
|
||||
type_sequence_options: valid_types,
|
||||
type_sequence_default: default,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::layout_abstract_types::*;
|
||||
use crate::layout_abstract_syntax::*;
|
||||
use crate::color_palette::ColorPalette;
|
||||
use crate::color::Color;
|
||||
use crate::color_palette::ColorPalette;
|
||||
use crate::layout_abstract_syntax::*;
|
||||
use crate::layout_abstract_types::*;
|
||||
|
||||
pub struct AttributeParser {
|
||||
capture_attribute_declaration_parameter_regex: regex::Regex,
|
||||
|
|
@ -17,8 +17,9 @@ impl AttributeParser {
|
|||
pub fn new() -> Self {
|
||||
let capture_attribute_declaration_parameter_regex: regex::Regex = regex::Regex::new(
|
||||
// Parameter: ?: (?, ... | ...) = ?
|
||||
r"^\s*(\w*)\s*(:)\s*(\()\s*((?:(?:\w+)(?:\s*,\s*\w+)*)(?:\s*\|\s*(?:(?:\w+)(?:\s*,\s*\w+)*))*)\s*(\))\s*(=)\s*([\s\w'\[\]@%\-.`,]*?)\s*$"
|
||||
).unwrap();
|
||||
r"^\s*(\w*)\s*(:)\s*(\()\s*((?:(?:\w+)(?:\s*,\s*\w+)*)(?:\s*\|\s*(?:(?:\w+)(?:\s*,\s*\w+)*))*)\s*(\))\s*(=)\s*([\s\w'\[\]@%\-.`,]*?)\s*$",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let capture_attribute_type_sequences_regex: regex::Regex = regex::Regex::new(concat!(
|
||||
// Argument: {{?}}
|
||||
|
|
@ -47,7 +48,8 @@ impl AttributeParser {
|
|||
r#"^\s*([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])\s*$|"#,
|
||||
// None: none
|
||||
r#"^\s*([Nn][Oo][Nn][Ee])\s*$"#,
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
let match_integer_regex = regex::Regex::new(r"^\s*(-?\d+)\s*$").unwrap();
|
||||
|
||||
|
|
@ -69,15 +71,19 @@ impl AttributeParser {
|
|||
|
||||
pub fn parse_attribute_types(&self, input: &str) -> AttributeValue {
|
||||
let attribute_types = input.split(",").map(|piece| piece.trim()).collect::<Vec<&str>>();
|
||||
let list = attribute_types.iter().map(|attribute_type| self.parse_attribute_type(attribute_type)).collect::<Vec<TypeValueOrArgument>>();
|
||||
let list = attribute_types
|
||||
.iter()
|
||||
.map(|attribute_type| self.parse_attribute_type(attribute_type))
|
||||
.collect::<Vec<TypeValueOrArgument>>();
|
||||
AttributeValue::TypeValue(list)
|
||||
}
|
||||
|
||||
pub fn parse_attribute_type(&self, attribute_type: &str) -> TypeValueOrArgument {
|
||||
// Match with the regular expression
|
||||
let captures = self.capture_attribute_type_sequences_regex.captures(attribute_type).map(|captures|
|
||||
captures.iter().skip(1).flat_map(|c| c).map(|c| c.as_str()).collect::<Vec<_>>()
|
||||
);
|
||||
let captures = self
|
||||
.capture_attribute_type_sequences_regex
|
||||
.captures(attribute_type)
|
||||
.map(|captures| captures.iter().skip(1).flat_map(|c| c).map(|c| c.as_str()).collect::<Vec<_>>());
|
||||
|
||||
// Match against the captured values as a list of tokens
|
||||
let tokens = captures.as_ref().map(|c| c.as_slice());
|
||||
|
|
@ -89,46 +95,50 @@ impl AttributeParser {
|
|||
},
|
||||
// Integer: ?
|
||||
Some([value]) if self.match_integer_regex.is_match(value) => {
|
||||
let integer = value.parse::<i64>().expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
let integer = value
|
||||
.parse::<i64>()
|
||||
.expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Integer(integer))
|
||||
},
|
||||
// Decimal: ?
|
||||
Some([value]) if self.match_decimal_regex.is_match(value) => {
|
||||
let decimal = value.parse::<f64>().expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
let decimal = value
|
||||
.parse::<f64>()
|
||||
.expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Decimal(decimal))
|
||||
},
|
||||
// AbsolutePx: px
|
||||
Some([value, px]) if px.eq_ignore_ascii_case("px") => {
|
||||
let pixels = value.parse::<f32>().expect(&format!("Invalid value `{}` specified in the attribute type`{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
let pixels = value
|
||||
.parse::<f32>()
|
||||
.expect(&format!("Invalid value `{}` specified in the attribute type`{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
TypeValueOrArgument::TypeValue(TypeValue::AbsolutePx(pixels))
|
||||
},
|
||||
// Percent: ?%
|
||||
Some([value, "%"]) => {
|
||||
let percent = value.parse::<f32>().expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
let percent = value
|
||||
.parse::<f32>()
|
||||
.expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Percent(percent))
|
||||
},
|
||||
// PercentRemainder: ?@
|
||||
Some([value, "@"]) => {
|
||||
let percent_remainder = value.parse::<f32>().expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
let percent_remainder = value
|
||||
.parse::<f32>()
|
||||
.expect(&format!("Invalid value `{}` specified in the attribute type `{}` when parsing XML layout", value, attribute_type)[..]);
|
||||
TypeValueOrArgument::TypeValue(TypeValue::PercentRemainder(percent_remainder))
|
||||
},
|
||||
// Inner: inner
|
||||
Some([inner]) if inner.eq_ignore_ascii_case("inner") => {
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Inner)
|
||||
},
|
||||
Some([inner]) if inner.eq_ignore_ascii_case("inner") => TypeValueOrArgument::TypeValue(TypeValue::Inner),
|
||||
// Width: width
|
||||
Some([width]) if width.eq_ignore_ascii_case("width") => {
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Width)
|
||||
},
|
||||
Some([width]) if width.eq_ignore_ascii_case("width") => TypeValueOrArgument::TypeValue(TypeValue::Width),
|
||||
// Height: height
|
||||
Some([height]) if height.eq_ignore_ascii_case("height") => {
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Height)
|
||||
},
|
||||
Some([height]) if height.eq_ignore_ascii_case("height") => TypeValueOrArgument::TypeValue(TypeValue::Height),
|
||||
// TemplateString: `? ... {{?}} ...`
|
||||
Some(["`", string, "`"]) => {
|
||||
let mut segments = Vec::<TemplateStringSegment>::new();
|
||||
let mut is_template = false;
|
||||
|
||||
|
||||
for part in self.split_by_string_templates_regex.split(string) {
|
||||
let segment = match is_template {
|
||||
true => TemplateStringSegment::String(String::from(part)),
|
||||
|
|
@ -144,14 +154,32 @@ impl AttributeParser {
|
|||
Some(["[", color_name, "]"]) => {
|
||||
let color = match self.capture_color_name_in_palette_regex.captures(color_name) {
|
||||
Some(captures) => {
|
||||
let palette_color = captures.get(1).expect(&format!("Invalid palette color name `{}` specified in the attribute type `{}` when parsing XML layout", color_name, attribute_type)[..]).as_str();
|
||||
let palette_color = captures
|
||||
.get(1)
|
||||
.expect(
|
||||
&format!(
|
||||
"Invalid palette color name `{}` specified in the attribute type `{}` when parsing XML layout",
|
||||
color_name, attribute_type
|
||||
)[..],
|
||||
)
|
||||
.as_str();
|
||||
ColorPalette::lookup_palette_color(palette_color).into_color_srgb()
|
||||
}
|
||||
},
|
||||
None => {
|
||||
let parsed = color_name.parse::<css_color_parser::Color>();
|
||||
let css_color = parsed.expect(&format!("Invalid CSS color name `{}` specified in the attribute type `{}` when parsing XML layout", color_name, attribute_type)[..]);
|
||||
Color::new(css_color.r as f32 / 255.0, css_color.g as f32 / 255.0, css_color.b as f32 / 255.0, css_color.a as f32 / 255.0)
|
||||
}
|
||||
let css_color = parsed.expect(
|
||||
&format!(
|
||||
"Invalid CSS color name `{}` specified in the attribute type `{}` when parsing XML layout",
|
||||
color_name, attribute_type
|
||||
)[..],
|
||||
);
|
||||
Color::new(
|
||||
css_color.r as f32 / 255.0,
|
||||
css_color.g as f32 / 255.0,
|
||||
css_color.b as f32 / 255.0,
|
||||
css_color.a as f32 / 255.0,
|
||||
)
|
||||
},
|
||||
};
|
||||
|
||||
TypeValueOrArgument::TypeValue(TypeValue::Color(color))
|
||||
|
|
@ -162,9 +190,7 @@ impl AttributeParser {
|
|||
TypeValueOrArgument::TypeValue(TypeValue::Bool(boolean))
|
||||
},
|
||||
// None: none
|
||||
Some([none]) if none.eq_ignore_ascii_case("none") => {
|
||||
TypeValueOrArgument::TypeValue(TypeValue::None)
|
||||
},
|
||||
Some([none]) if none.eq_ignore_ascii_case("none") => TypeValueOrArgument::TypeValue(TypeValue::None),
|
||||
// Unrecognized type pattern
|
||||
_ => panic!("Invalid attribute type `{}` when parsing XML layout", attribute_type),
|
||||
}
|
||||
|
|
@ -172,9 +198,10 @@ impl AttributeParser {
|
|||
|
||||
pub fn parse_attribute_declaration(&self, attribute_declaration: &str) -> AttributeValue {
|
||||
// Match with the regular expression
|
||||
let captures = self.capture_attribute_declaration_parameter_regex.captures(attribute_declaration).map(|captures|
|
||||
captures.iter().skip(1).flat_map(|c| c).map(|c| c.as_str()).collect::<Vec<_>>()
|
||||
);
|
||||
let captures = self
|
||||
.capture_attribute_declaration_parameter_regex
|
||||
.captures(attribute_declaration)
|
||||
.map(|captures| captures.iter().skip(1).flat_map(|c| c).map(|c| c.as_str()).collect::<Vec<_>>());
|
||||
|
||||
// Match against the captured values as a list of tokens
|
||||
let tokens = captures.as_ref().map(|c| c.as_slice());
|
||||
|
|
@ -183,43 +210,56 @@ impl AttributeParser {
|
|||
Some([name, ":", "(", raw_types_list, ")", "=", default_value]) => {
|
||||
// Variable name bound in the parameter
|
||||
let name = String::from(*name);
|
||||
|
||||
// Split the type sequences up into a list of options separated by vertical bars
|
||||
let type_sequence_options = String::from(*raw_types_list).split("|").map(|group| {
|
||||
// Split each type sequence into individual types separated by commas
|
||||
group.split(",").map(|individual_type| {
|
||||
// Remove any whitespace around the type
|
||||
let individual_type = individual_type.trim();
|
||||
|
||||
// Return the case-insensitive TypeName enum for the individual type
|
||||
match &individual_type.to_ascii_lowercase()[..] {
|
||||
// "xml" => TypeName::Xml, // TODO
|
||||
"integer" => TypeName::Integer,
|
||||
"decimal" => TypeName::Decimal,
|
||||
"absolutepx" => TypeName::AbsolutePx,
|
||||
"percent" => TypeName::Percent,
|
||||
"percentremainder" => TypeName::PercentRemainder,
|
||||
"inner" => TypeName::Inner,
|
||||
"width" => TypeName::Width,
|
||||
"height" => TypeName::Height,
|
||||
"templatestring" => TypeName::TemplateString,
|
||||
"color" => TypeName::Color,
|
||||
"bool" => TypeName::Bool,
|
||||
"none" => TypeName::None,
|
||||
_ => panic!("Invalid type `{}` specified in the attribute type `{}` when parsing XML layout", individual_type, attribute_declaration),
|
||||
}
|
||||
}).collect::<Vec<TypeName>>()
|
||||
}).collect::<Vec<Vec<TypeName>>>();
|
||||
// Split the type sequences up into a list of options separated by vertical bars
|
||||
let type_sequence_options = String::from(*raw_types_list)
|
||||
.split("|")
|
||||
.map(|group| {
|
||||
// Split each type sequence into individual types separated by commas
|
||||
group
|
||||
.split(",")
|
||||
.map(|individual_type| {
|
||||
// Remove any whitespace around the type
|
||||
let individual_type = individual_type.trim();
|
||||
|
||||
// Return the case-insensitive TypeName enum for the individual type
|
||||
match &individual_type.to_ascii_lowercase()[..] {
|
||||
// "xml" => TypeName::Xml, // TODO
|
||||
"integer" => TypeName::Integer,
|
||||
"decimal" => TypeName::Decimal,
|
||||
"absolutepx" => TypeName::AbsolutePx,
|
||||
"percent" => TypeName::Percent,
|
||||
"percentremainder" => TypeName::PercentRemainder,
|
||||
"inner" => TypeName::Inner,
|
||||
"width" => TypeName::Width,
|
||||
"height" => TypeName::Height,
|
||||
"templatestring" => TypeName::TemplateString,
|
||||
"color" => TypeName::Color,
|
||||
"bool" => TypeName::Bool,
|
||||
"none" => TypeName::None,
|
||||
_ => panic!(
|
||||
"Invalid type `{}` specified in the attribute type `{}` when parsing XML layout",
|
||||
individual_type, attribute_declaration
|
||||
),
|
||||
}
|
||||
})
|
||||
.collect::<Vec<TypeName>>()
|
||||
})
|
||||
.collect::<Vec<Vec<TypeName>>>();
|
||||
|
||||
// Required default value for the variable parameter if not provided
|
||||
let default_type_sequence = default_value.split(",").map(|individual_type|
|
||||
match self.parse_attribute_type(individual_type) {
|
||||
let default_type_sequence = default_value
|
||||
.split(",")
|
||||
.map(|individual_type| match self.parse_attribute_type(individual_type) {
|
||||
TypeValueOrArgument::TypeValue(type_value) => type_value,
|
||||
TypeValueOrArgument::VariableArgument(variable_value) => {
|
||||
panic!("Found the default variable value `{:?}` in the attribute declaration `{}` which only allows typed values, when parsing XML layout", variable_value, attribute_declaration);
|
||||
panic!(
|
||||
"Found the default variable value `{:?}` in the attribute declaration `{}` which only allows typed values, when parsing XML layout",
|
||||
variable_value, attribute_declaration
|
||||
);
|
||||
},
|
||||
}
|
||||
).collect::<Vec<TypeValue>>();
|
||||
})
|
||||
.collect::<Vec<TypeValue>>();
|
||||
|
||||
// Return the parameter
|
||||
AttributeValue::VariableParameter(VariableParameter::new(name, type_sequence_options, default_type_sequence))
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
// pub struct LayoutDomNode {
|
||||
// pub namespace: String,
|
||||
// pub name: String,
|
||||
// pub placement:
|
||||
// pub placement:
|
||||
// // pub body: Vec<LayoutDomNode>
|
||||
// }
|
||||
|
||||
// pub struct LayoutPlacement {
|
||||
// pub width: f32,
|
||||
// pub height: f32,
|
||||
// pub x_align:
|
||||
// }
|
||||
// pub x_align:
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::fs;
|
||||
use std::io;
|
||||
use std::collections::HashSet;
|
||||
use crate::layout_abstract_syntax::*;
|
||||
use crate::layout_attribute_parser::*;
|
||||
use crate::resource_cache::ResourceCache;
|
||||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
|
||||
pub struct LayoutSystem {
|
||||
// pub dom_tree: rctree::Node<
|
||||
|
|
@ -38,7 +38,7 @@ impl LayoutSystem {
|
|||
|
||||
fn explore_referenced_layouts(&mut self, layout_tree_root: &rctree::Node<LayoutAbstractNode>, already_loaded_layouts: &mut HashSet<String>) {
|
||||
for child_tag in layout_tree_root.descendants() {
|
||||
match & *child_tag.borrow() {
|
||||
match &*child_tag.borrow() {
|
||||
// Tags are references to other XML layouts that should be loaded and cached
|
||||
LayoutAbstractNode::Tag(layout_abstract_tag) => {
|
||||
// Cache key in form namespace:name
|
||||
|
|
@ -56,7 +56,7 @@ impl LayoutSystem {
|
|||
// Keep track of it being loaded to prevent duplicate work
|
||||
let key_copy = key.clone();
|
||||
already_loaded_layouts.insert(key);
|
||||
|
||||
|
||||
// Recursively explore the newly loaded layout's tags
|
||||
self.explore_referenced_layouts(&new_loaded_layout, already_loaded_layouts);
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ impl LayoutSystem {
|
|||
let mut current_opening_tag: Option<LayoutAbstractNode> = None;
|
||||
// Top-level node that is popped from the stack when the closing tag is reached at the end of the XML document
|
||||
let mut final_result: Option<rctree::Node<LayoutAbstractNode>> = None;
|
||||
|
||||
|
||||
for token in parser {
|
||||
match token.unwrap() {
|
||||
// Beginning of an opening tag (<NAMESPACE:NAME ...)
|
||||
|
|
@ -133,7 +133,8 @@ impl LayoutSystem {
|
|||
string.push(':');
|
||||
string.push_str(slice);
|
||||
string
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
String::from(local.as_str())
|
||||
};
|
||||
// Set the value to an ordinary string slice of the given value
|
||||
|
|
@ -212,11 +213,13 @@ impl LayoutSystem {
|
|||
xmlparser::Token::Text { text } => {
|
||||
// Trim any whitespace from around the string
|
||||
let text_string = String::from(text.as_str().trim());
|
||||
|
||||
|
||||
// If the string isn't all whitespace, append a new text node to the parent
|
||||
if !text_string.is_empty() {
|
||||
// Get the tree node which contains this text
|
||||
let parent_node = stack.last_mut().expect(&format!("Encountered text outside the root tag when parsing XML layout in file: {}", path)[..]);
|
||||
let parent_node = stack
|
||||
.last_mut()
|
||||
.expect(&format!("Encountered text outside the root tag when parsing XML layout in file: {}", path)[..]);
|
||||
|
||||
// Construct an AST text node with the provided text
|
||||
let abstract_text_node = LayoutAbstractNode::new_text(text_string);
|
||||
|
|
@ -227,10 +230,10 @@ impl LayoutSystem {
|
|||
parent_node.append(new_tree_node);
|
||||
}
|
||||
},
|
||||
_ => {}
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
match final_result {
|
||||
None => panic!("Invalid syntax when parsing XML layout in file: {}", path),
|
||||
Some(tree) => Ok(tree),
|
||||
|
|
@ -242,4 +245,4 @@ impl LayoutSystem {
|
|||
println!("{:?}", node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
src/main.rs
16
src/main.rs
|
|
@ -1,19 +1,19 @@
|
|||
mod application;
|
||||
mod pipeline;
|
||||
mod texture;
|
||||
mod color;
|
||||
mod color_palette;
|
||||
mod resource_cache;
|
||||
mod shader_stage;
|
||||
mod draw_command;
|
||||
mod gui_node;
|
||||
mod gui_attributes;
|
||||
mod window_events;
|
||||
mod layout_system;
|
||||
mod layout_abstract_types;
|
||||
mod gui_node;
|
||||
mod layout_abstract_syntax;
|
||||
mod layout_abstract_types;
|
||||
mod layout_attribute_parser;
|
||||
mod layout_dom_node;
|
||||
mod layout_system;
|
||||
mod pipeline;
|
||||
mod resource_cache;
|
||||
mod shader_stage;
|
||||
mod texture;
|
||||
mod window_events;
|
||||
|
||||
use application::Application;
|
||||
use winit::event_loop::EventLoop;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::mem;
|
||||
use crate::resource_cache::ResourceCache;
|
||||
use crate::shader_stage;
|
||||
use std::mem;
|
||||
|
||||
pub struct Pipeline {
|
||||
pub bind_group_layout: wgpu::BindGroupLayout,
|
||||
|
|
@ -8,25 +8,34 @@ pub struct Pipeline {
|
|||
}
|
||||
|
||||
impl Pipeline {
|
||||
pub fn new(device: &wgpu::Device, swap_chain_color_format: wgpu::TextureFormat, extra_layouts: Vec<&wgpu::BindGroupLayout>, shader_cache: &mut ResourceCache<wgpu::ShaderModule>, shader_pair_path: (&str, &str)) -> Self {
|
||||
pub fn new(
|
||||
device: &wgpu::Device,
|
||||
swap_chain_color_format: wgpu::TextureFormat,
|
||||
extra_layouts: Vec<&wgpu::BindGroupLayout>,
|
||||
shader_cache: &mut ResourceCache<wgpu::ShaderModule>,
|
||||
shader_pair_path: (&str, &str),
|
||||
) -> Self {
|
||||
// Load the vertex and fragment shaders
|
||||
let shader_pair = Pipeline::get_shader_pair(device, shader_cache, shader_pair_path);
|
||||
|
||||
// Prepare a bind group layout for the GUI element's texture and form factor data
|
||||
let bind_group_layout = Pipeline::build_bind_group_layout(device, &vec![
|
||||
wgpu::BindingType::UniformBuffer { dynamic: false },
|
||||
wgpu::BindingType::SampledTexture {
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
multisampled: false,
|
||||
},
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
]);
|
||||
|
||||
let bind_group_layout = Pipeline::build_bind_group_layout(
|
||||
device,
|
||||
&vec![
|
||||
wgpu::BindingType::UniformBuffer { dynamic: false },
|
||||
wgpu::BindingType::SampledTexture {
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
multisampled: false,
|
||||
},
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
],
|
||||
);
|
||||
|
||||
// Combine all bind group layouts
|
||||
let mut bind_group_layouts = vec![&bind_group_layout];
|
||||
bind_group_layouts.append(&mut extra_layouts.clone());
|
||||
|
||||
|
||||
// Construct the pipeline
|
||||
let render_pipeline = Pipeline::build_pipeline(device, swap_chain_color_format, bind_group_layouts, shader_pair);
|
||||
Self {
|
||||
|
|
@ -35,7 +44,11 @@ impl Pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_shader_pair<'a>(device: &wgpu::Device, shader_cache: &'a mut ResourceCache<wgpu::ShaderModule>, shader_pair_path: (&str, &str)) -> (&'a wgpu::ShaderModule, &'a wgpu::ShaderModule) {
|
||||
pub fn get_shader_pair<'a>(
|
||||
device: &wgpu::Device,
|
||||
shader_cache: &'a mut ResourceCache<wgpu::ShaderModule>,
|
||||
shader_pair_path: (&str, &str),
|
||||
) -> (&'a wgpu::ShaderModule, &'a wgpu::ShaderModule) {
|
||||
// If uncached, construct a vertex shader loaded from its source code file
|
||||
if shader_cache.get(shader_pair_path.0).is_none() {
|
||||
let vertex_shader_module = shader_stage::compile_from_glsl(device, shader_pair_path.0, glsl_to_spirv::ShaderType::Vertex).unwrap();
|
||||
|
|
@ -56,28 +69,31 @@ impl Pipeline {
|
|||
}
|
||||
|
||||
pub fn build_bind_group_layouts(device: &wgpu::Device, bind_group_layouts: &Vec<Vec<wgpu::BindingType>>) -> Vec<wgpu::BindGroupLayout> {
|
||||
bind_group_layouts.into_iter().map(|layout_entry| Self::build_bind_group_layout(device, layout_entry)).collect::<Vec<_>>()
|
||||
bind_group_layouts
|
||||
.into_iter()
|
||||
.map(|layout_entry| Self::build_bind_group_layout(device, layout_entry))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub fn build_bind_group_layout(device: &wgpu::Device, bind_group_layout: &Vec<wgpu::BindingType>) -> wgpu::BindGroupLayout {
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
bindings: bind_group_layout.into_iter().enumerate().map(|(index, binding_type)|
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
bindings: bind_group_layout
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, binding_type)| wgpu::BindGroupLayoutEntry {
|
||||
binding: index as u32,
|
||||
visibility: wgpu::ShaderStage::all(),
|
||||
ty: binding_type.clone(),
|
||||
}
|
||||
).collect::<Vec<_>>().as_slice(),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.as_slice(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn build_binding_staging_buffer<T: bytemuck::Pod>(device: &wgpu::Device, resource: &T) -> wgpu::Buffer {
|
||||
// Construct a staging buffer with the binary uniform struct data
|
||||
device.create_buffer_with_data(
|
||||
bytemuck::cast_slice(&[*resource]),
|
||||
wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
|
||||
)
|
||||
device.create_buffer_with_data(bytemuck::cast_slice(&[*resource]), wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST)
|
||||
}
|
||||
|
||||
pub fn build_binding_resource(resource_buffer: &wgpu::Buffer) -> wgpu::BindingResource {
|
||||
|
|
@ -89,12 +105,14 @@ impl Pipeline {
|
|||
}
|
||||
|
||||
pub fn build_bind_group(device: &wgpu::Device, bind_group_layout: &wgpu::BindGroupLayout, binding_resources: Vec<wgpu::BindingResource>) -> wgpu::BindGroup {
|
||||
let bindings = binding_resources.into_iter().enumerate().map(|(index, binding_resource)|
|
||||
wgpu::Binding {
|
||||
let bindings = binding_resources
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, binding_resource)| wgpu::Binding {
|
||||
binding: index as u32,
|
||||
resource: binding_resource,
|
||||
}
|
||||
).collect::<Vec<_>>();
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: bind_group_layout,
|
||||
|
|
@ -103,11 +121,16 @@ impl Pipeline {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn build_pipeline(device: &wgpu::Device, swap_chain_color_format: wgpu::TextureFormat, bind_group_layouts: Vec<&wgpu::BindGroupLayout>, shader_pair: (&wgpu::ShaderModule, &wgpu::ShaderModule)) -> wgpu::RenderPipeline {
|
||||
pub fn build_pipeline(
|
||||
device: &wgpu::Device,
|
||||
swap_chain_color_format: wgpu::TextureFormat,
|
||||
bind_group_layouts: Vec<&wgpu::BindGroupLayout>,
|
||||
shader_pair: (&wgpu::ShaderModule, &wgpu::ShaderModule),
|
||||
) -> wgpu::RenderPipeline {
|
||||
let render_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
bind_group_layouts: bind_group_layouts.as_slice(),
|
||||
});
|
||||
|
||||
|
||||
let (vertex_shader, fragment_shader) = shader_pair;
|
||||
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
layout: &render_pipeline_layout,
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ impl<T> ResourceCache<T> {
|
|||
let resources = Vec::new();
|
||||
let name_to_id = HashMap::new();
|
||||
|
||||
Self {
|
||||
resources,
|
||||
name_to_id,
|
||||
}
|
||||
Self { resources, name_to_id }
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -49,4 +46,4 @@ impl<T> ResourceCache<T> {
|
|||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ pub fn compile_from_glsl(device: &wgpu::Device, path: &str, shader_type: glsl_to
|
|||
let shader = device.create_shader_module(&compiled);
|
||||
|
||||
Ok(shader)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::fs;
|
||||
use image::GenericImageView;
|
||||
use crate::resource_cache::ResourceCache;
|
||||
use image::GenericImageView;
|
||||
use std::fs;
|
||||
|
||||
pub struct Texture {
|
||||
pub texture: wgpu::Texture,
|
||||
|
|
@ -21,11 +21,11 @@ impl Texture {
|
|||
pub fn from_filepath(device: &wgpu::Device, queue: &mut wgpu::Queue, path: &str) -> Result<Self, failure::Error> {
|
||||
// Read the raw bytes from the specified file
|
||||
let bytes = fs::read(path)?;
|
||||
|
||||
|
||||
// Construct and return a Texture from the bytes
|
||||
Texture::from_bytes(device, queue, &bytes[..])
|
||||
}
|
||||
|
||||
|
||||
pub fn from_bytes(device: &wgpu::Device, queue: &mut wgpu::Queue, bytes: &[u8]) -> Result<Self, failure::Error> {
|
||||
// Create an image with the Image library
|
||||
let image = image::load_from_memory(bytes)?;
|
||||
|
|
@ -67,7 +67,7 @@ impl Texture {
|
|||
offset: 0,
|
||||
bytes_per_row: 4 * dimensions.0,
|
||||
rows_per_image: dimensions.1,
|
||||
},
|
||||
},
|
||||
wgpu::TextureCopyView {
|
||||
texture: &texture,
|
||||
mip_level: 0,
|
||||
|
|
@ -96,7 +96,11 @@ impl Texture {
|
|||
lod_max_clamp: 100.0,
|
||||
compare: wgpu::CompareFunction::Always,
|
||||
});
|
||||
|
||||
Ok(Self { texture, texture_view: view, sampler })
|
||||
|
||||
Ok(Self {
|
||||
texture,
|
||||
texture_view: view,
|
||||
sampler,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,16 @@ pub fn window_event(application: &mut Application, control_flow: &mut ControlFlo
|
|||
|
||||
fn keyboard_event(application: &mut Application, control_flow: &mut ControlFlow, input: &KeyboardInput) {
|
||||
match input {
|
||||
KeyboardInput { state: ElementState::Pressed, virtual_keycode: Some(VirtualKeyCode::Escape), .. } => quit(control_flow),
|
||||
KeyboardInput { state: ElementState::Pressed, virtual_keycode: Some(VirtualKeyCode::Space), .. } => {
|
||||
KeyboardInput {
|
||||
state: ElementState::Pressed,
|
||||
virtual_keycode: Some(VirtualKeyCode::Escape),
|
||||
..
|
||||
} => quit(control_flow),
|
||||
KeyboardInput {
|
||||
state: ElementState::Pressed,
|
||||
virtual_keycode: Some(VirtualKeyCode::Space),
|
||||
..
|
||||
} => {
|
||||
// const VERTICES: &[[f32; 2]] = &[
|
||||
// [-0.2, 0.0],
|
||||
// [0.2, 0.0],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue