Skip to content

Turn one illustration into an animated 2D mesh avatar with a coding agent and a local editor

Add a transparent macOS desktop avatar app

shinshin86d04bd5f9798c
diff --git a/native/Cargo.lock b/native/Cargo.lock
index 2149747..9c1de06 100644
--- a/native/Cargo.lock
+++ b/native/Cargo.lock
@@ -2,12 +2,66 @@
# It is not intended for manual editing.
version = 4
+[[package]]
+name = "ab_glyph"
+version = "0.2.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2"
+dependencies = [
+ "ab_glyph_rasterizer",
+ "owned_ttf_parser",
+]
+
+[[package]]
+name = "ab_glyph_rasterizer"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
+
[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+[[package]]
+name = "ahash"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
+dependencies = [
+ "cfg-if",
+ "getrandom 0.3.4",
+ "once_cell",
+ "version_check",
+ "zerocopy",
+]
+
+[[package]]
+name = "android-activity"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd"
+dependencies = [
+ "android-properties",
+ "bitflags 2.13.2",
+ "cc",
+ "jni",
+ "libc",
+ "log",
+ "ndk",
+ "ndk-context",
+ "ndk-sys",
+ "num_enum",
+ "thiserror 2.0.21",
+]
+
+[[package]]
+name = "android-properties"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
+
[[package]]
name = "android_system_properties"
version = "0.1.6"
@@ -32,12 +86,24 @@ dependencies = [
"derive_arbitrary",
]
+[[package]]
+name = "arrayref"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
+
[[package]]
name = "arrayvec"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
+[[package]]
+name = "as-raw-xcb-connection"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
+
[[package]]
name = "ash"
version = "0.38.0+1.3.281"
@@ -47,6 +113,12 @@ dependencies = [
"libloading",
]
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
[[package]]
name = "autocfg"
version = "1.5.1"
@@ -86,6 +158,15 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
+[[package]]
+name = "block2"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
+dependencies = [
+ "objc2",
+]
+
[[package]]
name = "bumpalo"
version = "3.20.3"
@@ -112,6 +193,50 @@ dependencies = [
"syn 3.0.9",
]
+[[package]]
+name = "bytes"
+version = "1.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
+
+[[package]]
+name = "calloop"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"
+dependencies = [
+ "bitflags 2.13.2",
+ "log",
+ "polling",
+ "rustix 0.38.44",
+ "slab",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "calloop-wayland-source"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
+dependencies = [
+ "calloop",
+ "rustix 0.38.44",
+ "wayland-backend",
+ "wayland-client",
+]
+
+[[package]]
+name = "cc"
+version = "1.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0"
+dependencies = [
+ "find-msvc-tools",
+ "jobserver",
+ "libc",
+ "shlex",
+]
+
[[package]]
name = "cfg-if"
version = "1.0.5"
@@ -135,6 +260,35 @@ dependencies = [
"unicode-width",
]
+[[package]]
+name = "combine"
+version = "4.6.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92"
+dependencies = [
+ "bytes",
+ "memchr",
+]
+
+[[package]]
+name = "concurrent-queue"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "core-foundation"
version = "0.10.1"
@@ -151,6 +305,30 @@ version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+[[package]]
+name = "core-graphics"
+version = "0.23.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
+dependencies = [
+ "bitflags 1.3.2",
+ "core-foundation 0.9.4",
+ "core-graphics-types 0.1.3",
+ "foreign-types",
+ "libc",
+]
+
+[[package]]
+name = "core-graphics-types"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
+dependencies = [
+ "bitflags 1.3.2",
+ "core-foundation 0.9.4",
+ "libc",
+]
+
[[package]]
name = "core-graphics-types"
version = "0.2.0"
@@ -158,7 +336,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
dependencies = [
"bitflags 2.13.2",
- "core-foundation",
+ "core-foundation 0.10.1",
"libc",
]
@@ -183,6 +361,12 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
+[[package]]
+name = "cursor-icon"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f"
+
[[package]]
name = "derive_arbitrary"
version = "1.5.0"
@@ -194,6 +378,21 @@ dependencies = [
"syn 3.0.9",
]
+[[package]]
+name = "dispatch"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
+
+[[package]]
+name = "dlib"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
+dependencies = [
+ "libloading",
+]
+
[[package]]
name = "document-features"
version = "0.2.12"
@@ -203,12 +402,34 @@ dependencies = [
"litrs",
]
+[[package]]
+name = "downcast-rs"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
+
+[[package]]
+name = "dpi"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
+
[[package]]
name = "equivalent"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
+[[package]]
+name = "errno"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "fdeflate"
version = "0.3.7"
@@ -218,6 +439,12 @@ dependencies = [
"simd-adler32",
]
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
+
[[package]]
name = "flate2"
version = "1.1.10"
@@ -292,6 +519,39 @@ dependencies = [
"slab",
]
+[[package]]
+name = "gethostname"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
+dependencies = [
+ "rustix 1.1.5",
+ "windows-link",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 5.3.0",
+ "wasip2",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
+]
+
[[package]]
name = "gl_generator"
version = "0.14.0"
@@ -411,6 +671,12 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+[[package]]
+name = "hermit-abi"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"
+
[[package]]
name = "hexf-parse"
version = "0.2.1"
@@ -433,6 +699,36 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys 0.4.1",
+ "log",
+ "simd_cesu8",
+ "thiserror 2.0.21",
+ "walkdir",
+ "windows-link",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.119",
+]
+
[[package]]
name = "jni-sys"
version = "0.3.1"
@@ -461,6 +757,16 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "jobserver"
+version = "0.1.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
+dependencies = [
+ "getrandom 0.4.3",
+ "libc",
+]
+
[[package]]
name = "js-sys"
version = "0.3.106"
@@ -511,6 +817,30 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
+[[package]]
+name = "libredox"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d"
+dependencies = [
+ "bitflags 2.13.2",
+ "libc",
+ "plain",
+ "redox_syscall 0.9.5",
+]
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
+
[[package]]
name = "litrs"
version = "1.0.1"
@@ -547,6 +877,15 @@ version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+[[package]]
+name = "memmap2"
+version = "0.9.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "mesh-avatar-core"
version = "0.1.0"
@@ -561,6 +900,14 @@ dependencies = [
[[package]]
name = "mesh-avatar-desktop"
version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "mesh-avatar-core",
+ "mesh-avatar-wgpu",
+ "pollster",
+ "wgpu",
+ "winit",
+]
[[package]]
name = "mesh-avatar-wgpu"
@@ -584,7 +931,7 @@ checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605"
dependencies = [
"bitflags 2.13.2",
"block",
- "core-graphics-types",
+ "core-graphics-types 0.2.0",
"foreign-types",
"log",
"objc",
@@ -637,6 +984,27 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "ndk"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
+dependencies = [
+ "bitflags 2.13.2",
+ "jni-sys 0.3.1",
+ "log",
+ "ndk-sys",
+ "num_enum",
+ "raw-window-handle",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "ndk-context"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
+
[[package]]
name = "ndk-sys"
version = "0.6.0+11769913"
@@ -656,6 +1024,28 @@ dependencies = [
"libm",
]
+[[package]]
+name = "num_enum"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26"
+dependencies = [
+ "num_enum_derive",
+ "rustversion",
+]
+
+[[package]]
+name = "num_enum_derive"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
[[package]]
name = "objc"
version = "0.2.7"
@@ -666,39 +1056,261 @@ dependencies = [
]
[[package]]
-name = "once_cell"
-version = "1.21.4"
+name = "objc-sys"
+version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
[[package]]
-name = "ordered-float"
-version = "5.5.0"
+name = "objc2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0"
+checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b"
dependencies = [
- "num-traits",
+ "objc-sys",
+ "objc2-encode",
]
[[package]]
-name = "parking_lot"
-version = "0.12.5"
+name = "objc2-app-kit"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
dependencies = [
- "lock_api",
- "parking_lot_core",
+ "bitflags 2.13.2",
+ "block2",
+ "libc",
+ "objc2",
+ "objc2-core-data",
+ "objc2-core-image",
+ "objc2-foundation",
+ "objc2-quartz-core",
]
[[package]]
-name = "parking_lot_core"
-version = "0.9.12"
+name = "objc2-cloud-kit"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "objc2",
+ "objc2-core-location",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-contacts"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
+dependencies = [
+ "block2",
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-core-data"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-core-image"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
+dependencies = [
+ "block2",
+ "objc2",
+ "objc2-foundation",
+ "objc2-metal",
+]
+
+[[package]]
+name = "objc2-core-location"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
+dependencies = [
+ "block2",
+ "objc2",
+ "objc2-contacts",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-encode"
+version = "4.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
+
+[[package]]
+name = "objc2-foundation"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "dispatch",
+ "libc",
+ "objc2",
+]
+
+[[package]]
+name = "objc2-link-presentation"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
+dependencies = [
+ "block2",
+ "objc2",
+ "objc2-app-kit",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-metal"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-quartz-core"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "objc2",
+ "objc2-foundation",
+ "objc2-metal",
+]
+
+[[package]]
+name = "objc2-symbols"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
+dependencies = [
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-ui-kit"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "objc2",
+ "objc2-cloud-kit",
+ "objc2-core-data",
+ "objc2-core-image",
+ "objc2-core-location",
+ "objc2-foundation",
+ "objc2-link-presentation",
+ "objc2-quartz-core",
+ "objc2-symbols",
+ "objc2-uniform-type-identifiers",
+ "objc2-user-notifications",
+]
+
+[[package]]
+name = "objc2-uniform-type-identifiers"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
+dependencies = [
+ "block2",
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-user-notifications"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "objc2",
+ "objc2-core-location",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "orbclient"
+version = "0.3.55"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747"
+dependencies = [
+ "libc",
+ "libredox",
+]
+
+[[package]]
+name = "ordered-float"
+version = "5.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "owned_ttf_parser"
+version = "0.25.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b"
+dependencies = [
+ "ttf-parser",
+]
+
+[[package]]
+name = "parking_lot"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall",
+ "redox_syscall 0.5.18",
"smallvec",
"windows-link",
]
@@ -709,6 +1321,32 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[package]]
+name = "pin-project"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
[[package]]
name = "pin-project-lite"
version = "0.2.17"
@@ -721,6 +1359,12 @@ version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
+[[package]]
+name = "plain"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
+
[[package]]
name = "png"
version = "0.17.16"
@@ -734,6 +1378,20 @@ dependencies = [
"miniz_oxide 0.8.9",
]
+[[package]]
+name = "polling"
+version = "3.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
+dependencies = [
+ "cfg-if",
+ "concurrent-queue",
+ "hermit-abi",
+ "pin-project-lite",
+ "rustix 1.1.5",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "pollster"
version = "0.4.0"
@@ -761,6 +1419,15 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
+[[package]]
+name = "proc-macro-crate"
+version = "3.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
+dependencies = [
+ "toml_edit",
+]
+
[[package]]
name = "proc-macro2"
version = "1.0.107"
@@ -776,6 +1443,15 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"
+[[package]]
+name = "quick-xml"
+version = "0.41.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "quote"
version = "1.0.47"
@@ -785,6 +1461,18 @@ dependencies = [
"proc-macro2",
]
+[[package]]
+name = "r-efi"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
[[package]]
name = "range-alloc"
version = "0.1.5"
@@ -797,6 +1485,15 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
+[[package]]
+name = "redox_syscall"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
+dependencies = [
+ "bitflags 1.3.2",
+]
+
[[package]]
name = "redox_syscall"
version = "0.5.18"
@@ -806,6 +1503,15 @@ dependencies = [
"bitflags 2.13.2",
]
+[[package]]
+name = "redox_syscall"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd"
+dependencies = [
+ "bitflags 2.13.2",
+]
+
[[package]]
name = "renderdoc-sys"
version = "1.1.0"
@@ -818,18 +1524,87 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+[[package]]
+name = "rustc_version"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "rustix"
+version = "0.38.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
+dependencies = [
+ "bitflags 2.13.2",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.4.15",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "rustix"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d"
+dependencies = [
+ "bitflags 2.13.2",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.12.1",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "rustversion"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "scoped-tls"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
+
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+[[package]]
+name = "sctk-adwaita"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec"
+dependencies = [
+ "ab_glyph",
+ "log",
+ "memmap2",
+ "smithay-client-toolkit",
+ "tiny-skia",
+]
+
+[[package]]
+name = "semver"
+version = "1.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
+
[[package]]
name = "serde"
version = "1.0.229"
@@ -873,12 +1648,34 @@ dependencies = [
"zmij",
]
+[[package]]
+name = "shlex"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
[[package]]
name = "simd-adler32"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
+[[package]]
+name = "simd_cesu8"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
[[package]]
name = "slab"
version = "0.4.12"
@@ -900,6 +1697,40 @@ version = "1.16.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
+[[package]]
+name = "smithay-client-toolkit"
+version = "0.19.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
+dependencies = [
+ "bitflags 2.13.2",
+ "calloop",
+ "calloop-wayland-source",
+ "cursor-icon",
+ "libc",
+ "log",
+ "memmap2",
+ "rustix 0.38.44",
+ "thiserror 1.0.69",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-csd-frame",
+ "wayland-cursor",
+ "wayland-protocols",
+ "wayland-protocols-wlr",
+ "wayland-scanner",
+ "xkeysym",
+]
+
+[[package]]
+name = "smol_str"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "spirv"
version = "0.3.0+sdk-1.3.268.0"
@@ -915,6 +1746,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+[[package]]
+name = "strict-num"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
+
[[package]]
name = "syn"
version = "2.0.119"
@@ -986,6 +1823,31 @@ dependencies = [
"syn 3.0.9",
]
+[[package]]
+name = "tiny-skia"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab"
+dependencies = [
+ "arrayref",
+ "arrayvec",
+ "bytemuck",
+ "cfg-if",
+ "log",
+ "tiny-skia-path",
+]
+
+[[package]]
+name = "tiny-skia-path"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"
+dependencies = [
+ "arrayref",
+ "bytemuck",
+ "strict-num",
+]
+
[[package]]
name = "tokio"
version = "1.54.1"
@@ -995,12 +1857,70 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "toml_datetime"
+version = "1.1.2+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.25.17+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c"
+dependencies = [
+ "indexmap",
+ "toml_datetime",
+ "toml_parser",
+ "winnow",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.1.5+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
+dependencies = [
+ "winnow",
+]
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "pin-project-lite",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+
+[[package]]
+name = "ttf-parser"
+version = "0.25.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
+
[[package]]
name = "unicode-ident"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
+[[package]]
+name = "unicode-segmentation"
+version = "1.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
+
[[package]]
name = "unicode-width"
version = "0.2.2"
@@ -1013,6 +1933,25 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
+[[package]]
+name = "wasip2"
+version = "1.0.4+wasi-0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"
+dependencies = [
+ "wit-bindgen",
+]
+
[[package]]
name = "wasm-bindgen"
version = "0.2.129"
@@ -1069,6 +2008,115 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "wayland-backend"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078"
+dependencies = [
+ "cc",
+ "downcast-rs",
+ "rustix 1.1.5",
+ "scoped-tls",
+ "smallvec",
+ "wayland-sys",
+]
+
+[[package]]
+name = "wayland-client"
+version = "0.31.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073"
+dependencies = [
+ "bitflags 2.13.2",
+ "rustix 1.1.5",
+ "wayland-backend",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-csd-frame"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
+dependencies = [
+ "bitflags 2.13.2",
+ "cursor-icon",
+ "wayland-backend",
+]
+
+[[package]]
+name = "wayland-cursor"
+version = "0.31.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d"
+dependencies = [
+ "rustix 1.1.5",
+ "wayland-client",
+ "xcursor",
+]
+
+[[package]]
+name = "wayland-protocols"
+version = "0.32.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6"
+dependencies = [
+ "bitflags 2.13.2",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-protocols-plasma"
+version = "0.3.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91"
+dependencies = [
+ "bitflags 2.13.2",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-protocols",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-protocols-wlr"
+version = "0.3.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234"
+dependencies = [
+ "bitflags 2.13.2",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-protocols",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-scanner"
+version = "0.31.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0"
+dependencies = [
+ "proc-macro2",
+ "quick-xml",
+ "quote",
+]
+
+[[package]]
+name = "wayland-sys"
+version = "0.31.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"
+dependencies = [
+ "dlib",
+ "log",
+ "once_cell",
+ "pkg-config",
+]
+
[[package]]
name = "web-sys"
version = "0.3.106"
@@ -1079,6 +2127,16 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
[[package]]
name = "wgpu"
version = "27.0.1"
@@ -1182,7 +2240,7 @@ dependencies = [
"bytemuck",
"cfg-if",
"cfg_aliases",
- "core-graphics-types",
+ "core-graphics-types 0.2.0",
"glow",
"glutin_wgl_sys",
"gpu-alloc",
@@ -1236,7 +2294,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1309,6 +2367,24 @@ dependencies = [
"windows-targets",
]
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets",
+]
+
[[package]]
name = "windows-sys"
version = "0.61.2"
@@ -1382,6 +2458,130 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+[[package]]
+name = "winit"
+version = "0.30.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d"
+dependencies = [
+ "ahash",
+ "android-activity",
+ "atomic-waker",
+ "bitflags 2.13.2",
+ "block2",
+ "bytemuck",
+ "calloop",
+ "cfg_aliases",
+ "concurrent-queue",
+ "core-foundation 0.9.4",
+ "core-graphics",
+ "cursor-icon",
+ "dpi",
+ "js-sys",
+ "libc",
+ "memmap2",
+ "ndk",
+ "objc2",
+ "objc2-app-kit",
+ "objc2-foundation",
+ "objc2-ui-kit",
+ "orbclient",
+ "percent-encoding",
+ "pin-project",
+ "raw-window-handle",
+ "redox_syscall 0.4.1",
+ "rustix 0.38.44",
+ "sctk-adwaita",
+ "smithay-client-toolkit",
+ "smol_str",
+ "tracing",
+ "unicode-segmentation",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-protocols",
+ "wayland-protocols-plasma",
+ "web-sys",
+ "web-time",
+ "windows-sys 0.52.0",
+ "x11-dl",
+ "x11rb",
+ "xkbcommon-dl",
+]
+
+[[package]]
+name = "winnow"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "wit-bindgen"
+version = "0.57.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
+
+[[package]]
+name = "x11-dl"
+version = "2.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
+dependencies = [
+ "libc",
+ "once_cell",
+ "pkg-config",
+]
+
+[[package]]
+name = "x11rb"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
+dependencies = [
+ "as-raw-xcb-connection",
+ "gethostname",
+ "libc",
+ "libloading",
+ "once_cell",
+ "rustix 1.1.5",
+ "x11rb-protocol",
+]
+
+[[package]]
+name = "x11rb-protocol"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
+
+[[package]]
+name = "xcursor"
+version = "0.3.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23"
+
+[[package]]
+name = "xkbcommon-dl"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
+dependencies = [
+ "bitflags 2.13.2",
+ "dlib",
+ "log",
+ "once_cell",
+ "xkeysym",
+]
+
+[[package]]
+name = "xkeysym"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
+
[[package]]
name = "xml-rs"
version = "0.8.29"
diff --git a/native/Cargo.toml b/native/Cargo.toml
index d93a952..b2af69f 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -10,6 +10,7 @@ publish = false
[workspace.dependencies]
mesh-avatar-core = { path = "crates/mesh-avatar-core" }
+mesh-avatar-wgpu = { path = "crates/mesh-avatar-wgpu" }
anyhow = "1"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["float_roundtrip"] }
@@ -18,3 +19,4 @@ zip = { version = "2", default-features = false }
wgpu = "27"
pollster = "0.4"
bytemuck = { version = "1", features = ["derive"] }
+winit = "0.30"
diff --git a/native/README.md b/native/README.md
new file mode 100644
index 0000000..59c6d9d
--- /dev/null
+++ b/native/README.md
@@ -0,0 +1,110 @@
+# Native mesh avatars
+
+The Rust runtime loads the same `.mavatar` files and built project folders as the
+JavaScript runtime. It includes a transparent desktop avatar and a PNG renderer.
+The primary desktop target is macOS with Metal.
+
+## Prerequisites
+
+- Rust 1.88 or newer, with Cargo.
+- On macOS, the Xcode Command Line Tools and a Metal-capable GPU.
+- An avatar archive, or a project containing `rig.json`, `built/layers.json` and
+ the built PNG assets. The illustration alone is not a playable avatar.
+
+The commands below run from the repository root. The default avatar uses
+`samples/miko-qipao`; its images must be installed. The sample's
+[asset terms](../samples/miko-qipao/MIKO_ASSET_TERMS.md) apply.
+
+## Desktop app
+
+```sh
+cargo build --release --manifest-path native/Cargo.toml -p mesh-avatar-desktop
+native/target/release/mesh-avatar-desktop
+```
+
+Open another avatar:
+
+```sh
+native/target/release/mesh-avatar-desktop /path/to/avatar.mavatar
+native/target/release/mesh-avatar-desktop /path/to/project
+```
+
+Without an argument, the app finds the sample relative to the current source
+checkout or the executable. An executable copied elsewhere needs an explicit
+avatar path.
+
+The window is transparent, borderless, above normal windows, and has no shadow on
+macOS. Its initial width is 400 logical pixels; the height follows the avatar's
+image and viewport padding. The bundled sample starts around 400 × 372, with its
+flat image edge cropped above the window. Large movements can tighten this crop
+slightly to keep that edge hidden. Scaling preserves the window's aspect ratio.
+Scroll and keyboard scaling share a 40%–400% range, further limited by the
+monitor's size and the GPU's texture limit. Input bursts are combined before
+resizing; rendering waits until the surface and window have matching sizes.
+
+| Control | Action |
+|---|---|
+| Left-drag | Move the avatar window |
+| Scroll | Scale the window |
+| Command + `+` / `-` | Scale the window |
+| `1`–`9` | Play the first nine built-in motions, listed in the terminal |
+| `E` | Cycle live expressions |
+| `K` | Run a kana mouth-shape demo; no audio is played |
+| `C` | Toggle cursor click-through; off at startup |
+| Escape or Command + `Q` | Quit |
+
+Controls apply while the avatar app has keyboard focus. With click-through on,
+mouse events go to the window underneath. Use the Dock or Command-Tab to focus
+the avatar app again, then press `C` to turn click-through off. The toggle is not
+a global shortcut. If focus cannot be restored, quit from the Dock and relaunch;
+click-through always starts off.
+
+Idle movement, blinking, breathing and occasional motions run automatically.
+Rendering follows the display's presentation rate. Resizing and monitor scale
+changes update the physical render size; animation time steps are capped at
+0.05 seconds after a stall or sleep.
+
+## Render a PNG
+
+```sh
+cargo run --release --manifest-path native/Cargo.toml -p mesh-avatar-wgpu \
+ --bin mesh-avatar-render -- samples/miko-qipao --size 512x640 -o avatar.png
+```
+
+Supply a JSON object such as `{"angleX":20,"mouthOpen":0.8}` with `--pose`.
+Unspecified pose parameters use their defaults. `--seconds` advances the avatar
+at 60 simulation steps per second before rendering. `--help` lists options for
+viewport padding, fit, expressions and multisampling.
+
+## Checks and visual comparison
+
+Node.js 22.17 or newer and the repository's npm dependencies are needed only for
+comparison with the JavaScript runtime:
+
+```sh
+node --experimental-strip-types native/conformance/dump.mjs
+cargo test --manifest-path native/Cargo.toml
+cargo clippy --manifest-path native/Cargo.toml --all-targets -- -D warnings
+cargo fmt --manifest-path native/Cargo.toml --all --check
+node native/conformance/compare-pixels.mjs
+```
+
+The dump checks that the embedded motion data matches the JavaScript source.
+To intentionally update it, run
+`node --experimental-strip-types native/conformance/sync-motion-data.mjs`.
+Numeric comparison data, PNGs and reports go into ignored `native/target/`.
+Comparison tests print a skip message when their generated data is absent.
+The pixel comparison uses Playwright's installed Chromium; `--metal` selects its
+Metal backend on macOS, and `--dpr=2` checks equal physical sizes at HiDPI.
+
+## Limitations
+
+- Windows and Linux desktop behavior has not been verified. Window transparency,
+ always-on-top behavior and cursor click-through depend on the OS compositor.
+ The app exits if a transparent surface is unavailable.
+- Desktop input is limited to the controls above. Camera tracking, microphone
+ input, audio playback and lighting are not included.
+- The desktop is a Cargo-built executable, without an installer, signed app
+ bundle or global keyboard shortcuts. Window position and scale reset on launch.
+- GPU rasterization and antialiasing can differ slightly from Chromium. Compare
+ premultiplied colors when inspecting nearly transparent image edges.
diff --git a/native/apps/mesh-avatar-desktop/Cargo.toml b/native/apps/mesh-avatar-desktop/Cargo.toml
index cdc6d3e..4634055 100644
--- a/native/apps/mesh-avatar-desktop/Cargo.toml
+++ b/native/apps/mesh-avatar-desktop/Cargo.toml
@@ -4,3 +4,11 @@ version.workspace = true
edition.workspace = true
rust-version.workspace = true
publish.workspace = true
+
+[dependencies]
+mesh-avatar-core.workspace = true
+mesh-avatar-wgpu.workspace = true
+winit.workspace = true
+wgpu.workspace = true
+pollster.workspace = true
+anyhow.workspace = true
diff --git a/native/apps/mesh-avatar-desktop/src/main.rs b/native/apps/mesh-avatar-desktop/src/main.rs
index e6ef620..97cc685 100644
--- a/native/apps/mesh-avatar-desktop/src/main.rs
+++ b/native/apps/mesh-avatar-desktop/src/main.rs
@@ -1,3 +1,620 @@
+mod presentation;
+mod scaling;
+use anyhow::{bail, ensure, Context, Result};
+use mesh_avatar_core::{
+ engine::{expression::OVERLAY_EXPRESSIONS, motion::SpeakOptions},
+ Avatar, Frame,
+};
+use mesh_avatar_wgpu::{Fit, Renderer, ViewOptions};
+use presentation::StraightAlpha;
+use scaling::{render_size, ScaleBounds, Scaling};
+use std::{
+ env,
+ panic::{catch_unwind, AssertUnwindSafe},
+ path::{Path, PathBuf},
+ sync::{
+ atomic::{AtomicBool, Ordering},
+ Arc,
+ },
+ time::Instant,
+};
+use winit::{
+ application::ApplicationHandler,
+ dpi::{LogicalSize, PhysicalPosition, PhysicalSize},
+ event::{ElementState, MouseButton, WindowEvent},
+ event_loop::{ActiveEventLoop, ControlFlow, EventLoop},
+ keyboard::{KeyCode, ModifiersState, PhysicalKey},
+ window::{Window, WindowId, WindowLevel},
+};
+
+fn default_sample() -> Result<PathBuf> {
+ let current = env::current_dir()?;
+ let executable = env::current_exe()?;
+ for start in [
+ current.as_path(),
+ executable.parent().unwrap_or(Path::new(".")),
+ ] {
+ for root in start.ancestors() {
+ let sample = root.join("samples/miko-qipao");
+ if root.join("native/Cargo.toml").is_file() && sample.join("rig.json").is_file() {
+ return Ok(sample);
+ }
+ }
+ }
+ bail!("Default sample not found. Run from a source checkout or pass a .mavatar file or built project folder.")
+}
+fn base_size(view: &ViewOptions) -> LogicalSize<f64> {
+ LogicalSize::new(
+ 400.0,
+ 400.0 * f64::from(view.image_size[1]) * (1.0 + view.pad_top)
+ / (f64::from(view.image_size[0]) * (1.0 + 2.0 * view.pad_side)),
+ )
+}
+
+/// Keep a painted source-image cutoff outside the window, including extreme poses.
+struct TopEdgeGuard {
+ vertices: Vec<usize>,
+}
+impl TopEdgeGuard {
+ fn new(avatar: &Avatar, frame: &Frame) -> Self {
+ let Some(base) = frame.layers.iter().find(|l| l.name == "base") else {
+ return Self { vertices: vec![] };
+ };
+ let Some(image) = avatar.textures().get("base.png") else {
+ return Self { vertices: vec![] };
+ };
+ let radius = avatar.package().rig.mesh.base_cell as usize + 2;
+ let vertices = base
+ .uvs
+ .as_chunks::<2>()
+ .0
+ .iter()
+ .enumerate()
+ .filter_map(|(i, &[u, v])| {
+ if v != 0.0 {
+ return None;
+ }
+ let x = (u * image.width as f32) as usize;
+ let from = x.saturating_sub(radius);
+ let to = (x + radius + 1).min(image.width as usize);
+ (from..to).any(|x| image.rgba[x * 4 + 3] > 3).then_some(i)
+ })
+ .collect();
+ Self { vertices }
+ }
+ fn view(&self, frame: &Frame, view: ViewOptions, size: [u32; 2]) -> ViewOptions {
+ let Some(base) = frame.layers.iter().find(|l| l.name == "base") else {
+ return view;
+ };
+ let max_y = self
+ .vertices
+ .iter()
+ .filter_map(|&i| base.positions.get(i * 2 + 1))
+ .copied()
+ .map(f64::from)
+ .reduce(f64::max);
+ let Some(y) = max_y else {
+ return view;
+ };
+ guarded_view(view, size, y)
+ }
+}
+fn guarded_view(view: ViewOptions, size: [u32; 2], y: f64) -> ViewOptions {
+ let Ok(transform) = view.transform(size) else {
+ return view;
+ };
+ let current_scale = f64::from(transform[0]) * f64::from(size[0]) / 2.0;
+ let height = f64::from(view.image_size[1]);
+ let width = f64::from(view.image_size[0]);
+ let remaining = height - y - 2.0 / current_scale;
+ if remaining <= 0.0 {
+ return view;
+ }
+ let scale = (f64::from(size[1]) / remaining).max(current_scale);
+ ViewOptions {
+ pad_top: f64::from(size[1]) / (height * scale) - 1.0,
+ pad_side: f64::from(size[0]) / (width * scale) / 2.0 - 0.5,
+ ..view
+ }
+}
+
+struct Scene {
+ surface: wgpu::Surface<'static>,
+ window: Arc<Window>,
+ device: wgpu::Device,
+ queue: wgpu::Queue,
+ config: wgpu::SurfaceConfiguration,
+ view_format: wgpu::TextureFormat,
+ renderer: Renderer,
+ straight: Option<StraightAlpha>,
+ avatar: Avatar,
+ view: ViewOptions,
+ top_edge: TopEdgeGuard,
+ last_frame: Instant,
+ scaling: Scaling,
+ pending_surface_size: Option<PhysicalSize<u32>>,
+ redraw_requested: bool,
+ gpu_failed: Arc<AtomicBool>,
+ modifiers: ModifiersState,
+ expression_index: usize,
+ click_through: bool,
+ occluded: bool,
+}
+impl Scene {
+ async fn new(event_loop: &ActiveEventLoop, mut avatar: Avatar) -> Result<Self> {
+ let rig = &avatar.package().rig;
+ let view = ViewOptions {
+ image_size: [rig.image.width, rig.image.height],
+ pad_top: rig.view.pad_top,
+ pad_side: rig.view.pad_side,
+ fit: Fit::Contain,
+ };
+ let mut base_size = base_size(&view);
+ Scaling::new(base_size)?;
+ if let Some(monitor) = event_loop.primary_monitor() {
+ let screen = monitor.size().to_logical::<f64>(monitor.scale_factor());
+ let fit = (screen.width * 0.85 / base_size.width)
+ .min(screen.height * 0.85 / base_size.height)
+ .min(1.0);
+ base_size.width *= fit;
+ base_size.height *= fit;
+ }
+ let attributes = Window::default_attributes()
+ .with_title("Mesh Avatar")
+ .with_inner_size(base_size)
+ .with_transparent(true)
+ .with_decorations(false)
+ .with_resizable(false)
+ .with_window_level(WindowLevel::AlwaysOnTop)
+ .with_visible(false);
+ #[cfg(target_os = "macos")]
+ let attributes = {
+ use winit::platform::macos::WindowAttributesExtMacOS;
+ attributes.with_has_shadow(false)
+ };
+ let window = Arc::new(event_loop.create_window(attributes)?);
+ let instance = wgpu::Instance::new(&Default::default());
+ let surface = instance.create_surface(window.clone())?;
+ let adapter = instance
+ .request_adapter(&wgpu::RequestAdapterOptions {
+ power_preference: wgpu::PowerPreference::LowPower,
+ compatible_surface: Some(&surface),
+ force_fallback_adapter: false,
+ })
+ .await?;
+ let info = adapter.get_info();
+ let caps = surface.get_capabilities(&adapter);
+ let alpha_mode = [
+ wgpu::CompositeAlphaMode::PreMultiplied,
+ wgpu::CompositeAlphaMode::PostMultiplied,
+ ]
+ .into_iter()
+ .find(|mode| caps.alpha_modes.contains(mode))
+ .context("The graphics compositor does not support transparent windows")?;
+ let format = caps
+ .formats
+ .iter()
+ .copied()
+ .find(|f| !f.is_srgb())
+ .or_else(|| caps.formats.first().copied())
+ .context("No supported surface format")?;
+ let view_format = format.remove_srgb_suffix();
+ let (device, queue) = adapter
+ .request_device(&wgpu::DeviceDescriptor {
+ label: Some("desktop avatar"),
+ ..Default::default()
+ })
+ .await?;
+ let gpu_failed = Arc::new(AtomicBool::new(false));
+ let failed = gpu_failed.clone();
+ device.on_uncaptured_error(Arc::new(move |error| {
+ eprintln!("Desktop graphics error: {error}");
+ failed.store(true, Ordering::Relaxed);
+ }));
+ let size = window.inner_size();
+ ensure!(
+ render_size(size, size, device.limits().max_texture_dimension_2d).is_some(),
+ "initial window exceeds graphics device limits"
+ );
+ let config = wgpu::SurfaceConfiguration {
+ usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
+ format,
+ width: size.width.max(1),
+ height: size.height.max(1),
+ present_mode: wgpu::PresentMode::Fifo,
+ desired_maximum_frame_latency: 2,
+ alpha_mode,
+ view_formats: if format == view_format {
+ vec![]
+ } else {
+ vec![view_format]
+ },
+ };
+ surface.configure(&device, &config);
+ // wgpu 27's Metal backend labels transparent CAMetalLayer surfaces PostMultiplied,
+ // but CoreAnimation consumes the premultiplied pixels produced by our renderer.
+ let mut straight = (alpha_mode == wgpu::CompositeAlphaMode::PostMultiplied
+ && info.backend != wgpu::Backend::Metal)
+ .then(|| StraightAlpha::new(&device, view_format));
+ if let Some(pass) = &mut straight {
+ pass.resize(&device, view_format, [config.width, config.height]);
+ }
+ let renderer = Renderer::new(&device, &queue, view_format, 4, avatar.textures())?;
+ avatar.set_auto_idle(true);
+ avatar.set_auto_motion(true);
+ let initial = avatar.tick(0.0);
+ let top_edge = TopEdgeGuard::new(&avatar, &initial);
+ if let Some(monitor) = window
+ .current_monitor()
+ .or_else(|| event_loop.primary_monitor())
+ {
+ let origin = monitor.position();
+ let screen = monitor.size();
+ let scale = window.scale_factor();
+ window.set_outer_position(PhysicalPosition::new(
+ origin.x + screen.width as i32 - size.width as i32 - (32.0 * scale) as i32,
+ origin.y + screen.height as i32 - size.height as i32 - (64.0 * scale) as i32,
+ ));
+ }
+ eprintln!(
+ "Mesh Avatar: {} — {} ({:?}), {:?} transparency, {:.0}×{:.0} logical pixels at {:.1}×",
+ avatar.package().manifest.name,
+ info.name,
+ info.backend,
+ alpha_mode,
+ base_size.width,
+ base_size.height,
+ window.scale_factor()
+ );
+ eprintln!("Drag to move · scroll or Cmd +/- to scale · E expression · K kana · C click-through · Esc quit");
+ for (i, motion) in avatar.motions().iter().take(9).enumerate() {
+ eprintln!("{}: {}", i + 1, motion.label);
+ }
+ window.set_visible(true);
+ window.focus_window();
+ window.request_redraw();
+ Ok(Self {
+ surface,
+ window,
+ device,
+ queue,
+ config,
+ view_format,
+ renderer,
+ straight,
+ avatar,
+ view,
+ top_edge,
+ last_frame: Instant::now(),
+ scaling: Scaling::new(base_size)?,
+ pending_surface_size: None,
+ redraw_requested: true,
+ gpu_failed,
+ modifiers: ModifiersState::empty(),
+ expression_index: 0,
+ click_through: false,
+ occluded: false,
+ })
+ }
+ fn resize(&mut self, size: PhysicalSize<u32>) -> Result<()> {
+ if size.width == 0 || size.height == 0 {
+ return Ok(());
+ }
+ ensure!(
+ render_size(size, size, self.device.limits().max_texture_dimension_2d).is_some(),
+ "window dimensions exceed graphics device limits: {}×{}",
+ size.width,
+ size.height
+ );
+ self.config.width = size.width;
+ self.config.height = size.height;
+ self.surface.configure(&self.device, &self.config);
+ if let Some(pass) = &mut self.straight {
+ pass.resize(&self.device, self.view_format, [size.width, size.height]);
+ }
+ self.window.request_redraw();
+ Ok(())
+ }
+ fn scale_bounds(&self) -> ScaleBounds {
+ ScaleBounds {
+ dpi: self.window.scale_factor(),
+ screen: self
+ .window
+ .current_monitor()
+ .map(|m| m.size().to_logical(m.scale_factor())),
+ texture_limit: self.device.limits().max_texture_dimension_2d,
+ }
+ }
+ /// Run native resize and GPU work after input/drawRect callbacks return.
+ fn service(&mut self) -> Result<()> {
+ ensure!(
+ !self.gpu_failed.load(Ordering::Relaxed),
+ "graphics device reported an error"
+ );
+ if let Some(desired) = self.scaling.take_request() {
+ if desired != self.window.inner_size() {
+ // macOS returns None and queues Resized. Synchronous platforms may return
+ // the accepted size without sending a notification; treat it identically.
+ if let Some(accepted) = self.window.request_inner_size(desired) {
+ self.pending_surface_size = Some(accepted);
+ }
+ }
+ }
+ if let Some(size) = self.pending_surface_size.take() {
+ // Several notifications can be queued during a trackpad input burst.
+ if size == self.window.inner_size() {
+ self.resize(size)?;
+ }
+ }
+ if std::mem::take(&mut self.redraw_requested) && !self.occluded {
+ self.redraw()?;
+ }
+ ensure!(
+ !self.gpu_failed.load(Ordering::Relaxed),
+ "graphics device reported an error"
+ );
+ if !self.occluded {
+ self.window.request_redraw();
+ }
+ Ok(())
+ }
+ fn redraw(&mut self) -> Result<()> {
+ let now = Instant::now();
+ let dt = (now - self.last_frame).as_secs_f64().min(0.05);
+ self.last_frame = now;
+ let Some(size) = render_size(
+ PhysicalSize::new(self.config.width, self.config.height),
+ self.window.inner_size(),
+ self.device.limits().max_texture_dimension_2d,
+ ) else {
+ return Ok(());
+ };
+ let surface_frame = match self.surface.get_current_texture() {
+ Ok(frame) => frame,
+ Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
+ // Reconfigure on the next service pass with no acquired texture alive.
+ eprintln!("Desktop surface changed; reconfiguring before the next frame");
+ self.pending_surface_size = Some(self.window.inner_size());
+ return Ok(());
+ }
+ Err(wgpu::SurfaceError::Timeout) => return Ok(()),
+ Err(error) => return Err(error.into()),
+ };
+ if surface_frame.texture.width() != size[0] || surface_frame.texture.height() != size[1] {
+ self.pending_surface_size = Some(self.window.inner_size());
+ return Ok(());
+ }
+ let frame = self.avatar.tick(dt);
+ let view = self.top_edge.view(&frame, self.view, size);
+ let target = surface_frame
+ .texture
+ .create_view(&wgpu::TextureViewDescriptor {
+ format: Some(self.view_format),
+ ..Default::default()
+ });
+ let mut encoder = self.device.create_command_encoder(&Default::default());
+ let output = match &self.straight {
+ Some(pass) => pass
+ .view()
+ .context("surface alpha target is not configured")?,
+ None => &target,
+ };
+ self.renderer
+ .render(&mut encoder, output, size, &frame, &view)?;
+ if let Some(pass) = &self.straight {
+ pass.encode(&mut encoder, &target)?;
+ }
+ self.queue.submit([encoder.finish()]);
+ self.window.pre_present_notify();
+ surface_frame.present();
+ Ok(())
+ }
+ fn key(&mut self, event_loop: &ActiveEventLoop, key: KeyCode, repeat: bool) {
+ let command = if cfg!(target_os = "macos") {
+ self.modifiers.super_key()
+ } else {
+ self.modifiers.control_key()
+ };
+ match key {
+ KeyCode::Escape => event_loop.exit(),
+ KeyCode::KeyQ if command => event_loop.exit(),
+ KeyCode::Equal | KeyCode::NumpadAdd if command => {
+ self.scaling.keyboard(true, self.scale_bounds())
+ }
+ KeyCode::Minus | KeyCode::NumpadSubtract if command => {
+ self.scaling.keyboard(false, self.scale_bounds())
+ }
+ _ if repeat => {}
+ KeyCode::KeyE => {
+ self.expression_index = (self.expression_index + 1) % OVERLAY_EXPRESSIONS.len();
+ let name = OVERLAY_EXPRESSIONS[self.expression_index].0;
+ self.avatar.set_expression(name);
+ eprintln!("Expression: {name}");
+ }
+ KeyCode::KeyK => self.avatar.speak_kana(
+ "こんにちは。きょうも、いっしょにあいうえおをれんしゅうしましょう。",
+ SpeakOptions::default(),
+ ),
+ KeyCode::KeyC => match self.window.set_cursor_hittest(self.click_through) {
+ Ok(()) => {
+ self.click_through = !self.click_through;
+ eprintln!("Click-through {}. Focus Mesh Avatar with the Dock or app switcher, then press C to turn it off.",if self.click_through {"on"} else {"off"});
+ }
+ Err(error) => eprintln!("Could not change click-through: {error}"),
+ },
+ KeyCode::Digit1
+ | KeyCode::Digit2
+ | KeyCode::Digit3
+ | KeyCode::Digit4
+ | KeyCode::Digit5
+ | KeyCode::Digit6
+ | KeyCode::Digit7
+ | KeyCode::Digit8
+ | KeyCode::Digit9 => {
+ let index = match key {
+ KeyCode::Digit1 => 0,
+ KeyCode::Digit2 => 1,
+ KeyCode::Digit3 => 2,
+ KeyCode::Digit4 => 3,
+ KeyCode::Digit5 => 4,
+ KeyCode::Digit6 => 5,
+ KeyCode::Digit7 => 6,
+ KeyCode::Digit8 => 7,
+ _ => 8,
+ };
+ if let Some(motion) = self.avatar.motions().get(index) {
+ self.avatar.play(&motion.id);
+ }
+ }
+ _ => {}
+ }
+ }
+}
+
+struct App {
+ avatar: Option<Avatar>,
+ scene: Option<Scene>,
+ error: Option<anyhow::Error>,
+}
+impl ApplicationHandler for App {
+ fn resumed(&mut self, event_loop: &ActiveEventLoop) {
+ if let Some(scene) = &mut self.scene {
+ scene.last_frame = Instant::now();
+ scene.occluded = false;
+ scene.pending_surface_size = Some(scene.window.inner_size());
+ return;
+ }
+ if let Some(avatar) = self.avatar.take() {
+ match pollster::block_on(Scene::new(event_loop, avatar)) {
+ Ok(scene) => self.scene = Some(scene),
+ Err(error) => {
+ self.error = Some(error);
+ event_loop.exit();
+ }
+ }
+ }
+ }
+ fn window_event(&mut self, event_loop: &ActiveEventLoop, id: WindowId, event: WindowEvent) {
+ let Some(scene) = &mut self.scene else {
+ return;
+ };
+ if scene.window.id() != id {
+ return;
+ }
+ match event {
+ WindowEvent::CloseRequested => event_loop.exit(),
+ WindowEvent::Resized(size) => scene.pending_surface_size = Some(size),
+ WindowEvent::ScaleFactorChanged { .. } => scene.scaling.refresh(scene.scale_bounds()),
+ WindowEvent::Occluded(value) => {
+ scene.occluded = value;
+ scene.last_frame = Instant::now();
+ }
+ WindowEvent::Focused(false) => scene.modifiers = ModifiersState::empty(),
+ WindowEvent::ModifiersChanged(value) => scene.modifiers = value.state(),
+ WindowEvent::KeyboardInput { event, .. } if event.state == ElementState::Pressed => {
+ if let PhysicalKey::Code(key) = event.physical_key {
+ scene.key(event_loop, key, event.repeat);
+ }
+ }
+ WindowEvent::MouseInput {
+ state: ElementState::Pressed,
+ button: MouseButton::Left,
+ ..
+ } => {
+ if let Err(error) = scene.window.drag_window() {
+ eprintln!("Could not move window: {error}");
+ }
+ }
+ WindowEvent::MouseWheel { delta, .. } => {
+ scene.scaling.scroll(delta, scene.scale_bounds());
+ }
+ WindowEvent::RedrawRequested => scene.redraw_requested = true,
+ _ => {}
+ }
+ }
+ fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) {
+ if let Some(scene) = &mut self.scene {
+ // Contain unexpected backend panics before they cross an AppKit C ABI boundary.
+ let result =
+ catch_unwind(AssertUnwindSafe(|| scene.service())).unwrap_or_else(|payload| {
+ let message = payload
+ .downcast_ref::<String>()
+ .map(String::as_str)
+ .or_else(|| payload.downcast_ref::<&str>().copied())
+ .unwrap_or("unknown graphics backend panic");
+ Err(anyhow::anyhow!("desktop update failed: {message}"))
+ });
+ if let Err(error) = result {
+ eprintln!("Desktop update stopped: {error:#}");
+ self.error = Some(error);
+ event_loop.exit();
+ }
+ }
+ }
+}
+fn run() -> Result<()> {
+ let mut args = env::args_os().skip(1);
+ let path = match args.next() {
+ Some(value) if value == "--help" || value == "-h" => {
+ println!("Usage: mesh-avatar-desktop [avatar.mavatar | project-folder]\nDefault: samples/miko-qipao in the source checkout.\nDrag to move; scroll/Cmd +/- to scale; 1–9 motions; E expressions; K kana; C click-through; Esc/Cmd+Q quit.");
+ return Ok(());
+ }
+ Some(value) => PathBuf::from(value),
+ None => default_sample()?,
+ };
+ ensure!(args.next().is_none(), "expected at most one avatar path");
+ let avatar = Avatar::open(path)
+ .context("Could not load avatar; a built project needs rig.json and built/ PNG assets")?;
+ let mut builder = EventLoop::builder();
+ #[cfg(target_os = "macos")]
+ {
+ use winit::platform::macos::{ActivationPolicy, EventLoopBuilderExtMacOS};
+ builder.with_activation_policy(ActivationPolicy::Regular);
+ }
+ let event_loop = builder.build()?;
+ event_loop.set_control_flow(ControlFlow::Wait);
+ let mut app = App {
+ avatar: Some(avatar),
+ scene: None,
+ error: None,
+ };
+ event_loop.run_app(&mut app)?;
+ if let Some(error) = app.error {
+ return Err(error);
+ }
+ Ok(())
+}
fn main() {
- eprintln!("The desktop avatar app is not implemented yet.");
+ if let Err(error) = run() {
+ eprintln!("mesh-avatar-desktop: {error:#}");
+ std::process::exit(1);
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ #[test]
+ fn default_aspect_preserves_top_crop_at_both_pixel_ratios() {
+ let view = ViewOptions {
+ image_size: [1254, 1254],
+ pad_top: -0.07,
+ pad_side: 0.0,
+ fit: Fit::Contain,
+ };
+ let size = base_size(&view);
+ assert!((size.height - 372.0).abs() < 1e-8);
+ for dpr in [1.0, 2.0] {
+ let physical: PhysicalSize<u32> = size.to_physical(dpr);
+ let t = view.transform([physical.width, physical.height]).unwrap();
+ let top = f64::from(physical.height) * (1.0 - f64::from(t[3])) / 2.0;
+ assert!(top < -27.9 * dpr);
+ }
+ let adjusted = guarded_view(view, [400, 372], 120.0);
+ let transform = adjusted.transform([400, 372]).unwrap();
+ let scale = f64::from(transform[0]) * 400.0 / 2.0;
+ let offset = 372.0 * (1.0 - f64::from(transform[3])) / 2.0;
+ assert!(120.0 * scale + offset < -1.99);
+ assert!((1254.0 * scale + offset - 372.0).abs() < 1e-3);
+ }
}
diff --git a/native/apps/mesh-avatar-desktop/src/present.wgsl b/native/apps/mesh-avatar-desktop/src/present.wgsl
new file mode 100644
index 0000000..817246d
--- /dev/null
+++ b/native/apps/mesh-avatar-desktop/src/present.wgsl
@@ -0,0 +1,10 @@
+@group(0) @binding(0) var image: texture_2d<f32>;
+@vertex fn vs(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
+ let p = array<vec2f,3>(vec2f(-1.0,-1.0),vec2f(3.0,-1.0),vec2f(-1.0,3.0))[index];
+ return vec4f(p,0.0,1.0);
+}
+@fragment fn fs(@builtin(position) position: vec4f) -> @location(0) vec4f {
+ let color = textureLoad(image,vec2i(position.xy),0);
+ if color.a > 0.0 { return vec4f(color.rgb / color.a,color.a); }
+ return vec4f(0.0);
+}
diff --git a/native/apps/mesh-avatar-desktop/src/presentation.rs b/native/apps/mesh-avatar-desktop/src/presentation.rs
new file mode 100644
index 0000000..7e5e1b2
--- /dev/null
+++ b/native/apps/mesh-avatar-desktop/src/presentation.rs
@@ -0,0 +1,120 @@
+//! Convert the renderer's premultiplied output only when the compositor needs it.
+pub struct StraightAlpha {
+ pipeline: wgpu::RenderPipeline,
+ layout: wgpu::BindGroupLayout,
+ target: Option<(wgpu::TextureView, wgpu::BindGroup)>,
+}
+impl StraightAlpha {
+ pub fn new(device: &wgpu::Device, format: wgpu::TextureFormat) -> Self {
+ let layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
+ label: Some("surface alpha conversion"),
+ entries: &[wgpu::BindGroupLayoutEntry {
+ binding: 0,
+ visibility: wgpu::ShaderStages::FRAGMENT,
+ ty: wgpu::BindingType::Texture {
+ sample_type: wgpu::TextureSampleType::Float { filterable: false },
+ view_dimension: wgpu::TextureViewDimension::D2,
+ multisampled: false,
+ },
+ count: None,
+ }],
+ });
+ let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
+ label: Some("surface alpha conversion"),
+ bind_group_layouts: &[&layout],
+ push_constant_ranges: &[],
+ });
+ let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
+ label: Some("surface alpha conversion"),
+ source: wgpu::ShaderSource::Wgsl(include_str!("present.wgsl").into()),
+ });
+ let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
+ label: Some("surface alpha conversion"),
+ layout: Some(&pipeline_layout),
+ vertex: wgpu::VertexState {
+ module: &shader,
+ entry_point: Some("vs"),
+ compilation_options: Default::default(),
+ buffers: &[],
+ },
+ fragment: Some(wgpu::FragmentState {
+ module: &shader,
+ entry_point: Some("fs"),
+ compilation_options: Default::default(),
+ targets: &[Some(wgpu::ColorTargetState {
+ format,
+ blend: None,
+ write_mask: wgpu::ColorWrites::ALL,
+ })],
+ }),
+ primitive: Default::default(),
+ depth_stencil: None,
+ multisample: Default::default(),
+ multiview: None,
+ cache: None,
+ });
+ Self {
+ pipeline,
+ layout,
+ target: None,
+ }
+ }
+ pub fn resize(&mut self, device: &wgpu::Device, format: wgpu::TextureFormat, size: [u32; 2]) {
+ let texture = device.create_texture(&wgpu::TextureDescriptor {
+ label: Some("premultiplied avatar surface"),
+ size: wgpu::Extent3d {
+ width: size[0],
+ height: size[1],
+ depth_or_array_layers: 1,
+ },
+ mip_level_count: 1,
+ sample_count: 1,
+ dimension: wgpu::TextureDimension::D2,
+ format,
+ usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
+ view_formats: &[],
+ });
+ let view = texture.create_view(&Default::default());
+ let bind = device.create_bind_group(&wgpu::BindGroupDescriptor {
+ label: Some("surface alpha conversion"),
+ layout: &self.layout,
+ entries: &[wgpu::BindGroupEntry {
+ binding: 0,
+ resource: wgpu::BindingResource::TextureView(&view),
+ }],
+ });
+ self.target = Some((view, bind));
+ }
+ pub fn view(&self) -> Option<&wgpu::TextureView> {
+ self.target.as_ref().map(|target| &target.0)
+ }
+ pub fn encode(
+ &self,
+ encoder: &mut wgpu::CommandEncoder,
+ target: &wgpu::TextureView,
+ ) -> anyhow::Result<()> {
+ let (_, bind) = self
+ .target
+ .as_ref()
+ .ok_or_else(|| anyhow::anyhow!("surface alpha target is not configured"))?;
+ let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
+ label: Some("present straight alpha"),
+ color_attachments: &[Some(wgpu::RenderPassColorAttachment {
+ view: target,
+ resolve_target: None,
+ depth_slice: None,
+ ops: wgpu::Operations {
+ load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
+ store: wgpu::StoreOp::Store,
+ },
+ })],
+ depth_stencil_attachment: None,
+ timestamp_writes: None,
+ occlusion_query_set: None,
+ });
+ pass.set_pipeline(&self.pipeline);
+ pass.set_bind_group(0, bind, &[]);
+ pass.draw(0..3, 0..1);
+ Ok(())
+ }
+}
diff --git a/native/apps/mesh-avatar-desktop/src/scaling.rs b/native/apps/mesh-avatar-desktop/src/scaling.rs
new file mode 100644
index 0000000..ac084ba
--- /dev/null
+++ b/native/apps/mesh-avatar-desktop/src/scaling.rs
@@ -0,0 +1,249 @@
+//! Numeric input and render-size guards, independent of a window or GPU.
+use anyhow::{ensure, Result};
+use winit::{
+ dpi::{LogicalSize, PhysicalSize},
+ event::MouseScrollDelta,
+};
+
+pub struct ScaleBounds {
+ pub dpi: f64,
+ pub screen: Option<LogicalSize<f64>>,
+ pub texture_limit: u32,
+}
+
+pub struct Scaling {
+ base: LogicalSize<f64>,
+ zoom: f64,
+ pending: Option<PhysicalSize<u32>>,
+}
+
+impl Scaling {
+ pub fn new(base: LogicalSize<f64>) -> Result<Self> {
+ ensure!(
+ [base.width, base.height]
+ .iter()
+ .all(|v| v.is_finite() && *v > 0.0),
+ "invalid logical window dimensions"
+ );
+ Ok(Self {
+ base,
+ zoom: 1.0,
+ pending: None,
+ })
+ }
+
+ pub fn scroll(&mut self, delta: MouseScrollDelta, bounds: ScaleBounds) {
+ let amount = match delta {
+ MouseScrollDelta::LineDelta(_, y) => f64::from(y) * 0.08,
+ MouseScrollDelta::PixelDelta(p) => p.y / bounds.dpi * 0.0025,
+ };
+ self.change(amount, bounds);
+ }
+
+ pub fn keyboard(&mut self, increase: bool, bounds: ScaleBounds) {
+ self.change(
+ if increase {
+ 1.1_f64.ln()
+ } else {
+ -1.1_f64.ln()
+ },
+ bounds,
+ );
+ }
+
+ /// Also reapply bounds when moving between monitors with different pixel ratios.
+ pub fn refresh(&mut self, bounds: ScaleBounds) {
+ self.change(0.0, bounds);
+ }
+
+ fn change(&mut self, amount: f64, bounds: ScaleBounds) {
+ if !amount.is_finite()
+ || !bounds.dpi.is_finite()
+ || bounds.dpi <= 0.0
+ || bounds.texture_limit == 0
+ {
+ return;
+ }
+ let physical_base = [self.base.width * bounds.dpi, self.base.height * bounds.dpi];
+ if physical_base.iter().any(|v| !v.is_finite() || *v <= 0.0) {
+ return;
+ }
+ let mut upper = 4.0_f64;
+ for side in physical_base {
+ upper = upper.min(f64::from(bounds.texture_limit) / side);
+ }
+ if let Some(screen) = bounds.screen {
+ for (side, base) in [
+ (screen.width, self.base.width),
+ (screen.height, self.base.height),
+ ] {
+ if side.is_finite() && side > 0.0 {
+ upper = upper.min(side * 0.9 / base);
+ }
+ }
+ }
+ if !upper.is_finite() || upper <= 0.0 {
+ return;
+ }
+ // A small monitor or very large pixel ratio can lower the usual minimum.
+ self.zoom = (self.zoom * amount.clamp(-0.5, 0.5).exp()).clamp(0.4_f64.min(upper), upper);
+ let physical = physical_base.map(|v| {
+ (v * self.zoom)
+ .round()
+ .clamp(1.0, f64::from(bounds.texture_limit)) as u32
+ });
+ self.pending = Some(PhysicalSize::new(physical[0], physical[1]));
+ }
+
+ /// Coalesce an input burst into a single native resize outside its callbacks.
+ pub fn take_request(&mut self) -> Option<PhysicalSize<u32>> {
+ self.pending.take()
+ }
+}
+
+/// AppKit can request a draw before delivering its queued Resized notification.
+/// Using the new window size with the old surface would mismatch MSAA attachments.
+pub fn render_size(
+ configured: PhysicalSize<u32>,
+ actual: PhysicalSize<u32>,
+ limit: u32,
+) -> Option<[u32; 2]> {
+ (configured == actual
+ && actual.width > 0
+ && actual.height > 0
+ && actual.width <= limit
+ && actual.height <= limit)
+ .then_some([actual.width, actual.height])
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use winit::dpi::PhysicalPosition;
+
+ fn bounds(dpi: f64) -> ScaleBounds {
+ ScaleBounds {
+ dpi,
+ screen: Some(LogicalSize::new(1920.0, 1080.0)),
+ texture_limit: 8192,
+ }
+ }
+ fn scale() -> Scaling {
+ Scaling::new(LogicalSize::new(400.0, 372.0)).unwrap()
+ }
+
+ #[test]
+ fn line_and_trackpad_inputs_have_consistent_hidpi_units() {
+ for dpi in [1.0, 1.25, 2.0, 3.0, 4.0] {
+ let mut line = scale();
+ let mut pixel = scale();
+ line.scroll(MouseScrollDelta::LineDelta(0.0, 1.0), bounds(dpi));
+ pixel.scroll(
+ MouseScrollDelta::PixelDelta(PhysicalPosition::new(0.0, 32.0 * dpi)),
+ bounds(dpi),
+ );
+ assert_eq!(line.take_request(), pixel.take_request());
+ }
+ }
+
+ #[test]
+ fn bursts_extremes_and_direction_changes_stay_bounded() {
+ for dpi in [1.0, 1.25, 2.0, 4.0, 8.0, 1000.0] {
+ let mut scale = scale();
+ for i in 0..4000 {
+ let delta = [0.0, 0.001, -0.001, 1.0, -1.0, f64::MAX, -f64::MAX][i % 7];
+ scale.scroll(
+ MouseScrollDelta::PixelDelta(PhysicalPosition::new(0.0, delta)),
+ bounds(dpi),
+ );
+ if i % 3 == 0 {
+ scale.keyboard(i % 2 == 0, bounds(dpi));
+ }
+ let size = scale.take_request().unwrap();
+ assert!(size.width > 0 && size.height > 0);
+ assert!(size.width <= 8192 && size.height <= 8192);
+ // Physical rounding can change the logical aspect by at most one pixel.
+ assert!((f64::from(size.height) - f64::from(size.width) * 0.93).abs() <= 1.0);
+ assert!(f64::from(size.width) / dpi <= 1920.0 * 0.9 + 1.0);
+ assert!(f64::from(size.height) / dpi <= 1080.0 * 0.9 + 1.0);
+ }
+ }
+ }
+
+ #[test]
+ fn malformed_inputs_and_bounds_do_not_poison_subsequent_input() {
+ let mut scale = scale();
+ for value in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY] {
+ scale.scroll(
+ MouseScrollDelta::PixelDelta(PhysicalPosition::new(0.0, value)),
+ bounds(2.0),
+ );
+ assert!(scale.take_request().is_none());
+ }
+ for value in [f32::NAN, f32::INFINITY, f32::NEG_INFINITY] {
+ scale.scroll(MouseScrollDelta::LineDelta(0.0, value), bounds(2.0));
+ assert!(scale.take_request().is_none());
+ }
+ for dpi in [0.0, -1.0, f64::NAN, f64::INFINITY, f64::MAX] {
+ scale.keyboard(true, bounds(dpi));
+ assert!(scale.take_request().is_none());
+ }
+ scale.keyboard(true, bounds(2.0));
+ assert_eq!(scale.take_request(), Some(PhysicalSize::new(880, 818)));
+ let mut invalid = bounds(2.0);
+ invalid.texture_limit = 0;
+ scale.keyboard(true, invalid);
+ assert!(scale.take_request().is_none());
+ }
+
+ #[test]
+ fn command_keys_share_limits_and_requests_are_coalesced() {
+ let mut scale = scale();
+ for _ in 0..1000 {
+ scale.keyboard(false, bounds(2.0));
+ }
+ assert_eq!(scale.take_request(), Some(PhysicalSize::new(320, 298)));
+ assert!(scale.take_request().is_none());
+ for _ in 0..1000 {
+ scale.keyboard(true, bounds(2.0));
+ }
+ let max = scale.take_request().unwrap();
+ assert!(max.height <= 1944);
+ scale.keyboard(false, bounds(2.0));
+ assert!(scale.take_request().unwrap().height < max.height);
+ }
+
+ #[test]
+ fn moving_to_higher_dpi_respects_device_limits() {
+ let mut scale = scale();
+ for _ in 0..100 {
+ scale.keyboard(true, bounds(1.0));
+ }
+ scale.take_request();
+ scale.refresh(ScaleBounds {
+ dpi: 4.0,
+ screen: None,
+ texture_limit: 1024,
+ });
+ let size = scale.take_request().unwrap();
+ assert_eq!(size.width, 1024);
+ assert_eq!(size.height, 952);
+ }
+
+ #[test]
+ fn queued_resize_never_renders_mismatched_attachments() {
+ let old = PhysicalSize::new(800, 744);
+ let new = PhysicalSize::new(880, 818);
+ assert_eq!(render_size(old, old, 8192), Some([800, 744]));
+ // Native drawRect arrives before the queued resize has configured the surface.
+ assert_eq!(render_size(old, new, 8192), None);
+ assert_eq!(render_size(new, new, 8192), Some([880, 818]));
+ for bad in [
+ PhysicalSize::new(0, 744),
+ PhysicalSize::new(800, 0),
+ PhysicalSize::new(9000, 8000),
+ ] {
+ assert_eq!(render_size(bad, bad, 8192), None);
+ }
+ }
+}