diff --git a/Cargo.lock b/Cargo.lock index 59f8300..bcba29d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,16 +18,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" -[[package]] -name = "accesskit" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4700bdc115b306d6c43381c344dc307f03b7f0460c304e4892c309930322bd7" -dependencies = [ - "enumn", - "serde", -] - [[package]] name = "addr2line" version = "0.22.0" @@ -58,7 +48,6 @@ dependencies = [ "cfg-if", "getrandom", "once_cell", - "serde", "version_check", "zerocopy", ] @@ -194,14 +183,14 @@ checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "app-surface" -version = "1.1.0" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a87749c4adc38961ab4c1c8b90237d14cab7111bb254c9ce2e40912e3a5353" +checksum = "c423e84f3c04145fcbc24a81dab06059a85af5121674e08cd49faea87bd7b2e8" dependencies = [ "android_logger", "ash", "cfg-if", - "core-graphics", + "core-graphics 0.24.0", "env_logger 0.11.5", "glam", "jni", @@ -241,7 +230,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -335,18 +324,18 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bit-set" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bit_field" @@ -401,9 +390,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" dependencies = [ "bytemuck_derive", ] @@ -416,7 +405,7 @@ checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -439,9 +428,9 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "calloop" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ "bitflags 2.6.0", "log", @@ -453,9 +442,9 @@ dependencies = [ [[package]] name = "calloop-wayland-source" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ "calloop", "rustix", @@ -553,37 +542,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" -[[package]] -name = "com" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -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]] name = "combine" version = "4.6.7" @@ -639,6 +597,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -652,8 +620,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types 0.5.0", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", "foreign-types 0.5.0", "libc", ] @@ -665,7 +646,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "libc", ] @@ -715,17 +707,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" -[[package]] -name = "d3d12" -version = "22.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017" -dependencies = [ - "bitflags 2.6.0", - "libloading", - "winapi", -] - [[package]] name = "derive_more" version = "0.99.18" @@ -736,7 +717,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -783,32 +764,29 @@ checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" [[package]] name = "ecolor" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ "bytemuck", "emath", - "serde", ] [[package]] name = "egui" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ - "accesskit", "ahash", "emath", "epaint", "log", "nohash-hasher", - "serde", ] [[package]] name = "egui-wgpu" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ "ahash", "bytemuck", @@ -824,8 +802,8 @@ dependencies = [ [[package]] name = "egui-winit" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ "ahash", "egui", @@ -837,15 +815,14 @@ dependencies = [ [[package]] name = "egui_extras" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ "ahash", "egui", "enum-map", "log", "mime_guess2", - "serde", ] [[package]] @@ -856,11 +833,10 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emath" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ "bytemuck", - "serde", ] [[package]] @@ -890,18 +866,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", -] - -[[package]] -name = "enumn" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -942,8 +907,8 @@ dependencies = [ [[package]] name = "epaint" -version = "0.28.1" -source = "git+https://github.com/emilk/egui?rev=d856f7b#d856f7b3a58fc65a81ff9657f5c6e1ab462b7bb6" +version = "0.29.1" +source = "git+https://github.com/emilk/egui?rev=5d6a58b#5d6a58b9176c2ae807928293da8a4e68f1c70d13" dependencies = [ "ab_glyph", "ahash", @@ -953,7 +918,6 @@ dependencies = [ "log", "nohash-hasher", "parking_lot", - "serde", ] [[package]] @@ -1009,6 +973,15 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "fern" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" +dependencies = [ + "log", +] + [[package]] name = "flate2" version = "1.0.33" @@ -1061,7 +1034,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -1193,15 +1166,15 @@ dependencies = [ [[package]] name = "glam" -version = "0.28.0" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94" +checksum = "dc46dd3ec48fdd8e693a98d2b8bafae273a2d54c1de02a2a7e3d57d501f39677" [[package]] name = "glow" -version = "0.13.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" +checksum = "d51fa363f025f5c111e03f13eda21162faeacb6911fe8caa0c0349f9cf0c4483" dependencies = [ "js-sys", "slotmap", @@ -1239,14 +1212,13 @@ dependencies = [ [[package]] name = "gpu-allocator" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd4240fc91d3433d5e5b0fc5b67672d771850dc19bbee03c1381e19322803d7" +checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" dependencies = [ "log", "presser", "thiserror", - "winapi", "windows", ] @@ -1316,30 +1288,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hassle-rs" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" -dependencies = [ - "bitflags 2.6.0", - "com", - "libc", - "libloading", - "thiserror", - "widestring", - "winapi", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.5.0" @@ -1546,7 +1494,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -1626,9 +1574,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1800,7 +1748,7 @@ checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ "bitflags 2.6.0", "block", - "core-graphics-types", + "core-graphics-types 0.1.3", "foreign-types 0.5.0", "log", "objc", @@ -1862,9 +1810,9 @@ dependencies = [ [[package]] name = "naga" -version = "22.1.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" +checksum = "3d5941e45a15b53aad4375eedf02033adb7a28931eedc31117faffa52e6a857e" dependencies = [ "arrayvec", "bit-set", @@ -2006,7 +1954,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2067,7 +2015,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2293,9 +2241,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" @@ -2320,7 +2268,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2417,7 +2365,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2545,7 +2493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2889,9 +2837,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sctk-adwaita" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7555fcb4f753d095d734fdefebb0ad8c98478a21db500492d87c55913d3b0086" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" dependencies = [ "ab_glyph", "log", @@ -2907,7 +2855,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "core-foundation-sys", "libc", "security-framework-sys", @@ -2946,7 +2894,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -3018,12 +2966,14 @@ dependencies = [ "egui_extras", "enum-map", "env_logger 0.10.2", + "fern", "getrandom", "glam", "image", "instant", "js-sys", "log", + "parking_lot", "pollster", "rand", "raw-window-handle", @@ -3038,7 +2988,6 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "web-time", "webbrowser", "wgpu", "winit", @@ -3070,9 +3019,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay-client-toolkit" -version = "0.18.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.6.0", "calloop", @@ -3173,9 +3122,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -3195,7 +3144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -3216,7 +3165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck 0.5.0", + "heck", "pkg-config", "toml", "version-compare", @@ -3252,22 +3201,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -3595,9 +3544,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "url" @@ -3657,9 +3606,9 @@ dependencies = [ [[package]] name = "walrus" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467611cafbc8a84834b77d2b4bb191fd2f5769752def8340407e924390c6883b" +checksum = "d68aa3c7b80be75c8458fc087453e5a31a226cfffede2e9b932393b2ea1c624a" dependencies = [ "anyhow", "gimli 0.26.2", @@ -3673,14 +3622,14 @@ dependencies = [ [[package]] name = "walrus-macro" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7" +checksum = "439ad39ff894c43c9649fa724cdde9a6fc50b855d517ef071a93e5df82fe51d3" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.87", ] [[package]] @@ -3700,9 +3649,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -3711,29 +3660,30 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-cli-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7f49ca6e7da74d53d6d716b868828a47d1c3808a8f676e2104fadd3b9874bb" +checksum = "d6b21cf9e89b196d78ff95c442a8076cc417171001e75dc062fe2c421cd2a0f9" dependencies = [ "anyhow", "base64 0.22.1", "log", "rustc-demangle", + "serde", "serde_json", "tempfile", "unicode-ident", @@ -3748,9 +3698,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-externref-xform" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1f37f2705f4177cc87e5b2763115d078d39e4843e351438b34b085d53a8930" +checksum = "c9f5eaefdb356e4266ca53d76526f5500e1e3b0961da8ee932193f08ada25ec7" dependencies = [ "anyhow", "walrus", @@ -3759,9 +3709,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -3771,9 +3721,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3781,22 +3731,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-multi-value-xform" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2864e3f221fef3869992b541b238e55f53f99b43c4ce220422a6e1ec9458dc21" +checksum = "c22689c6bbdc7f3a9110f1aa21873398a7ab2c50474ba9a45595c9ffde49c0cd" dependencies = [ "anyhow", "walrus", @@ -3805,15 +3755,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-bindgen-threads-xform" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9ca60ee029d64cf6f63a630050935360c3877844f6de38e8287afb8f1d2715" +checksum = "17d3c6389a7c8fa49ee4f55847d01b74c640a60387598952cdf3211b8499520c" dependencies = [ "anyhow", "walrus", @@ -3822,9 +3772,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-conventions" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e429e00149de60ffc768e6e1f0563778a237e7c11cc01801edf9734bff8161f" +checksum = "f7b4d6bf2704173b57d7f319316593a35f2102e18bc92251d96909f89e7d4595" dependencies = [ "anyhow", "leb128", @@ -3835,9 +3785,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771c49db324f195f221796bf3868247dd91cca4a85604dcb3729213e439abe59" +checksum = "b123244c6bf9e7abbb6ad9aa98ed86f927b55ee9d95b5552dd9346910341d5e2" dependencies = [ "anyhow", "log", @@ -3918,9 +3868,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.31.2" +version = "0.32.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" +checksum = "2b5755d77ae9040bb872a25026555ce4cb0ae75fd923e90d25fba07d81057de0" dependencies = [ "bitflags 2.6.0", "wayland-backend", @@ -3930,9 +3880,9 @@ dependencies = [ [[package]] name = "wayland-protocols-plasma" -version = "0.2.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" +checksum = "8a0a41a6875e585172495f7a96dfa42ca7e0213868f4f15c313f7c33221a7eff" dependencies = [ "bitflags 2.6.0", "wayland-backend", @@ -3943,9 +3893,9 @@ dependencies = [ [[package]] name = "wayland-protocols-wlr" -version = "0.2.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +checksum = "dad87b5fd1b1d3ca2f792df8f686a2a11e3fe1077b71096f7a175ab699f89109" dependencies = [ "bitflags 2.6.0", "wayland-backend", @@ -3979,9 +3929,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -4004,7 +3954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "425ba64c1e13b1c6e8c5d2541c8fac10022ca584f33da781db01b5756aef1f4e" dependencies = [ "block2", - "core-foundation", + "core-foundation 0.9.4", "home", "jni", "log", @@ -4023,9 +3973,9 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu" -version = "22.1.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" +checksum = "76ab52f2d3d18b70d5ab8dd270a1cff3ebe6dbe4a7d13c1cc2557138a9777fdc" dependencies = [ "arrayvec", "cfg_aliases 0.1.1", @@ -4048,9 +3998,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "22.1.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a" +checksum = "0e0c68e7b6322a03ee5b83fcd92caeac5c2a932f6457818179f4652ad2a9c065" dependencies = [ "arrayvec", "bit-vec", @@ -4073,9 +4023,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "22.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f" +checksum = "de6e7266b869de56c7e3ed72a954899f71d14fec6cc81c102b7530b92947601b" dependencies = [ "android_system_properties", "arrayvec", @@ -4083,15 +4033,14 @@ dependencies = [ "bit-set", "bitflags 2.6.0", "block", + "bytemuck", "cfg_aliases 0.1.1", - "core-graphics-types", - "d3d12", + "core-graphics-types 0.1.3", "glow", "glutin_wgl_sys", "gpu-alloc", "gpu-allocator", "gpu-descriptor", - "hassle-rs", "js-sys", "khronos-egl", "libc", @@ -4113,14 +4062,15 @@ dependencies = [ "wasm-bindgen", "web-sys", "wgpu-types", - "winapi", + "windows", + "windows-core", ] [[package]] name = "wgpu-types" -version = "22.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d" +checksum = "610f6ff27778148c31093f3b03abc4840f9636d58d597ca2f5977433acfe0068" dependencies = [ "bitflags 2.6.0", "js-sys", @@ -4128,58 +4078,75 @@ dependencies = [ ] [[package]] -name = "widestring" -version = "1.1.0" +name = "winapi-util" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] [[package]] -name = "winapi" -version = "0.3.9" +name = "windows" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "windows-core", + "windows-targets 0.52.6", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "windows-core" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] [[package]] -name = "winapi-util" -version = "0.1.9" +name = "windows-implement" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ - "windows-sys 0.59.0", + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows-interface" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] [[package]] -name = "windows" -version = "0.52.0" +name = "windows-result" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" dependencies = [ - "windows-core", "windows-targets 0.52.6", ] [[package]] -name = "windows-core" -version = "0.52.0" +name = "windows-strings" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ + "windows-result", "windows-targets 0.52.6", ] @@ -4399,9 +4366,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.30.2" +version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dc930d6cfbf53c4fe0b95689cdc2e17b8658c3f4214b9953298ccb5a1a15c90" +checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" dependencies = [ "ahash", "android-activity", @@ -4412,8 +4379,8 @@ dependencies = [ "calloop", "cfg_aliases 0.2.1", "concurrent-queue", - "core-foundation", - "core-graphics", + "core-foundation 0.9.4", + "core-graphics 0.23.2", "cursor-icon", "dpi", "js-sys", @@ -4549,7 +4516,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] diff --git a/run-wasm/src/main.rs b/run-wasm/src/main.rs index 1e539c5..fac6dc3 100644 --- a/run-wasm/src/main.rs +++ b/run-wasm/src/main.rs @@ -17,5 +17,36 @@ fn main() { let _ = std::fs::create_dir_all(&out_dir); let _ = copy_items(&[&wgsl_path, &img_path], out_dir, ©_options); - cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }"); + cargo_run_wasm::run_wasm_with_css( + r#" + body, div, canvas { margin: 0px; padding: 0px; } + body { + display: flex; + justify-content: center; + align-items: center; + background: linear-gradient(135deg, + white 0%, + white 49%, + black 49%, + black 51%, + white 51%, + white 100%) repeat; + background-size: 20px 20px; + width: 100vw; + height: 100vh; + } + canvas { + display: block; + width: 100%; + height: 100%; + background-color: #454545; + } + #simuverse_container { + width: 100vw; + height: 100vh; + min-width: 600px; + min-height: 450px; + } + "#, + ); } diff --git a/simuverse/Cargo.toml b/simuverse/Cargo.toml index 801d607..86a5e39 100644 --- a/simuverse/Cargo.toml +++ b/simuverse/Cargo.toml @@ -6,12 +6,12 @@ edition = "2021" rust-version = "1.80" [dependencies] -app-surface = "1.1" +app-surface = "1.2.4" # app-surface = { path = "../../idroid/wgpu-in-app/app-surface" } -egui = { git = "https://github.com/emilk/egui", rev = "d856f7b", default-features = false } -egui_extras = { git = "https://github.com/emilk/egui", package = "egui_extras", rev = "d856f7b" } -egui-wgpu = { git = "https://github.com/emilk/egui", package = "egui-wgpu", rev = "d856f7b" } -egui-winit = { git = "https://github.com/emilk/egui", package = "egui-winit", rev = "d856f7b", default-features = false } +egui = { git = "https://github.com/emilk/egui", rev = "5d6a58b", default-features = false } +egui_extras = { git = "https://github.com/emilk/egui", package = "egui_extras", rev = "5d6a58b" } +egui-wgpu = { git = "https://github.com/emilk/egui", package = "egui-wgpu", rev = "5d6a58b" } +egui-winit = { git = "https://github.com/emilk/egui", package = "egui-winit", rev = "5d6a58b", default-features = false } # egui = { version="0.28.1", default-features = false } # egui_extras = { version="0.28.1" } # egui-wgpu = { version="0.28.1" } @@ -19,15 +19,16 @@ egui-winit = { git = "https://github.com/emilk/egui", package = "egui-winit", re webbrowser = { version = "1.0.1" } # 与 egui 中使用的版本对齐 -winit = { version = "=0.30.2" } +winit = { version = "0.30.5" } raw-window-handle = "0.6" -wgpu = { version = "22.1", features = ["fragile-send-sync-non-atomic-wasm"] } -glam = "0.28" +wgpu = { version = "23", features = ["fragile-send-sync-non-atomic-wasm"] } +glam = "0.29" # syntax_highlighting 需要 enum-map enum-map = { version = "2", features = ["serde"] } bytemuck = "1.18" env_logger = "0.10" log = "0.4" +parking_lot = "0.12" rand = "0.8" # 为了让 rand 支持 web 环境 getrandom = { version = "0.2", features = ["js"] } @@ -48,15 +49,15 @@ truck-modeling = { version = "0.5.1" } truck-polymesh = { version = "0.5.0" } [target.'cfg(target_arch = "wasm32")'.dependencies] -web-time = "1" instant = { version = "0.1.12", features = ["now", "wasm-bindgen"] } console_error_panic_hook = "0.1.7" console_log = "1.0" -js-sys = "0.3.70" +fern = "0.6" +js-sys = "0.3.72" reqwest = "0.11.15" -wasm-bindgen = "=0.2.93" -wasm-bindgen-futures = "0.4.43" -web-sys = { version = "0.3.70", features = [ +wasm-bindgen = "0.2.95" +wasm-bindgen-futures = "0.4.45" +web-sys = { version = "0.3.72", features = [ "Blob", "Document", 'Element', @@ -70,7 +71,4 @@ web-sys = { version = "0.3.70", features = [ "Window", "WorkerGlobalScope", "XmlHttpRequest", - # Needed by webgpu_sys - "Event", - "EventTarget", ] } diff --git a/simuverse/src/app_handler.rs b/simuverse/src/app_handler.rs index 221bc06..ceb3191 100644 --- a/simuverse/src/app_handler.rs +++ b/simuverse/src/app_handler.rs @@ -1,20 +1,13 @@ -use std::{rc::Rc, sync::Mutex, thread}; - use crate::SimuverseApp; -use app_surface::AppSurface; use glam::Vec2; +use parking_lot::Mutex; +use std::rc::Rc; use std::sync::Arc; - -#[cfg(not(target_arch = "wasm32"))] -use std::time; -#[cfg(target_arch = "wasm32")] -use web_time as time; - use winit::{ application::ApplicationHandler, dpi::PhysicalSize, - event::{ElementState, MouseButton, StartCause, WindowEvent}, - event_loop::{ActiveEventLoop, ControlFlow, EventLoop}, + event::{ElementState, MouseButton, WindowEvent}, + event_loop::{ActiveEventLoop, EventLoop}, window::{Window, WindowId}, }; @@ -25,172 +18,176 @@ pub fn run() -> Result<(), impl std::error::Error> { } #[cfg(target_arch = "wasm32")] -use wasm_bindgen::{prelude::*, JsCast}; - -const CANVAS_SIZE_NEED_CHANGE: &str = "canvas_size_need_change"; -#[allow(unused)] -const ALL_CUSTOM_EVENTS: [&str; 1] = [CANVAS_SIZE_NEED_CHANGE]; +use wasm_bindgen::prelude::*; #[cfg(target_arch = "wasm32")] #[wasm_bindgen] extern "C" { #[wasm_bindgen(catch, js_namespace = Function, js_name = "prototype.call.call")] fn call_catch(this: &JsValue) -> Result<(), JsValue>; - fn canvas_resize_completed(); -} - -#[cfg(target_arch = "wasm32")] -fn try_call_canvas_resize_completed() { - let run_closure = Closure::once_into_js(canvas_resize_completed); - if call_catch(&run_closure).is_err() { - log::error!("js 端没有定义 canvas_resize_completed 函数"); - } -} - -#[allow(unused)] -#[derive(Debug, PartialEq)] -struct CustomJsTriggerEvent { - ty: &'static str, - value: String, -} - -const WAIT_TIME: time::Duration = time::Duration::from_millis(8); -const POLL_SLEEP_TIME: time::Duration = time::Duration::from_millis(8); - -#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] -enum Mode { - #[default] - Wait, - WaitUntil, - Poll, } #[derive(Default)] struct SimuverseAppHandler { - mode: Mode, - wait_cancelled: bool, - close_requested: bool, last_touch_point: Vec2, + window: Option>, app: Rc>>, + + /// 错失的窗口大小变化 + /// + /// # NOTE: + /// 在 web 端,app 的初始化是异步的,当收到 resized 事件时,初始化可能还没有完成从而错过窗口 resized 事件, + /// 当 app 初始化完成后会调用 `set_window_resized` 方法来补上错失的窗口大小变化事件。 + #[allow(dead_code)] + missed_resize: Rc>>>, + + /// 错失的请求重绘事件 + /// + /// # NOTE: + /// 在 web 端,app 的初始化是异步的,当收到 redraw 事件时,初始化可能还没有完成从而错过请求重绘事件, + /// 当 app 初始化完成后会调用 `request_redraw` 方法来补上错失的请求重绘事件。 + #[allow(dead_code)] + missed_request_redraw: Rc>, } impl SimuverseAppHandler { fn create_app(&mut self, window: Arc) { - // 计算一个默认显示高度 - let height = (if cfg!(target_arch = "wasm32") { - 700.0 - } else { - 750.0 - } * window.scale_factor()) as u32; - let width = (height as f32 * 1.6) as u32; - if cfg!(not(target_arch = "wasm32")) { + // 计算一个默认显示高度 + let height = (750.0 * window.scale_factor()) as u32; + let width = (height as f32 * 1.6) as u32; let _ = window.request_inner_size(PhysicalSize::new(width, height)); } #[cfg(target_arch = "wasm32")] { - // Winit prevents sizing with CSS, so we have to set - // the size manually when on web. use winit::platform::web::WindowExtWebSys; + + // 将 canvas 添加到当前网页中 + let canvas = window.canvas().unwrap(); web_sys::window() .and_then(|win| win.document()) .map(|doc| { - let canvas = window.canvas().unwrap(); - let scale_factor = window.scale_factor() as f32; - let mut w = width as f32 / scale_factor; - let mut h = height as f32 / scale_factor; - if let Some(container) = doc.get_element_by_id("simuverse_container") { - let rect = container.get_bounding_client_rect(); - w = rect.width() as f32; - h = rect.height() as f32; - let _ = container.append_child(&web_sys::Element::from(canvas)); - } else { - doc.body() - .map(|body| body.append_child(&web_sys::Element::from(canvas))); - } - // winit 0.29 开始,通过 request_inner_size, canvas.set_width 都无法设置 canvas 的大小 - let canvas = window.canvas().unwrap(); - canvas.set_width((w * scale_factor) as u32); - canvas.set_height((h * scale_factor) as u32); - canvas.style().set_css_text( - &(canvas.style().css_text() - + &format!("background-color: black; display: block; margin: 20px auto; width: {}px; max-width: {}px; height: {}px; max-height: {}px", w, w, h, h)), - ); + let _ = canvas.set_attribute("id", "simuverse_app"); + match doc.get_element_by_id("simuverse_container") { + Some(dst) => { + let _ = dst.append_child(canvas.as_ref()); + } + None => { + let container = doc.create_element("div").unwrap(); + let _ = container.set_attribute("id", "simuverse_container"); + let _ = container.append_child(canvas.as_ref()); + + doc.body().map(|body| body.append_child(container.as_ref())); + } + }; }) - .expect("Couldn't append canvas to document body."); + .expect("无法将 canvas 添加到当前网页中"); + + // 确保画布可以获得焦点 + // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex + canvas.set_tab_index(0); + + // 设置画布获得焦点时不显示高亮轮廓 + let style = canvas.style(); + style.set_property("outline", "none").unwrap(); + canvas.focus().expect("画布无法获取焦点"); }; - #[cfg(not(target_arch = "wasm32"))] - { - let app_surface = pollster::block_on(AppSurface::new(window.clone())); - let mut simu_app = pollster::block_on(SimuverseApp::new(app_surface, &window)); - simu_app.start(); - simu_app.app_surface.request_redraw(); + cfg_if::cfg_if! { + if #[cfg(target_arch = "wasm32")] { + let app = self.app.clone(); + let missed_resize = self.missed_resize.clone(); + let missed_request_redraw = self.missed_request_redraw.clone(); + + wasm_bindgen_futures::spawn_local(async move { + let window_cloned = window.clone(); + + let simu_app = SimuverseApp::new(window).await; + let mut app = app.lock(); + *app = Some(simu_app); + + if let Some(resize) = *missed_resize.lock() { + app.as_mut().unwrap().set_window_resized(resize); + } - self.app = Rc::new(Mutex::new(Some(simu_app))); + if *missed_request_redraw.lock() { + window_cloned.request_redraw(); + } + }); + } else { + let simu_app = pollster::block_on(SimuverseApp::new(window)); + self.app.lock().replace(simu_app); + } } - #[cfg(target_arch = "wasm32")] - { - let app = self.app.clone(); - wasm_bindgen_futures::spawn_local(async move { - let app_surface = AppSurface::new(window.clone()).await; - let mut simu_app = SimuverseApp::new(app_surface, &window).await; - simu_app.start(); - simu_app.app_surface.request_redraw(); - - let mut app = app.lock().unwrap(); - *app = Some(simu_app); - }); + } + + /// 在提交渲染之前通知窗口系统。 + fn pre_present_notify(&self) { + if let Some(window) = self.window.as_ref() { + window.pre_present_notify(); } } -} -impl ApplicationHandler for SimuverseAppHandler { - fn new_events(&mut self, _event_loop: &ActiveEventLoop, cause: StartCause) { - self.wait_cancelled = match cause { - StartCause::WaitCancelled { .. } => self.mode == Mode::WaitUntil, - StartCause::Init => false, - _ => false, + /// 请求重绘 + fn request_redraw(&self) { + if let Some(window) = self.window.as_ref() { + window.request_redraw(); } } +} +impl ApplicationHandler for SimuverseAppHandler { fn resumed(&mut self, event_loop: &ActiveEventLoop) { - if self.app.as_ref().lock().unwrap().is_some() { + if self.app.as_ref().lock().is_some() { return; } let window_attributes = Window::default_attributes().with_title("simuverse"); let window = Arc::new(event_loop.create_window(window_attributes).unwrap()); + self.window = Some(window.clone()); self.create_app(window); } fn window_event( &mut self, - _event_loop: &ActiveEventLoop, + event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent, ) { - let mut app = self.app.lock().unwrap(); + let mut app = self.app.lock(); if app.as_ref().is_none() { + // 如果 app 还没有初始化完成,则记录错失的窗口事件 + match event { + WindowEvent::Resized(physical_size) => { + if physical_size.width > 0 && physical_size.height > 0 { + let mut missed_resize = self.missed_resize.lock(); + *missed_resize = Some(physical_size); + } + } + WindowEvent::RedrawRequested => { + let mut missed_request_redraw = self.missed_request_redraw.lock(); + *missed_request_redraw = true; + } + _ => (), + } return; } - app.as_mut().unwrap().on_ui_event(&event); + let app = app.as_mut().unwrap(); + app.on_ui_event(&event); match event { WindowEvent::CloseRequested => { - self.close_requested = true; + event_loop.exit(); } WindowEvent::Resized(physical_size) => { if physical_size.width == 0 || physical_size.height == 0 { // 处理最小化窗口的事件 println!("Window minimized!"); } else { - app.as_mut().unwrap().resize(&physical_size); - #[cfg(target_arch = "wasm32")] - try_call_canvas_resize_completed(); + app.set_window_resized(physical_size); } } WindowEvent::MouseInput { @@ -199,50 +196,28 @@ impl ApplicationHandler for SimuverseAppHandler { button, .. } => { - app.as_mut().unwrap().mouse_input(&state, &button); + app.mouse_input(&state, &button); if button == MouseButton::Left && state == ElementState::Pressed { let point = self.last_touch_point; - app.as_mut().unwrap().on_click(point); + app.on_click(point); } } WindowEvent::CursorMoved { position, .. } => { - app.as_mut().unwrap().cursor_moved(position); + app.cursor_moved(position); let point = Vec2::new(position.x as f32, position.y as f32); - app.as_mut().unwrap().touch_move(point); + app.touch_move(point); self.last_touch_point = point; } - WindowEvent::MouseWheel { delta, phase, .. } => { - app.as_mut().unwrap().mouse_wheel(&delta, &phase) - } + WindowEvent::MouseWheel { delta, phase, .. } => app.mouse_wheel(&delta, &phase), WindowEvent::RedrawRequested => { - app.as_mut().unwrap().app_surface.pre_present_notify(); + self.pre_present_notify(); - app.as_mut().unwrap().render(); + app.render(); - app.as_mut().unwrap().app_surface.request_redraw(); + self.request_redraw(); } _ => (), } } - - fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) { - match self.mode { - Mode::Wait => event_loop.set_control_flow(ControlFlow::Wait), - Mode::WaitUntil => { - if !self.wait_cancelled { - event_loop - .set_control_flow(ControlFlow::WaitUntil(time::Instant::now() + WAIT_TIME)); - } - } - Mode::Poll => { - thread::sleep(POLL_SLEEP_TIME); - event_loop.set_control_flow(ControlFlow::Poll); - } - }; - - if self.close_requested { - event_loop.exit(); - } - } } diff --git a/simuverse/src/egui_layer.rs b/simuverse/src/egui_layer.rs index bf3eca1..e814c37 100644 --- a/simuverse/src/egui_layer.rs +++ b/simuverse/src/egui_layer.rs @@ -42,6 +42,7 @@ impl EguiLayer { display_target, Some(app.scale_factor), None, + None, ); let egui_renderer = egui_wgpu::Renderer::new(&app.device, format, None, 1, false); @@ -109,18 +110,21 @@ impl EguiLayer { ) }; { - let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - color_attachments: &[Some(wgpu::RenderPassColorAttachment { - view: &self.canvas.tex_view, - resolve_target: None, - ops: wgpu::Operations { - load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), - store: wgpu::StoreOp::Store, - }, - })], - depth_stencil_attachment: None, - ..Default::default() - }); + let mut rpass = encoder + .begin_render_pass(&wgpu::RenderPassDescriptor { + color_attachments: &[Some(wgpu::RenderPassColorAttachment { + view: &self.canvas.tex_view, + resolve_target: None, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), + store: wgpu::StoreOp::Store, + }, + })], + depth_stencil_attachment: None, + ..Default::default() + }) + .forget_lifetime(); + // egui ui 渲染 self.egui_renderer .render(&mut rpass, &clipped_primitives, &screen_descriptor); diff --git a/simuverse/src/egui_lib/mod.rs b/simuverse/src/egui_lib/mod.rs index 6f330e3..5b6955a 100644 --- a/simuverse/src/egui_lib/mod.rs +++ b/simuverse/src/egui_lib/mod.rs @@ -1,7 +1,7 @@ pub(crate) fn show_code(ui: &mut egui::Ui, code: &str) { let code = remove_leading_indentation(code.trim_start_matches('\n')); let language = "rs"; - let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx()); + let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx(), &ui.style()); egui_extras::syntax_highlighting::code_view_ui(ui, &theme, &code, language); } diff --git a/simuverse/src/fluid/d2q9_node.rs b/simuverse/src/fluid/d2q9_node.rs index af9626e..ed05203 100644 --- a/simuverse/src/fluid/d2q9_node.rs +++ b/simuverse/src/fluid/d2q9_node.rs @@ -153,7 +153,7 @@ impl D2Q9Node { label: Some("collid_stream pipeline"), layout: Some(&pipeline_layout), module: &collide_stream_shader, - entry_point: "cs_main", + entry_point: Some("cs_main"), compilation_options: Default::default(), cache: None, }); @@ -162,7 +162,7 @@ impl D2Q9Node { label: Some("boundary_pipeline pipeline"), layout: Some(&pipeline_layout), module: &boundary_shader, - entry_point: "cs_main", + entry_point: Some("cs_main"), compilation_options: Default::default(), cache: None, }); diff --git a/simuverse/src/fluid/particle_render_node.rs b/simuverse/src/fluid/particle_render_node.rs index df4b711..0972fb7 100644 --- a/simuverse/src/fluid/particle_render_node.rs +++ b/simuverse/src/fluid/particle_render_node.rs @@ -253,13 +253,13 @@ fn generate_pipeline( layout: Some(pipeline_layout), vertex: wgpu::VertexState { module: shader, - entry_point: entry_points.0, + entry_point: Some(entry_points.0), buffers: &buffers, compilation_options: Default::default(), }, fragment: Some(wgpu::FragmentState { module: shader, - entry_point: entry_points.1, + entry_point: Some(entry_points.1), targets: &targets, compilation_options: Default::default(), }), diff --git a/simuverse/src/main.rs b/simuverse/src/main.rs index ed47b73..341786e 100644 --- a/simuverse/src/main.rs +++ b/simuverse/src/main.rs @@ -1,11 +1,64 @@ pub fn main() -> Result<(), impl std::error::Error> { - #[cfg(not(target_arch = "wasm32"))] - env_logger::init(); + init_logger(); + simuverse::app_handler::run() +} + +// 根据不同平台初始化日志。 +pub fn init_logger() { + cfg_if::cfg_if! { + if #[cfg(target_arch = "wasm32")] { + // 使用查询字符串来获取日志级别。 + let query_string = web_sys::window().unwrap().location().search().unwrap(); + let query_level: Option = parse_url_query_string(&query_string, "RUST_LOG") + .and_then(|x| x.parse().ok()); - #[cfg(target_arch = "wasm32")] - { - console_error_panic_hook::set_once(); - console_log::init_with_level(log::Level::Info).expect("无法初始化日志库"); + // 我们将 wgpu 日志级别保持在错误级别,因为 Info 级别的日志输出非常多。 + let base_level = query_level.unwrap_or(log::LevelFilter::Info); + let wgpu_level = query_level.unwrap_or(log::LevelFilter::Error); + + // 在 web 上,我们使用 fern,因为 console_log 没有按模块级别过滤功能。 + fern::Dispatch::new() + .level(base_level) + .level_for("wgpu_core", wgpu_level) + .level_for("wgpu_hal", wgpu_level) + .level_for("naga", wgpu_level) + .chain(fern::Output::call(console_log::log)) + .apply() + .unwrap(); + std::panic::set_hook(Box::new(console_error_panic_hook::hook)); + } else if #[cfg(target_os = "android")] { + // 添加 Android 平台的日志初始化 + android_logger::init_once( + android_logger::Config::default() + .with_max_level(log::LevelFilter::Info) + ); + log_panics::init(); + } else { + // parse_default_env 会读取 RUST_LOG 环境变量,并在这些默认过滤器之上应用它。 + env_logger::builder() + .filter_level(log::LevelFilter::Info) + .filter_module("wgpu_core", log::LevelFilter::Info) + .filter_module("wgpu_hal", log::LevelFilter::Error) + .filter_module("naga", log::LevelFilter::Error) + .parse_default_env() + .init(); + } } - simuverse::app_handler::run() +} + +#[cfg(target_arch = "wasm32")] +fn parse_url_query_string<'a>(query: &'a str, search_key: &str) -> Option<&'a str> { + let query_string = query.strip_prefix('?')?; + + for pair in query_string.split('&') { + let mut pair = pair.split('='); + let key = pair.next()?; + let value = pair.next()?; + + if key == search_key { + return Some(value); + } + } + + None } diff --git a/simuverse/src/node/bufferless_fullscreen_node.rs b/simuverse/src/node/bufferless_fullscreen_node.rs index f052c07..f6fbfff 100644 --- a/simuverse/src/node/bufferless_fullscreen_node.rs +++ b/simuverse/src/node/bufferless_fullscreen_node.rs @@ -30,13 +30,13 @@ impl BufferlessFullscreenNode { layout: None, vertex: wgpu::VertexState { module: shader_module, - entry_point: "vs_main", + entry_point: Some("vs_main"), buffers: &pipeline_vertex_buffers, compilation_options: Default::default(), }, fragment: Some(wgpu::FragmentState { module: shader_module, - entry_point: "fs_main", + entry_point: Some("fs_main"), targets: &[Some(wgpu::ColorTargetState { format, blend: blend_state, diff --git a/simuverse/src/node/compute_node.rs b/simuverse/src/node/compute_node.rs index 8c52db4..1d5460a 100644 --- a/simuverse/src/node/compute_node.rs +++ b/simuverse/src/node/compute_node.rs @@ -9,6 +9,7 @@ use std::vec::Vec; pub struct ComputeNode { pub bg_setting: BindGroupSetting, pub dy_uniform_bg: Option, + #[allow(dead_code)] pub pipeline_layout: wgpu::PipelineLayout, pub pipeline: wgpu::ComputePipeline, pub workgroup_count: (u32, u32, u32), @@ -57,7 +58,7 @@ impl ComputeNode { label: None, layout: Some(&pipeline_layout), module: shader_module, - entry_point: "cs_main", + entry_point: Some("cs_main"), compilation_options: Default::default(), cache: None, }); @@ -106,7 +107,7 @@ impl ComputeNode { label: None, layout: Some(&pipeline_layout), module: shader_module, - entry_point: "cs_main", + entry_point: Some("cs_main"), compilation_options: Default::default(), cache: None, }); diff --git a/simuverse/src/node/view_node.rs b/simuverse/src/node/view_node.rs index 541bdef..9a5a75d 100644 --- a/simuverse/src/node/view_node.rs +++ b/simuverse/src/node/view_node.rs @@ -215,13 +215,13 @@ impl ViewNode { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { module: attributes.shader_module, - entry_point: "vs_main", + entry_point: Some("vs_main"), buffers: &vertex_buffer_layouts, compilation_options: Default::default(), }, fragment: Some(wgpu::FragmentState { module: attributes.shader_module, - entry_point: "fs_main", + entry_point: Some("fs_main"), targets: &[Some(wgpu::ColorTargetState { format: corlor_format, blend: attributes.color_blend_state, diff --git a/simuverse/src/setting/control_panel.rs b/simuverse/src/setting/control_panel.rs index d5db1f9..a992a93 100644 --- a/simuverse/src/setting/control_panel.rs +++ b/simuverse/src/setting/control_panel.rs @@ -268,11 +268,12 @@ impl ControlPanel { ui.selectable_value(&mut self.selected_code_snippet, Some(3), "黑洞"); }); - let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx()); + let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx(), &ui.style()); let mut layouter = |ui: &egui::Ui, string: &str, wrap_width: f32| { let mut layout_job = egui_extras::syntax_highlighting::highlight( ui.ctx(), + &ui.style(), &theme, &crate::remove_leading_indentation(string), "rs", @@ -280,7 +281,7 @@ impl ControlPanel { layout_job.wrap.max_width = wrap_width; ui.fonts(|f| f.layout_job(layout_job)) }; - let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx()); + let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx(), &ui.style()); egui_extras::syntax_highlighting::code_view_ui( ui, &theme, @@ -353,7 +354,12 @@ pub fn setup_custom_fonts(ctx: &egui::Context) { let mut fonts = egui::FontDefinitions::default(); fonts.font_data.insert( ZH_TINY.to_owned(), - egui::FontData::from_static(include_bytes!("../../../assets/fonts/PingFangTiny.ttf")), + egui::FontData::from_static(include_bytes!("../../../assets/fonts/PingFangTiny.ttf")) + .tweak(egui::FontTweak { + scale: 1.2, + ..Default::default() + }) + .into(), ); // Some good looking emojis. fonts.font_data.insert( @@ -366,7 +372,8 @@ pub fn setup_custom_fonts(ctx: &egui::Context) { y_offset_factor: -0.15, // move it up y_offset: 0.0, ..Default::default() - }), + }) + .into(), ); // Bigger emojis, and more. : fonts.font_data.insert( @@ -377,7 +384,8 @@ pub fn setup_custom_fonts(ctx: &egui::Context) { y_offset_factor: 0.07, // move it down slightly y_offset: 0.0, ..Default::default() - }), + }) + .into(), ); fonts.families.insert( egui::FontFamily::Proportional, @@ -388,7 +396,6 @@ pub fn setup_custom_fonts(ctx: &egui::Context) { ], ); - // Put my font as last fallback for monospace: // 如果没有这项设置,`syntax_highlighting::code_view_ui` 无法渲染任何字符 fonts .families diff --git a/simuverse/src/simuverse_app.rs b/simuverse/src/simuverse_app.rs index a1f1207..593707c 100644 --- a/simuverse/src/simuverse_app.rs +++ b/simuverse/src/simuverse_app.rs @@ -3,14 +3,17 @@ use crate::{ FieldSimulator, FluidSimulator, SimuType, Simulator, DEPTH_FORMAT, }; use app_surface::{AppSurface, SurfaceFrame}; -use raw_window_handle::HasDisplayHandle; use std::iter; +use std::sync::Arc; use wgpu::TextureView; use winit::dpi::PhysicalSize; -use winit::window::WindowId; +use winit::window::{Window, WindowId}; pub struct SimuverseApp { pub(crate) app_surface: AppSurface, + size: PhysicalSize, + size_changed: bool, + frame_count: u32, egui_layer: EguiLayer, ctrl_panel: ControlPanel, canvas_size: glam::UVec2, @@ -21,18 +24,19 @@ pub struct SimuverseApp { } impl SimuverseApp { - pub async fn new(app: AppSurface, event_loop: &dyn HasDisplayHandle) -> Self { - let mut app = app; + pub async fn new(window: Arc) -> Self { + // 创建 wgpu 应用 + let mut app = AppSurface::new(window.clone()).await; let format = app.config.format.remove_srgb_suffix(); // 设置一个最小 surface 大小,使得在 Web 环境,egui 面板能有合适的展示大小 let size = app.get_view().inner_size(); - app.sdq.config.width = size.width.max(375); - app.sdq.config.height = size.height.max(500); - app.sdq.config.format = format; - app.surface.configure(&app.sdq.device, &app.sdq.config); + app.ctx.config.width = size.width.max(375); + app.ctx.config.height = size.height.max(500); + app.ctx.config.format = format; + app.surface.configure(&app.ctx.device, &app.ctx.config); // egui - let egui_layer = EguiLayer::new(&app, event_loop, format); + let egui_layer = EguiLayer::new(&app, &window, format); let ctrl_panel = ControlPanel::new(&app, &egui_layer.ctx); let canvas_size = glam::UVec2::new(app.config.width, app.config.height); @@ -67,8 +71,13 @@ impl SimuverseApp { )); let depth_view = Self::create_depth_tex(&app); + let size = PhysicalSize::new(app.config.width, app.config.height); + Self { app_surface: app, + size, + size_changed: true, + frame_count: 0, egui_layer, ctrl_panel, canvas_buf, @@ -91,39 +100,47 @@ impl SimuverseApp { self.app_surface.get_view().id() } - pub fn start(&mut self) { - // 只有在进入事件循环之后,才有可能真正获取到窗口大小。 - let size = self.app_surface.get_view().inner_size(); - self.resize(&size); - } - - pub fn resize(&mut self, size: &PhysicalSize) { - if self.app_surface.config.width == size.width - && self.app_surface.config.height == size.height - { + pub fn set_window_resized(&mut self, new_size: PhysicalSize) { + if self.size == new_size { return; } - self.app_surface.resize_surface(); - self.depth_view = Self::create_depth_tex(&self.app_surface); - self.egui_layer.resize(&self.app_surface); + self.size = new_size; + self.size_changed = true; + } - let canvas_size = glam::UVec2::new( - self.app_surface.config.width, - self.app_surface.config.height, - ); - self.ctrl_panel - .setting - .update_canvas_size(&self.app_surface, canvas_size); - self.canvas_size = canvas_size; - self.canvas_buf = crate::util::BufferObj::create_empty_storage_buffer( - &self.app_surface.device, - (canvas_size.x * canvas_size.y * 12) as u64, - false, - Some("canvas_buf"), - ); + /// 必要的时候调整 surface 大小 + /// + /// resize 在缩放窗口时会高频触发,所以需要限制 resize 的频率 + fn resize_surface_if_needed(&mut self) { + if self.size_changed && self.frame_count > 10 { + // 需先 resize surface + self.app_surface + .resize_surface_by_size((self.size.width, self.size.height)); - if !self.simulator.resize(&self.app_surface) { - self.create_simulator(); + self.depth_view = Self::create_depth_tex(&self.app_surface); + self.egui_layer.resize(&self.app_surface); + + let canvas_size = glam::UVec2::new( + self.app_surface.config.width, + self.app_surface.config.height, + ); + self.ctrl_panel + .setting + .update_canvas_size(&self.app_surface, canvas_size); + self.canvas_size = canvas_size; + self.canvas_buf = crate::util::BufferObj::create_empty_storage_buffer( + &self.app_surface.device, + (canvas_size.x * canvas_size.y * 12) as u64, + false, + Some("canvas_buf"), + ); + + if !self.simulator.resize(&self.app_surface) { + self.create_simulator(); + } + + self.size_changed = false; + self.frame_count = 0; } } @@ -164,6 +181,9 @@ impl SimuverseApp { } pub fn render(&mut self) { + self.frame_count += 1; + self.resize_surface_if_needed(); + let mut encoder = self.app_surface .device diff --git a/simuverse/src/truck/platform/scene.rs b/simuverse/src/truck/platform/scene.rs index ca718d4..2044d60 100644 --- a/simuverse/src/truck/platform/scene.rs +++ b/simuverse/src/truck/platform/scene.rs @@ -510,7 +510,7 @@ impl Scene { continue; } rpass.set_pipeline(&object.pipeline); - rpass.set_bind_group(1, &object.bind_group, &[]); + rpass.set_bind_group(1, object.bind_group.as_ref(), &[]); rpass.set_vertex_buffer(0, object.vertex_buffer.buffer.slice(..)); match object.index_buffer { Some(ref index_buffer) => { diff --git a/simuverse/src/truck/rendimpl/polygon_instance.rs b/simuverse/src/truck/rendimpl/polygon_instance.rs index 977aece..1db6fa7 100644 --- a/simuverse/src/truck/rendimpl/polygon_instance.rs +++ b/simuverse/src/truck/rendimpl/polygon_instance.rs @@ -128,7 +128,7 @@ impl Rendered for PolygonInstance { layout: Some(layout), vertex: VertexState { module: &self.shaders.vertex_module, - entry_point: self.shaders.vertex_entry, + entry_point: Some(self.shaders.vertex_entry), buffers: &[VertexBufferLayout { array_stride: size_of::() as BufferAddress, step_mode: VertexStepMode::Vertex, @@ -154,7 +154,7 @@ impl Rendered for PolygonInstance { }, fragment: Some(FragmentState { module: fragment_module, - entry_point: fragment_entry, + entry_point: Some(fragment_entry), targets: &[Some(ColorTargetState { format: scene_desc.render_texture.format, blend, diff --git a/simuverse/src/truck/rendimpl/wireframe_instance.rs b/simuverse/src/truck/rendimpl/wireframe_instance.rs index a9ef474..842a084 100644 --- a/simuverse/src/truck/rendimpl/wireframe_instance.rs +++ b/simuverse/src/truck/rendimpl/wireframe_instance.rs @@ -95,7 +95,7 @@ impl Rendered for WireFrameInstance { layout: Some(layout), vertex: VertexState { module: &self.shaders.vertex_module, - entry_point: self.shaders.vertex_entry, + entry_point: Some(self.shaders.vertex_entry), buffers: &[VertexBufferLayout { array_stride: size_of::<[f32; 3]>() as BufferAddress, step_mode: VertexStepMode::Vertex, @@ -109,7 +109,7 @@ impl Rendered for WireFrameInstance { }, fragment: Some(FragmentState { module: &self.shaders.fragment_module, - entry_point: self.shaders.fragment_entry, + entry_point: Some(self.shaders.fragment_entry), targets: &[Some(ColorTargetState { format: scene_desc.render_texture.format, blend: Some(BlendState::REPLACE),