From c592f0c9af8c2871dd7adcb9d87303dcff6c23b9 Mon Sep 17 00:00:00 2001 From: hinto-janaiyo Date: Mon, 6 Feb 2023 17:59:51 -0500 Subject: [PATCH] only use `wgpu` backend for Windows --- CHANGELOG.md | 2 ++ Cargo.lock | 20 ++++++++++---------- Cargo.toml | 7 +++++-- README.md | 2 +- src/main.rs | 18 +++++++++++++++++- utils/prepare.sh | 1 + 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd1447..1c1d58e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # v1.1.2 ## Fixes * **Windows:** Fixed Gupax crashing on certain CPU-based graphics (integrated + basic drivers) +* **Windows:** Fixed P2Pool Advanced command inputs being ignored * **P2Pool/XMRig:** Fixed parsing of `localhost` into `127.0.0.1` * **P2Pool/XMRig:** Current (non-saved) text-box values are now used instead of "old" selected values for custom nodes/pools +* **Log:** Only Gupax console logs will be printed (libraries filtered out) ## Bundled Versions * [`P2Pool v3.0`](https://github.com/SChernykh/p2pool/releases/tag/v3.0) diff --git a/Cargo.lock b/Cargo.lock index 149c13e..3445d48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -915,12 +915,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" dependencies = [ - "darling_core 0.14.2", - "darling_macro 0.14.2", + "darling_core 0.14.3", + "darling_macro 0.14.3", ] [[package]] @@ -939,9 +939,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ "fnv", "ident_case", @@ -964,11 +964,11 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" dependencies = [ - "darling_core 0.14.2", + "darling_core 0.14.3", "quote", "syn", ] @@ -990,7 +990,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24c1b715c79be6328caa9a5e1a387a196ea503740f0722ec3dd8f67a9e72314d" dependencies = [ - "darling 0.14.2", + "darling 0.14.3", "proc-macro2", "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index 3316f29..8d30def 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,12 +23,12 @@ arti-hyper = "0.7.0" bytes = "1.2.1" dirs = "4.0.0" #-------------------------------------------------------------------------------- -eframe = { version = "0.19.0", default-features = false, features = ["wgpu"] } egui = "0.19.0" egui_extras = { version = "0.19.0", features = ["image"] } ## Update 2023-Feb-06: The below gets fixed by using the [wgpu] backend instead of [glow] -## It also fixes crashes on CPU-based graphics. +## It also fixes crashes on CPU-based graphics. Only used for Windows. +## Using [wgpu] actually crashes macOS (fixed in 0.20.x though). ## [external/egui/crates/eframe/src/native/run.rs] line 41: [.with_srgb(true)] ## This line causes a [panic!] inside a Windows VM, from a Linux host. @@ -66,14 +66,17 @@ serde-xml-rs = "0.6.0" # Unix dependencies [target.'cfg(unix)'.dependencies] +ef tar = "0.4.38" flate2 = "1.0" sudo = "0.6.0" +eframe = { version = "0.19.0", default-features = false, features = ["glow"] } # Windows dependencies [target.'cfg(windows)'.dependencies] zip = "0.6.3" is_elevated = "0.1.2" +eframe = { version = "0.19.0", default-features = false, features = ["wgpu"] } # For Windows build (icon) [target.'cfg(windows)'.build-dependencies] diff --git a/README.md b/README.md index e2e6a42..ec119aa 100644 --- a/README.md +++ b/README.md @@ -358,7 +358,7 @@ In general: - `WARN` means something has gone wrong, but things will be fine - `INFO` logs are general info about what Gupax (the GUI thread) is currently doing - `DEBUG` logs are much more verbose and include what EVERY thread is doing (not just the main GUI thread) -- `TRACE` logs are insanely verbose and shows very low-level logs of the libraries Gupax uses (HTTP connections, GUI polling, etc) +- `TRACE` logs are insanely verbose and shows very low-level logs --- diff --git a/src/main.rs b/src/main.rs index b81af4e..748cee0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -713,6 +713,16 @@ fn init_text_styles(ctx: &egui::Context, width: f32) { fn init_logger(now: Instant) { use env_logger::fmt::Color; + let filter_env = std::env::var("RUST_LOG").unwrap_or_else(|_| "INFO".to_string()); + let filter = match filter_env.as_str() { + "error"|"Error"|"ERROR" => LevelFilter::Error, + "warn"|"Warn"|"WARN" => LevelFilter::Warn, + "debug"|"Debug"|"DEBUG" => LevelFilter::Debug, + "trace"|"Trace"|"TRACE" => LevelFilter::Trace, + _ => LevelFilter::Info, + }; + std::env::set_var("RUST_LOG", format!("off,gupax={}", filter_env)); + Builder::new().format(move |buf, record| { let mut style = buf.style(); let level = match record.level() { @@ -731,8 +741,9 @@ fn init_logger(now: Instant) { buf.style().set_dimmed(true).value(record.line().unwrap_or(0)), record.args(), ) - }).filter_level(LevelFilter::Info).write_style(WriteStyle::Always).parse_default_env().format_timestamp_millis().init(); + }).filter_level(filter).write_style(WriteStyle::Always).parse_default_env().format_timestamp_millis().init(); info!("init_logger() ... OK"); + info!("Log level ... {}", filter); } fn init_options(initial_window_size: Option) -> NativeOptions { @@ -742,7 +753,12 @@ fn init_options(initial_window_size: Option) -> NativeOptions { options.initial_window_size = initial_window_size; options.follow_system_theme = false; options.default_theme = eframe::Theme::Dark; + + #[cfg(target_os = "windows")] options.renderer = eframe::Renderer::Wgpu; + #[cfg(target_family = "unix")] + options.renderer = eframe::Renderer::Glow; + let icon = image::load_from_memory(BYTES_ICON).expect("Failed to read icon bytes").to_rgba8(); let (icon_width, icon_height) = icon.dimensions(); options.icon_data = Some(eframe::IconData { diff --git a/utils/prepare.sh b/utils/prepare.sh index 49c96a9..31e3208 100755 --- a/utils/prepare.sh +++ b/utils/prepare.sh @@ -36,6 +36,7 @@ cat << EOM > CHANGELOG.md.new * [\`P2Pool ${P2POOL_VERSION//\"/}\`](https://github.com/SChernykh/p2pool/releases/tag/${P2POOL_VERSION//\"/}) * [\`XMRig ${XMRIG_VERSION//\"/}\`](https://github.com/xmrig/xmrig/releases/tag/${XMRIG_VERSION//\"/}) + ---