This commit is contained in:
davidontop 2024-02-10 13:15:50 +01:00
parent 3516d6b906
commit ed82719870
Signed by: DavidOnTop
GPG key ID: FAB914DDC2F180EB
5 changed files with 164 additions and 158 deletions

241
Cargo.lock generated
View file

@ -208,9 +208,23 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.14.0" version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]] [[package]]
name = "bytes" name = "bytes"
@ -283,10 +297,35 @@ dependencies = [
] ]
[[package]] [[package]]
name = "com-rs" name = "com"
version = "0.2.1" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6"
dependencies = [
"com_macros",
]
[[package]]
name = "com_macros"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5"
dependencies = [
"com_macros_support",
"proc-macro2",
"syn 1.0.109",
]
[[package]]
name = "com_macros_support"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "combine" name = "combine"
@ -364,9 +403,9 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
[[package]] [[package]]
name = "d3d12" name = "d3d12"
version = "0.7.0" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20" checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.1",
"libloading 0.8.1", "libloading 0.8.1",
@ -410,18 +449,6 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "flume"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
dependencies = [
"futures-core",
"futures-sink",
"nanorand",
"spin",
]
[[package]] [[package]]
name = "foreign-types" name = "foreign-types"
version = "0.5.0" version = "0.5.0"
@ -440,7 +467,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -449,18 +476,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "futures-core"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
[[package]]
name = "futures-sink"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
[[package]] [[package]]
name = "gethostname" name = "gethostname"
version = "0.3.0" version = "0.3.0"
@ -478,10 +493,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys",
"libc", "libc",
"wasi", "wasi",
"wasm-bindgen",
] ]
[[package]] [[package]]
@ -503,9 +516,9 @@ dependencies = [
[[package]] [[package]]
name = "glow" name = "glow"
version = "0.13.0" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "886c2a30b160c4c6fec8f987430c26b526b7988ca71f664e6a699ddf6f9601e4" checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"slotmap", "slotmap",
@ -543,11 +556,10 @@ dependencies = [
[[package]] [[package]]
name = "gpu-allocator" name = "gpu-allocator"
version = "0.23.0" version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40fe17c8a05d60c38c0a4e5a3c802f2f1ceb66b76c67d96ffb34bef0475a7fad" checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
dependencies = [ dependencies = [
"backtrace",
"log", "log",
"presser", "presser",
"thiserror", "thiserror",
@ -587,14 +599,14 @@ dependencies = [
[[package]] [[package]]
name = "hassle-rs" name = "hassle-rs"
version = "0.10.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.4.1",
"com-rs", "com",
"libc", "libc",
"libloading 0.7.4", "libloading 0.8.1",
"thiserror", "thiserror",
"widestring", "widestring",
"winapi", "winapi",
@ -666,9 +678,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.66" version = "0.3.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -825,9 +837,9 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.14.2" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e" checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags 2.4.1", "bitflags 2.4.1",
@ -843,15 +855,6 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "nanorand"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom",
]
[[package]] [[package]]
name = "ndk" name = "ndk"
version = "0.8.0" version = "0.8.0"
@ -942,7 +945,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1104,9 +1107,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.70" version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -1128,9 +1131,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.33" version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -1140,6 +1143,7 @@ name = "randr"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytemuck",
"tokio", "tokio",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@ -1266,7 +1270,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1355,23 +1359,13 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
"lock_api",
]
[[package]] [[package]]
name = "spirv" name = "spirv"
version = "0.2.0+1.5.4" version = "0.3.0+sdk-1.3.268.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.4.1",
"num-traits",
] ]
[[package]] [[package]]
@ -1388,9 +1382,20 @@ checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.39" version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1399,31 +1404,31 @@ dependencies = [
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.4.0" version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.51" version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.51" version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1488,7 +1493,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1527,7 +1532,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1625,9 +1630,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.89" version = "0.2.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -1635,24 +1640,24 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.89" version = "0.2.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.39" version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@ -1662,9 +1667,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.89" version = "0.2.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -1672,22 +1677,22 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.89" version = "0.2.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.89" version = "0.2.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
[[package]] [[package]]
name = "wayland-backend" name = "wayland-backend"
@ -1800,9 +1805,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.64" version = "0.3.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -1820,19 +1825,19 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.18.0" version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30e7d227c9f961f2061c26f4cb0fbd4df0ef37e056edd0931783599d6c94ef24" checksum = "0bfe9a310dcf2e6b85f00c46059aaeaf4184caa8e29a1ecd4b7a704c3482332d"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg-if", "cfg-if",
"flume", "cfg_aliases",
"js-sys", "js-sys",
"log", "log",
"naga", "naga",
"parking_lot", "parking_lot",
"profiling", "profiling",
"raw-window-handle 0.5.2", "raw-window-handle 0.6.0",
"smallvec", "smallvec",
"static_assertions", "static_assertions",
"wasm-bindgen", "wasm-bindgen",
@ -1845,19 +1850,22 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.18.1" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726" checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
"bitflags 2.4.1", "bitflags 2.4.1",
"cfg_aliases",
"codespan-reporting", "codespan-reporting",
"indexmap",
"log", "log",
"naga", "naga",
"once_cell",
"parking_lot", "parking_lot",
"profiling", "profiling",
"raw-window-handle 0.5.2", "raw-window-handle 0.6.0",
"rustc-hash", "rustc-hash",
"smallvec", "smallvec",
"thiserror", "thiserror",
@ -1868,9 +1876,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "0.18.1" version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b84ecc802da3eb67b4cf3dd9ea6fe45bbb47ef13e6c49c5c3240868a9cc6cdd9" checksum = "e3bb47856236bfafc0bc591a925eb036ac19cd987624a447ff353e7a7e7e6f72"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
@ -1878,6 +1886,7 @@ dependencies = [
"bit-set", "bit-set",
"bitflags 2.4.1", "bitflags 2.4.1",
"block", "block",
"cfg_aliases",
"core-graphics-types", "core-graphics-types",
"d3d12", "d3d12",
"glow", "glow",
@ -1898,7 +1907,7 @@ dependencies = [
"parking_lot", "parking_lot",
"profiling", "profiling",
"range-alloc", "range-alloc",
"raw-window-handle 0.5.2", "raw-window-handle 0.6.0",
"renderdoc-sys", "renderdoc-sys",
"rustc-hash", "rustc-hash",
"smallvec", "smallvec",
@ -1911,9 +1920,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.18.0" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd" checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.1",
"js-sys", "js-sys",
@ -2335,5 +2344,5 @@ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.48",
] ]

View file

@ -10,12 +10,13 @@ license = "MIT"
repository = "git@github.com:davidon-top/randr.git" repository = "git@github.com:davidon-top/randr.git"
[dependencies] [dependencies]
anyhow = "1.0.75" anyhow = "1"
wgpu = "0.18.0" wgpu = "0.19"
winit = { version = "0.29.4", features = ["rwh_05"] } winit = { version = "0.29", features = ["rwh_05"] }
winit_input_helper = "0.15.1" winit_input_helper = "0.15"
tracing = "0.1" tracing = "0.1"
bytemuck = { version = "1.14", features = ["derive"] }
[dev-dependencies] [dev-dependencies]
tokio = { version = "1.35.1", features = ["full"] } tokio = { version = "1", features = ["full"] }
tracing-subscriber = "0.3" tracing-subscriber = "0.3"

View file

@ -1,19 +1,19 @@
use randr::{Renderer, App, Wgpu, AppDI}; use randr::{Renderer, App, Wgpu, AppDI};
use wgpu::{include_wgsl, TextureFormat}; use wgpu::{include_wgsl, TextureFormat};
use winit::{event_loop::{EventLoop, EventLoopBuilder}, platform::wayland::EventLoopBuilderExtWayland}; use winit::{event_loop::{EventLoop, EventLoopBuilder}, platform::wayland::EventLoopBuilderExtWayland, window};
struct Randr { struct Randr {
color: wgpu::Color, color: wgpu::Color,
clear_color: wgpu::Color, clear_color: wgpu::Color,
render_pipeline: Option<wgpu::RenderPipeline>, render_pipeline: wgpu::RenderPipeline,
} }
impl Default for Randr { impl Randr {
fn default() -> Self { pub fn new(render_pipeline: wgpu::RenderPipeline) -> Self {
Self { Self {
color: wgpu::Color::BLUE, color: wgpu::Color::BLUE,
clear_color: wgpu::Color::BLACK, clear_color: wgpu::Color::BLACK,
render_pipeline: None, render_pipeline,
} }
} }
} }
@ -38,7 +38,7 @@ impl Renderer for Randr {
occlusion_query_set: None, occlusion_query_set: None,
}); });
rpass.set_pipeline(&self.render_pipeline.as_ref().unwrap()); rpass.set_pipeline(&self.render_pipeline);
rpass.draw(0..3, 0..1); rpass.draw(0..3, 0..1);
drop(rpass); drop(rpass);
@ -48,7 +48,18 @@ impl Renderer for Randr {
Ok(()) Ok(())
} }
fn init(&mut self, _window: &winit::window::Window, wgpu: &Wgpu, swapchain_formats: TextureFormat) -> anyhow::Result<()> {
fn resize(&mut self, _size: winit::dpi::PhysicalSize<u32>) {}
fn input(&mut self, _input: &winit_input_helper::WinitInputHelper) {}
fn update(&mut self, _wgpu: &Wgpu) {}
}
#[tokio::test]
async fn hello_triangle() {
let renderer = |window: &window::Window, wgpu: &Wgpu, swapchain_formats: TextureFormat| {
let shader = wgpu.device.create_shader_module(include_wgsl!("shader.wgsl")); let shader = wgpu.device.create_shader_module(include_wgsl!("shader.wgsl"));
let pipeline_layout = wgpu.device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { let pipeline_layout = wgpu.device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
@ -75,27 +86,9 @@ impl Renderer for Randr {
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
multiview: None, multiview: None,
}); });
self.render_pipeline = Some(render_pipeline); Randr::new(render_pipeline)
Ok(()) };
}
fn resize(&mut self, _size: winit::dpi::PhysicalSize<u32>) {}
fn input(&mut self, _input: &winit_input_helper::WinitInputHelper) {}
fn update(&mut self, _wgpu: &Wgpu) {}
} let event_loop = EventLoopBuilder::new().with_wayland().with_any_thread(true).build().unwrap();
App::new(renderer, &event_loop, AppDI::default()).await.run(event_loop).unwrap();
#[test]
fn hello_triangle() {
tracing_subscriber::fmt().with_max_level(tracing::Level::TRACE).init();
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(async {
let event_loop = EventLoopBuilder::new().with_wayland().with_any_thread(true).build().unwrap();
App::new(Randr::default(), &event_loop, AppDI::default()).await.run(event_loop).unwrap();
});
} }

