From 560b3083f0fa0320a37c51de82d87fb159a92e6d Mon Sep 17 00:00:00 2001 From: xintaofei Date: Sat, 25 Apr 2026 16:32:47 +0800 Subject: [PATCH] fix(settings): use --disable-gpu-compositing to keep webview renderable --- src-tauri/src/lib.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b78d8f8..7bce49c 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -54,11 +54,15 @@ mod tauri_app { /// libraries like reqwest/rustls that read `HTTP_PROXY` etc. #[cfg(target_os = "windows")] fn apply_webview2_rendering_override() { - // Only `--disable-gpu`. Pairing it with `--disable-software-rasterizer` - // removes the SwiftShader fallback and produces a white-screen webview - // on machines where GPU init fails — leaving no renderer at all. Match - // Electron's `app.disableHardwareAcceleration()` behavior. - const DISABLE_GPU_ARGS: [&str; 1] = ["--disable-gpu"]; + // Use `--disable-gpu-compositing` rather than `--disable-gpu`: + // - `--disable-gpu` forces SwiftShader software rendering, which fails + // to initialize on a non-trivial subset of Windows + GPU driver + // combinations and leaves the webview entirely blank. + // - `--disable-gpu-compositing` only disables the GPU compositor (the + // path that triggers the AMD/Intel black-screen bug) while keeping + // GPU rasterization. This is the same flag Electron's + // `app.disableHardwareAcceleration()` ultimately injects. + const DISABLE_GPU_ARGS: [&str; 1] = ["--disable-gpu-compositing"]; const ENV_KEY: &str = "WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS"; let prefs = crate::preferences::load();