From 9710ccc38a7ce0d66e960f665e39ed62306efcd5 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 5 Jun 2024 18:00:37 -0600 Subject: [PATCH] Add graphics backend configuration Hopefully #74, #73, #56 --- Cargo.lock | 662 ++++-------------------------- objdiff-gui/Cargo.toml | 26 +- objdiff-gui/src/app.rs | 52 ++- objdiff-gui/src/main.rs | 48 ++- objdiff-gui/src/views/debug.rs | 3 + objdiff-gui/src/views/graphics.rs | 158 +++++++ objdiff-gui/src/views/mod.rs | 1 + 7 files changed, 351 insertions(+), 599 deletions(-) create mode 100644 objdiff-gui/src/views/graphics.rs diff --git a/Cargo.lock b/Cargo.lock index cee6dfd..4a713e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,71 +28,6 @@ dependencies = [ "serde", ] -[[package]] -name = "accesskit_consumer" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" -dependencies = [ - "accesskit", -] - -[[package]] -name = "accesskit_macos" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" -dependencies = [ - "accesskit", - "accesskit_consumer", - "objc2 0.3.0-beta.3.patch-leaks.3", - "once_cell", -] - -[[package]] -name = "accesskit_unix" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f46c18d99ba61ad7123dd13eeb0c104436ab6af1df6a1cd8c11054ed394a08" -dependencies = [ - "accesskit", - "accesskit_consumer", - "async-channel", - "async-once-cell", - "atspi", - "futures-lite 1.13.0", - "once_cell", - "serde", - "zbus 3.15.1", -] - -[[package]] -name = "accesskit_windows" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" -dependencies = [ - "accesskit", - "accesskit_consumer", - "once_cell", - "paste", - "static_assertions", - "windows 0.48.0", -] - -[[package]] -name = "accesskit_winit" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5284218aca17d9e150164428a0ebc7b955f70e3a9a78b4c20894513aabf98a67" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "winit", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -215,12 +150,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - [[package]] name = "arrayvec" version = "0.7.4" @@ -248,7 +177,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd884d7c72877a94102c3715f3b1cd09ff4fac28221add3e57cfbe25c236d093" dependencies = [ - "async-fs 2.1.2", + "async-fs", "async-net", "enumflags2", "futures-channel", @@ -257,17 +186,7 @@ dependencies = [ "serde", "serde_repr", "url", - "zbus 4.2.0", -] - -[[package]] -name = "async-broadcast" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" -dependencies = [ - "event-listener 2.5.3", - "futures-core", + "zbus", ] [[package]] @@ -304,51 +223,19 @@ dependencies = [ "async-task", "concurrent-queue", "fastrand 2.1.0", - "futures-lite 2.3.0", + "futures-lite", "slab", ] -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock 2.8.0", - "autocfg", - "blocking", - "futures-lite 1.13.0", -] - [[package]] name = "async-fs" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" dependencies = [ - "async-lock 3.3.0", + "async-lock", "blocking", - "futures-lite 2.3.0", -] - -[[package]] -name = "async-io" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" -dependencies = [ - "async-lock 2.8.0", - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-lite 1.13.0", - "log", - "parking", - "polling 2.8.0", - "rustix 0.37.27", - "slab", - "socket2 0.4.10", - "waker-fn", + "futures-lite", ] [[package]] @@ -357,28 +244,19 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ - "async-lock 3.3.0", + "async-lock", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.3.0", + "futures-lite", "parking", - "polling 3.7.0", - "rustix 0.38.34", + "polling", + "rustix", "slab", "tracing", "windows-sys 0.52.0", ] -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener 2.5.3", -] - [[package]] name = "async-lock" version = "3.3.0" @@ -396,32 +274,9 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" dependencies = [ - "async-io 2.3.2", - "blocking", - "futures-lite 2.3.0", -] - -[[package]] -name = "async-once-cell" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" - -[[package]] -name = "async-process" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" -dependencies = [ - "async-io 1.13.0", - "async-lock 2.8.0", - "async-signal", + "async-io", "blocking", - "cfg-if", - "event-listener 3.1.0", - "futures-lite 1.13.0", - "rustix 0.38.34", - "windows-sys 0.48.0", + "futures-lite", ] [[package]] @@ -431,15 +286,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a53fc6301894e04a92cb2584fedde80cb25ba8e02d9dc39d4a87d036e22f397d" dependencies = [ "async-channel", - "async-io 2.3.2", - "async-lock 3.3.0", + "async-io", + "async-lock", "async-signal", "async-task", "blocking", "cfg-if", "event-listener 5.3.0", - "futures-lite 2.3.0", - "rustix 0.38.34", + "futures-lite", + "rustix", "tracing", "windows-sys 0.52.0", ] @@ -461,13 +316,13 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afe66191c335039c7bb78f99dc7520b0cbb166b3a1cb33a03f53d8a1c6f2afda" dependencies = [ - "async-io 2.3.2", - "async-lock 3.3.0", + "async-io", + "async-lock", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.34", + "rustix", "signal-hook-registry", "slab", "windows-sys 0.52.0", @@ -496,54 +351,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atspi" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6059f350ab6f593ea00727b334265c4dfc7fd442ee32d264794bd9bdc68e87ca" -dependencies = [ - "atspi-common", - "atspi-connection", - "atspi-proxies", -] - -[[package]] -name = "atspi-common" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92af95f966d2431f962bc632c2e68eda7777330158bf640c4af4249349b2cdf5" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus 3.15.1", - "zbus_names 2.6.1", - "zvariant 3.15.1", -] - -[[package]] -name = "atspi-connection" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c65e7d70f86d4c0e3b2d585d9bf3f979f0b19d635a336725a88d279f76b939" -dependencies = [ - "atspi-common", - "atspi-proxies", - "futures-lite 1.13.0", - "zbus 3.15.1", -] - -[[package]] -name = "atspi-proxies" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6495661273703e7a229356dcbe8c8f38223d697aacfaf0e13590a9ac9977bb52" -dependencies = [ - "atspi-common", - "serde", - "zbus 3.15.1", -] - [[package]] name = "autocfg" version = "1.2.0" @@ -622,32 +429,13 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-sys" -version = "0.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" -dependencies = [ - "objc-sys 0.2.0-beta.2", -] - [[package]] name = "block-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" dependencies = [ - "objc-sys 0.3.3", -] - -[[package]] -name = "block2" -version = "0.2.0-alpha.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" -dependencies = [ - "block-sys 0.1.0-beta.1", - "objc2-encode 2.0.0-pre.2", + "objc-sys", ] [[package]] @@ -656,7 +444,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys 0.2.1", + "block-sys", "objc2 0.4.1", ] @@ -676,10 +464,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88" dependencies = [ "async-channel", - "async-lock 3.3.0", + "async-lock", "async-task", "futures-io", - "futures-lite 2.3.0", + "futures-lite", "piper", ] @@ -739,8 +527,8 @@ checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ "bitflags 2.5.0", "log", - "polling 3.7.0", - "rustix 0.38.34", + "polling", + "rustix", "slab", "thiserror", ] @@ -752,7 +540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop", - "rustix 0.38.34", + "rustix", "wayland-backend", "wayland-client", ] @@ -1174,23 +962,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e06f9bce634a3c898eb1e5cb949ff63133cbb218af93cc9b38b31d6f3ea285" [[package]] -name = "deranged" -version = "0.3.11" +name = "d3d12" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" dependencies = [ - "powerfmt", + "bitflags 2.5.0", + "libloading 0.7.4", + "winapi", ] [[package]] -name = "derivative" -version = "2.2.0" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "powerfmt", ] [[package]] @@ -1385,7 +1173,6 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e3da0cbe020f341450c599b35b92de4af7b00abde85624fd16f09c885573609" dependencies = [ - "accesskit_winit", "arboard", "egui", "log", @@ -1420,7 +1207,7 @@ dependencies = [ "egui", "glow", "log", - "memoffset 0.9.1", + "memoffset", "wasm-bindgen", "web-sys", "winit", @@ -1576,23 +1363,6 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-listener" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "event-listener" version = "4.0.3" @@ -1843,21 +1613,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-lite" version = "2.3.0" @@ -2104,7 +1859,7 @@ dependencies = [ "presser", "thiserror", "winapi", - "windows 0.52.0", + "windows", ] [[package]] @@ -2290,7 +2045,7 @@ dependencies = [ "http-body", "hyper", "pin-project-lite", - "socket2 0.5.7", + "socket2", "tokio", "tower", "tower-service", @@ -2398,17 +2153,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -2566,12 +2310,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -2642,15 +2380,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.1" @@ -2801,18 +2530,6 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", -] - [[package]] name = "nix" version = "0.28.0" @@ -2823,7 +2540,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "libc", - "memoffset 0.9.1", + "memoffset", ] [[package]] @@ -2972,36 +2689,19 @@ dependencies = [ "objc_id", ] -[[package]] -name = "objc-sys" -version = "0.2.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" - [[package]] name = "objc-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da284c198fb9b7b0603f8635185e85fbd5b64ee154b1ed406d489077de2d6d60" -[[package]] -name = "objc2" -version = "0.3.0-beta.3.patch-leaks.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" -dependencies = [ - "block2 0.2.0-alpha.6", - "objc-sys 0.2.0-beta.2", - "objc2-encode 2.0.0-pre.2", -] - [[package]] name = "objc2" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" dependencies = [ - "objc-sys 0.3.3", + "objc-sys", "objc2-encode 3.0.0", ] @@ -3011,7 +2711,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4b25e1034d0e636cd84707ccdaa9f81243d399196b8a773946dcffec0401659" dependencies = [ - "objc-sys 0.3.3", + "objc-sys", "objc2-encode 4.0.1", ] @@ -3038,15 +2738,6 @@ dependencies = [ "objc2-foundation", ] -[[package]] -name = "objc2-encode" -version = "2.0.0-pre.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" -dependencies = [ - "objc-sys 0.2.0-beta.2", -] - [[package]] name = "objc2-encode" version = "3.0.0" @@ -3173,6 +2864,7 @@ dependencies = [ "tracing-subscriber", "tracing-wasm", "vergen", + "wgpu", "winapi", "winres", ] @@ -3413,22 +3105,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "polling" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - [[package]] name = "polling" version = "3.7.0" @@ -3439,7 +3115,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 0.38.34", + "rustix", "tracing", "windows-sys 0.52.0", ] @@ -3593,6 +3269,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "range-alloc" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" + [[package]] name = "ratatui" version = "0.26.2" @@ -3850,20 +3532,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.37.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" -dependencies = [ - "bitflags 1.3.2", - "errno 0.3.8", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - [[package]] name = "rustix" version = "0.38.34" @@ -3873,7 +3541,7 @@ dependencies = [ "bitflags 2.5.0", "errno 0.3.8", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys", "windows-sys 0.52.0", ] @@ -3960,19 +3628,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sctk-adwaita" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550" -dependencies = [ - "ab_glyph", - "log", - "memmap2", - "smithay-client-toolkit", - "tiny-skia", -] - [[package]] name = "security-framework" version = "2.10.0" @@ -4207,7 +3862,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 0.38.34", + "rustix", "thiserror", "wayland-backend", "wayland-client", @@ -4239,16 +3894,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.7" @@ -4296,12 +3941,6 @@ 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 = "strum" version = "0.26.2" @@ -4375,7 +4014,7 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand 2.1.0", - "rustix 0.38.34", + "rustix", "windows-sys 0.52.0", ] @@ -4451,31 +4090,6 @@ dependencies = [ "time-core", ] -[[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 = "tinyvec" version = "1.6.0" @@ -4503,7 +4117,7 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.7", + "socket2", "windows-sys 0.48.0", ] @@ -4699,7 +4313,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.1", + "memoffset", "tempfile", "winapi", ] @@ -4820,12 +4434,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "waker-fn" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" - [[package]] name = "walkdir" version = "2.5.0" @@ -4925,7 +4533,7 @@ checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.34", + "rustix", "scoped-tls", "smallvec", "wayland-sys", @@ -4938,7 +4546,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" dependencies = [ "bitflags 2.5.0", - "rustix 0.38.34", + "rustix", "wayland-backend", "wayland-scanner", ] @@ -4960,7 +4568,7 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba" dependencies = [ - "rustix 0.38.34", + "rustix", "wayland-client", "xcursor", ] @@ -5132,10 +4740,12 @@ dependencies = [ "android_system_properties", "arrayvec", "ash", + "bit-set", "bitflags 2.5.0", "block", "cfg_aliases", "core-graphics-types", + "d3d12", "glow", "glutin_wgl_sys", "gpu-alloc", @@ -5154,6 +4764,7 @@ dependencies = [ "once_cell", "parking_lot", "profiling", + "range-alloc", "raw-window-handle 0.6.1", "renderdoc-sys", "rustc-hash", @@ -5213,17 +4824,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-targets 0.48.5", -] - [[package]] name = "windows" version = "0.52.0" @@ -5243,28 +4843,6 @@ dependencies = [ "windows-targets 0.52.5", ] -[[package]] -name = "windows-implement" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "windows-interface" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -5515,8 +5093,7 @@ dependencies = [ "raw-window-handle 0.5.2", "raw-window-handle 0.6.1", "redox_syscall 0.3.5", - "rustix 0.38.34", - "sctk-adwaita", + "rustix", "smithay-client-toolkit", "smol_str", "unicode-segmentation", @@ -5593,7 +5170,7 @@ dependencies = [ "libc", "libloading 0.8.3", "once_cell", - "rustix 0.38.34", + "rustix", "x11rb-protocol", ] @@ -5656,59 +5233,18 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "zbus" -version = "3.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5acecd3f8422f198b1a2f954bcc812fe89f3fa4281646f3da1da7925db80085d" -dependencies = [ - "async-broadcast 0.5.1", - "async-executor", - "async-fs 1.6.0", - "async-io 1.13.0", - "async-lock 2.8.0", - "async-process 1.8.1", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "byteorder", - "derivative", - "enumflags2", - "event-listener 2.5.3", - "futures-core", - "futures-sink", - "futures-util", - "hex", - "nix 0.26.4", - "once_cell", - "ordered-stream", - "rand", - "serde", - "serde_repr", - "sha1", - "static_assertions", - "tracing", - "uds_windows", - "winapi", - "xdg-home", - "zbus_macros 3.15.1", - "zbus_names 2.6.1", - "zvariant 3.15.1", -] - [[package]] name = "zbus" version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aea58d1af0aaa8abf87f3d9ade9b8f46bf13727e5f9fb24bc31ee9d94a9b4ad" dependencies = [ - "async-broadcast 0.7.0", + "async-broadcast", "async-executor", - "async-fs 2.1.2", - "async-io 2.3.2", - "async-lock 3.3.0", - "async-process 2.2.2", + "async-fs", + "async-io", + "async-lock", + "async-process", "async-recursion", "async-task", "async-trait", @@ -5719,7 +5255,7 @@ dependencies = [ "futures-sink", "futures-util", "hex", - "nix 0.28.0", + "nix", "ordered-stream", "rand", "serde", @@ -5730,23 +5266,9 @@ dependencies = [ "uds_windows", "windows-sys 0.52.0", "xdg-home", - "zbus_macros 4.2.0", - "zbus_names 3.0.0", - "zvariant 4.0.3", -] - -[[package]] -name = "zbus_macros" -version = "3.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2207eb71efebda17221a579ca78b45c4c5f116f074eb745c3a172e688ccf89f5" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "regex", - "syn 1.0.109", - "zvariant_utils", + "zbus_macros", + "zbus_names", + "zvariant", ] [[package]] @@ -5762,17 +5284,6 @@ dependencies = [ "zvariant_utils", ] -[[package]] -name = "zbus_names" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d" -dependencies = [ - "serde", - "static_assertions", - "zvariant 3.15.1", -] - [[package]] name = "zbus_names" version = "3.0.0" @@ -5781,7 +5292,7 @@ checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" dependencies = [ "serde", "static_assertions", - "zvariant 4.0.3", + "zvariant", ] [[package]] @@ -5810,20 +5321,6 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -[[package]] -name = "zvariant" -version = "3.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b4fcf3660d30fc33ae5cd97e2017b23a96e85afd7a1dd014534cd0bf34ba67" -dependencies = [ - "byteorder", - "enumflags2", - "libc", - "serde", - "static_assertions", - "zvariant_derive 3.15.1", -] - [[package]] name = "zvariant" version = "4.0.3" @@ -5835,20 +5332,7 @@ dependencies = [ "serde", "static_assertions", "url", - "zvariant_derive 4.0.3", -] - -[[package]] -name = "zvariant_derive" -version = "3.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0277758a8a0afc0e573e80ed5bfd9d9c2b48bd3108ffe09384f9f738c83f4a55" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", - "zvariant_utils", + "zvariant_derive", ] [[package]] diff --git a/objdiff-gui/Cargo.toml b/objdiff-gui/Cargo.toml index 01916e8..0680aec 100644 --- a/objdiff-gui/Cargo.toml +++ b/objdiff-gui/Cargo.toml @@ -19,7 +19,8 @@ path = "src/main.rs" [features] default = ["wgpu", "wsl"] -wgpu = ["eframe/wgpu"] +glow = ["eframe/glow"] +wgpu = ["eframe/wgpu", "dep:wgpu"] wsl = [] [dependencies] @@ -29,7 +30,6 @@ cfg-if = "1.0.0" const_format = "0.2.32" cwdemangle = "1.0.0" dirs = "5.0.1" -eframe = { version = "0.27.2", features = ["persistence"] } egui = "0.27.2" egui_extras = "0.27.2" filetime = "0.2.23" @@ -50,6 +50,28 @@ strum = { version = "0.26.2", features = ["derive"] } tempfile = "3.10.1" time = { version = "0.3.36", features = ["formatting", "local-offset"] } +# Keep version in sync with egui +[dependencies.eframe] +version = "0.27.2" +features = [ + "default_fonts", + "persistence", + "wayland", + "x11", +] +default-features = false + +# Keep version in sync with eframe +[dependencies.wgpu] +version = "0.19.1" +features = [ + "dx12", + "metal", + "webgpu", +] +optional = true +default-features = false + # For Linux static binaries, use rustls [target.'cfg(target_os = "linux")'.dependencies] reqwest = { version = "0.12.4", default-features = false, features = ["blocking", "json", "multipart", "rustls-tls"] } diff --git a/objdiff-gui/src/app.rs b/objdiff-gui/src/app.rs index 5f6a6f9..6cb6e50 100644 --- a/objdiff-gui/src/app.rs +++ b/objdiff-gui/src/app.rs @@ -37,6 +37,7 @@ use crate::{ demangle::{demangle_window, DemangleViewState}, frame_history::FrameHistory, function_diff::function_diff_ui, + graphics::{graphics_window, GraphicsConfig, GraphicsViewState}, jobs::jobs_ui, symbol_diff::{symbol_diff_ui, DiffViewState, View}, }, @@ -48,12 +49,14 @@ pub struct ViewState { pub config_state: ConfigViewState, pub demangle_state: DemangleViewState, pub diff_state: DiffViewState, + pub graphics_state: GraphicsViewState, pub frame_history: FrameHistory, pub show_appearance_config: bool, pub show_demangle: bool, pub show_project_config: bool, pub show_arch_config: bool, pub show_debug: bool, + pub show_graphics: bool, } /// The configuration for a single object file. @@ -209,6 +212,7 @@ pub struct App { config: AppConfigRef, modified: Arc, watcher: Option, + app_path: Option, relaunch_path: Rc>>, should_relaunch: bool, } @@ -222,6 +226,9 @@ impl App { cc: &eframe::CreationContext<'_>, utc_offset: UtcOffset, relaunch_path: Rc>>, + app_path: Option, + graphics_config: GraphicsConfig, + graphics_config_path: Option, ) -> Self { // Load previous app state (if any). // Note that you must enable the `persistence` feature for this to work. @@ -244,7 +251,32 @@ impl App { } app.appearance.init_fonts(&cc.egui_ctx); app.appearance.utc_offset = utc_offset; + app.app_path = app_path; app.relaunch_path = relaunch_path; + #[cfg(feature = "wgpu")] + if let Some(wgpu_render_state) = &cc.wgpu_render_state { + use eframe::egui_wgpu::wgpu::Backend; + let info = wgpu_render_state.adapter.get_info(); + app.view_state.graphics_state.active_backend = match info.backend { + Backend::Empty => "Unknown", + Backend::Vulkan => "Vulkan", + Backend::Metal => "Metal", + Backend::Dx12 => "DirectX 12", + Backend::Gl => "OpenGL", + Backend::BrowserWebGpu => "WebGPU", + } + .to_string(); + app.view_state.graphics_state.active_device.clone_from(&info.name); + } + #[cfg(feature = "glow")] + if let Some(gl) = &cc.gl { + use eframe::glow::HasContext; + app.view_state.graphics_state.active_backend = "OpenGL".to_string(); + app.view_state.graphics_state.active_device = + unsafe { gl.get_parameter_string(0x1F01) }; // GL_RENDERER + } + app.view_state.graphics_state.graphics_config = graphics_config; + app.view_state.graphics_state.graphics_config_path = graphics_config_path; app } @@ -267,8 +299,8 @@ impl App { JobResult::Update(state) => { if let Ok(mut guard) = self.relaunch_path.lock() { *guard = Some(state.exe_path); + self.should_relaunch = true; } - self.should_relaunch = true; } _ => results.push(result), } @@ -308,7 +340,7 @@ impl App { fn post_update(&mut self, ctx: &egui::Context) { self.appearance.post_update(ctx); - let ViewState { jobs, diff_state, config_state, .. } = &mut self.view_state; + let ViewState { jobs, diff_state, config_state, graphics_state, .. } = &mut self.view_state; config_state.post_update(ctx, jobs, &self.config); diff_state.post_update(ctx, jobs, &self.config); @@ -390,6 +422,15 @@ impl App { jobs.push(start_build(ctx, diff_config)); config.queue_reload = false; } + + if graphics_state.should_relaunch { + if let Some(app_path) = &self.app_path { + if let Ok(mut guard) = self.relaunch_path.lock() { + *guard = Some(app_path.clone()); + self.should_relaunch = true; + } + } + } } } @@ -410,12 +451,14 @@ impl eframe::App for App { config_state, demangle_state, diff_state, + graphics_state, frame_history, show_appearance_config, show_demangle, show_project_config, show_arch_config, show_debug, + show_graphics, } = view_state; frame_history.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage); @@ -457,6 +500,10 @@ impl eframe::App for App { *show_appearance_config = !*show_appearance_config; ui.close_menu(); } + if ui.button("Graphics…").clicked() { + *show_graphics = !*show_graphics; + ui.close_menu(); + } if ui.button("Quit").clicked() { ctx.send_viewport_cmd(egui::ViewportCommand::Close); } @@ -543,6 +590,7 @@ impl eframe::App for App { demangle_window(ctx, show_demangle, demangle_state, appearance); arch_config_window(ctx, config, show_arch_config, appearance); debug_window(ctx, show_debug, frame_history, appearance); + graphics_window(ctx, show_graphics, frame_history, graphics_state, appearance); self.post_update(ctx); } diff --git a/objdiff-gui/src/main.rs b/objdiff-gui/src/main.rs index 5424a22..d470d32 100644 --- a/objdiff-gui/src/main.rs +++ b/objdiff-gui/src/main.rs @@ -19,6 +19,8 @@ use anyhow::{ensure, Result}; use cfg_if::cfg_if; use time::UtcOffset; +use crate::views::graphics::{load_graphics_config, GraphicsBackend, GraphicsConfig}; + fn load_icon() -> Result { use bytes::Buf; let decoder = png::Decoder::new(include_bytes!("../assets/icon_64.png").reader()); @@ -31,6 +33,8 @@ fn load_icon() -> Result { Ok(egui::IconData { rgba: buf, width: info.width, height: info.height }) } +const APP_NAME: &str = "objdiff"; + // When compiling natively: #[cfg(not(target_arch = "wasm32"))] fn main() { @@ -42,6 +46,7 @@ fn main() { // https://github.com/time-rs/time/issues/293 let utc_offset = UtcOffset::current_local_offset().unwrap_or(UtcOffset::UTC); + let app_path = std::env::current_exe().ok(); let exec_path: Rc>> = Rc::new(Mutex::new(None)); let exec_path_clone = exec_path.clone(); let mut native_options = @@ -54,14 +59,47 @@ fn main() { log::warn!("Failed to load application icon: {}", e); } } + let mut graphics_config = GraphicsConfig::default(); + let mut graphics_config_path = None; + if let Some(storage_dir) = eframe::storage_dir(APP_NAME) { + let config_path = storage_dir.join("graphics.ron"); + match load_graphics_config(&config_path) { + Ok(Some(config)) => { + graphics_config = config; + } + Ok(None) => {} + Err(e) => { + log::error!("Failed to load native config: {:?}", e); + } + } + graphics_config_path = Some(config_path); + } #[cfg(feature = "wgpu")] { - native_options.renderer = eframe::Renderer::Wgpu; + use eframe::egui_wgpu::wgpu::Backends; + if graphics_config.desired_backend.is_supported() { + native_options.wgpu_options.supported_backends = match graphics_config.desired_backend { + GraphicsBackend::Auto => native_options.wgpu_options.supported_backends, + GraphicsBackend::Dx12 => Backends::DX12, + GraphicsBackend::Metal => Backends::METAL, + GraphicsBackend::Vulkan => Backends::VULKAN, + GraphicsBackend::OpenGL => Backends::GL, + }; + } } eframe::run_native( - "objdiff", + APP_NAME, native_options, - Box::new(move |cc| Box::new(app::App::new(cc, utc_offset, exec_path_clone))), + Box::new(move |cc| { + Box::new(app::App::new( + cc, + utc_offset, + exec_path_clone, + app_path, + graphics_config, + graphics_config_path, + )) + }), ) .expect("Failed to run eframe application"); @@ -77,9 +115,7 @@ fn main() { } else { let result = std::process::Command::new(path) .args(std::env::args()) - .spawn() - .unwrap() - .wait(); + .spawn(); if let Err(e) = result { log::error!("Failed to relaunch: {:?}", e); } diff --git a/objdiff-gui/src/views/debug.rs b/objdiff-gui/src/views/debug.rs index 43df4f0..5ba7b28 100644 --- a/objdiff-gui/src/views/debug.rs +++ b/objdiff-gui/src/views/debug.rs @@ -12,6 +12,9 @@ pub fn debug_window( } fn debug_ui(ui: &mut egui::Ui, frame_history: &mut FrameHistory, _appearance: &Appearance) { + if ui.button("Clear memory").clicked() { + ui.memory_mut(|m| *m = Default::default()); + } ui.label(format!("Repainting the UI each frame. FPS: {:.1}", frame_history.fps())); frame_history.ui(ui); } diff --git a/objdiff-gui/src/views/graphics.rs b/objdiff-gui/src/views/graphics.rs new file mode 100644 index 0000000..68eee02 --- /dev/null +++ b/objdiff-gui/src/views/graphics.rs @@ -0,0 +1,158 @@ +use std::{ + fs::File, + path::{Path, PathBuf}, +}; + +use anyhow::Result; +use egui::{text::LayoutJob, Context, FontId, RichText, TextFormat, TextStyle, Window}; +use serde::{Deserialize, Serialize}; +use strum::{EnumIter, EnumMessage, IntoEnumIterator}; + +use crate::views::{appearance::Appearance, frame_history::FrameHistory}; + +#[derive(Default)] +pub struct GraphicsViewState { + pub active_backend: String, + pub active_device: String, + pub graphics_config: GraphicsConfig, + pub graphics_config_path: Option, + pub should_relaunch: bool, +} + +#[derive( + Copy, Clone, Debug, Default, PartialEq, Eq, EnumIter, EnumMessage, Serialize, Deserialize, +)] +pub enum GraphicsBackend { + #[default] + #[strum(message = "Auto")] + Auto, + #[strum(message = "Vulkan")] + Vulkan, + #[strum(message = "Metal")] + Metal, + #[strum(message = "DirectX 12")] + Dx12, + #[strum(message = "OpenGL")] + OpenGL, +} + +#[derive(Debug, Default, serde::Deserialize, serde::Serialize)] +pub struct GraphicsConfig { + #[serde(default)] + pub desired_backend: GraphicsBackend, +} + +pub fn load_graphics_config(path: &Path) -> Result> { + if !path.exists() { + return Ok(None); + } + let file = File::open(path)?; + let config: GraphicsConfig = ron::de::from_reader(file)?; + Ok(Some(config)) +} + +pub fn save_graphics_config(path: &Path, config: &GraphicsConfig) -> Result<()> { + let file = File::create(path)?; + ron::ser::to_writer(file, config)?; + Ok(()) +} + +impl GraphicsBackend { + pub fn is_supported(&self) -> bool { + match self { + GraphicsBackend::Auto => true, + GraphicsBackend::Vulkan => { + cfg!(all(feature = "wgpu", any(target_os = "windows", target_os = "linux"))) + } + GraphicsBackend::Metal => cfg!(all(feature = "wgpu", target_os = "macos")), + GraphicsBackend::Dx12 => cfg!(all(feature = "wgpu", target_os = "windows")), + GraphicsBackend::OpenGL => true, + } + } +} + +pub fn graphics_window( + ctx: &Context, + show: &mut bool, + frame_history: &mut FrameHistory, + state: &mut GraphicsViewState, + appearance: &Appearance, +) { + Window::new("Graphics").open(show).show(ctx, |ui| { + ui.label("Graphics backend:"); + ui.label( + RichText::new(&state.active_backend) + .color(appearance.emphasized_text_color) + .text_style(TextStyle::Monospace), + ); + ui.label("Graphics device:"); + ui.label( + RichText::new(&state.active_device) + .color(appearance.emphasized_text_color) + .text_style(TextStyle::Monospace), + ); + ui.label(format!("FPS: {:.1}", frame_history.fps())); + + ui.separator(); + let mut job = LayoutJob::default(); + job.append( + "WARNING: ", + 0.0, + TextFormat::simple(appearance.ui_font.clone(), appearance.delete_color), + ); + job.append( + "Changing the graphics backend may cause the application\nto no longer start or display correctly. Use with caution!", + 0.0, + TextFormat::simple(appearance.ui_font.clone(), appearance.emphasized_text_color), + ); + if let Some(config_path) = &state.graphics_config_path { + job.append( + "\n\nDelete the following file to reset:\n", + 0.0, + TextFormat::simple(appearance.ui_font.clone(), appearance.emphasized_text_color), + ); + job.append( + config_path.to_string_lossy().as_ref(), + 0.0, + TextFormat::simple( + FontId { + family: appearance.code_font.family.clone(), + size: appearance.ui_font.size, + }, + appearance.emphasized_text_color, + ), + ); + } + job.append( + "\n\nChanging the graphics backend will restart the application.", + 0.0, + TextFormat::simple(appearance.ui_font.clone(), appearance.replace_color), + ); + ui.label(job); + + ui.add_enabled_ui(state.graphics_config_path.is_some(), |ui| { + ui.horizontal(|ui| { + ui.label("Desired backend:"); + for backend in GraphicsBackend::iter().filter(GraphicsBackend::is_supported) { + let selected = state.graphics_config.desired_backend == backend; + if ui.selectable_label(selected, backend.get_message().unwrap()).clicked() { + let prev_backend = state.graphics_config.desired_backend; + state.graphics_config.desired_backend = backend; + match save_graphics_config( + state.graphics_config_path.as_ref().unwrap(), + &state.graphics_config, + ) { + Ok(()) => { + state.should_relaunch = true; + } + Err(e) => { + log::error!("Failed to save graphics config: {:?}", e); + state.graphics_config.desired_backend = prev_backend; + } + } + } + } + }); + }); + }); +} diff --git a/objdiff-gui/src/views/mod.rs b/objdiff-gui/src/views/mod.rs index 08f5c1c..799b41b 100644 --- a/objdiff-gui/src/views/mod.rs +++ b/objdiff-gui/src/views/mod.rs @@ -8,6 +8,7 @@ pub(crate) mod demangle; pub(crate) mod file; pub(crate) mod frame_history; pub(crate) mod function_diff; +pub(crate) mod graphics; pub(crate) mod jobs; pub(crate) mod symbol_diff;