View file

@ -1,12 +1,13 @@
pub use wgpu; pub use wgpu;
pub use winit; pub use winit;
pub use winit_input_helper; pub use winit_input_helper;
pub use anyhow;
pub use bytemuck;
use wgpu::{SurfaceError, TextureFormat}; use wgpu::{SurfaceError, TextureFormat};
use winit::{event::{WindowEvent, Event}, error::EventLoopError, event_loop::EventLoop}; use winit::{event::{WindowEvent, Event}, error::EventLoopError, event_loop::EventLoop};
pub trait Renderer: Sized { pub trait Renderer: Sized {
fn init(&mut self, _window: &winit::window::Window, _wgpu: &Wgpu, _swapchain_formats: TextureFormat) -> anyhow::Result<()> {Ok(())}
fn resize(&mut self, _size: winit::dpi::PhysicalSize<u32>) {} fn resize(&mut self, _size: winit::dpi::PhysicalSize<u32>) {}
fn input(&mut self, _input: &winit_input_helper::WinitInputHelper) {} fn input(&mut self, _input: &winit_input_helper::WinitInputHelper) {}
fn update(&mut self, _wgpu: &Wgpu) {} fn update(&mut self, _wgpu: &Wgpu) {}
@ -20,8 +21,8 @@ pub struct App<R: Renderer> {
pub wgpu: Wgpu, pub wgpu: Wgpu,
} }
pub struct Wgpu { pub struct Wgpu<'window> {
pub surface: wgpu::Surface, pub surface: wgpu::Surface<'window>,
pub device: wgpu::Device, pub device: wgpu::Device,
pub queue: wgpu::Queue, pub queue: wgpu::Queue,
pub config: wgpu::SurfaceConfiguration, pub config: wgpu::SurfaceConfiguration,
@ -39,7 +40,8 @@ pub struct AppDI {
} }
impl<R: Renderer> App<R> { impl<R: Renderer> App<R> {
pub async fn new(mut renderer: R, event_loop: &EventLoop<()>, di: AppDI) -> Self { pub async fn new<F>(renderer: F, event_loop: &EventLoop<()>, di: AppDI) -> Self
where F: FnOnce(&winit::window::Window, &Wgpu, TextureFormat) -> R {
let input = winit_input_helper::WinitInputHelper::new(); let input = winit_input_helper::WinitInputHelper::new();
let window = di.window.unwrap_or_else(|| winit::window::WindowBuilder::new()) let window = di.window.unwrap_or_else(|| winit::window::WindowBuilder::new())
.build(&event_loop).unwrap(); .build(&event_loop).unwrap();
@ -58,8 +60,8 @@ impl<R: Renderer> App<R> {
let (device, queue) = adapter.request_device( let (device, queue) = adapter.request_device(
&wgpu::DeviceDescriptor { &wgpu::DeviceDescriptor {
label: None, label: None,
features: di.features.unwrap_or_default(), required_features: di.features.unwrap_or_default(),
limits: di.limits.unwrap_or_default(), required_limits: di.limits.unwrap_or_default(),
}, },
None, None,
).await.unwrap(); ).await.unwrap();
@ -75,14 +77,15 @@ impl<R: Renderer> App<R> {
present_mode: di.present_mode.unwrap_or_default(), present_mode: di.present_mode.unwrap_or_default(),
alpha_mode: swapchain_capabilities.alpha_modes[0], alpha_mode: swapchain_capabilities.alpha_modes[0],
view_formats: vec![], view_formats: vec![],
desired_maximum_frame_latency: 0,
}; };
surface.configure(&device, &config); surface.configure(&device, &config);
let wgpu = Wgpu { surface, device, queue, config, size }; let wgpu = Wgpu { surface, device, queue, config, size };
renderer.init(&window, &wgpu, swapchain_formats).unwrap(); let randr = renderer(&window, &wgpu, swapchain_formats);
Self { renderer, input, window, wgpu } Self { renderer: randr, input, window, wgpu }
} }
fn resize(&mut self, size: winit::dpi::PhysicalSize<u32>) { fn resize(&mut self, size: winit::dpi::PhysicalSize<u32>) {