From 64228251e7523e9cdc98d0c13db948b679722ff4 Mon Sep 17 00:00:00 2001 From: krypton Date: Wed, 1 Apr 2026 14:06:32 +0800 Subject: [PATCH 1/3] feat: add GPU acceleration JVM parameters support - Add Prism rendering pipeline parameters when enable_gpu_acceleration is enabled - Windows: -Dprism.order=d3d,es2,sw (Direct3D priority) - Linux/macOS: -Dprism.order=es2,sw (OpenGL ES priority) - Add -Dprism.forcegpu=true to force hardware acceleration --- src-tauri/src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 63287cdb..f15a2c69 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -660,6 +660,21 @@ async fn start_game( args.push(format!("-Djava.library.path={}", natives_path)); } + // Add GPU acceleration parameters if enabled + // JavaFX Prism rendering pipeline settings for hardware acceleration + if config.enable_gpu_acceleration { + // Platform-specific rendering order: + // - Windows: d3d (Direct3D) > es2 (OpenGL ES 2) > sw (software) + // - Linux/macOS: es2 > sw (no Direct3D available) + if cfg!(target_os = "windows") { + args.push("-Dprism.order=d3d,es2,sw".to_string()); + } else { + args.push("-Dprism.order=es2,sw".to_string()); + } + // Force GPU usage instead of software fallback + args.push("-Dprism.forcegpu=true".to_string()); + } + // Ensure classpath is set if not already if !args.iter().any(|a| a == "-cp" || a == "-classpath") { args.push("-cp".to_string()); From 0e2f2ed0b71d58a1e04f95ab19ae1893f99bd884 Mon Sep 17 00:00:00 2001 From: krypton Date: Wed, 1 Apr 2026 14:12:30 +0800 Subject: [PATCH 2/3] feat: default GPU acceleration without conditional check --- src-tauri/src/main.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f15a2c69..5ae1c8db 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -660,20 +660,18 @@ async fn start_game( args.push(format!("-Djava.library.path={}", natives_path)); } - // Add GPU acceleration parameters if enabled + // Add GPU acceleration parameters by default // JavaFX Prism rendering pipeline settings for hardware acceleration - if config.enable_gpu_acceleration { - // Platform-specific rendering order: - // - Windows: d3d (Direct3D) > es2 (OpenGL ES 2) > sw (software) - // - Linux/macOS: es2 > sw (no Direct3D available) - if cfg!(target_os = "windows") { - args.push("-Dprism.order=d3d,es2,sw".to_string()); - } else { - args.push("-Dprism.order=es2,sw".to_string()); - } - // Force GPU usage instead of software fallback - args.push("-Dprism.forcegpu=true".to_string()); + // Platform-specific rendering order: + // - Windows: d3d (Direct3D) > es2 (OpenGL ES 2) > sw (software) + // - Linux/macOS: es2 > sw (no Direct3D available) + if cfg!(target_os = "windows") { + args.push("-Dprism.order=d3d,es2,sw".to_string()); + } else { + args.push("-Dprism.order=es2,sw".to_string()); } + // Force GPU usage instead of software fallback + args.push("-Dprism.forcegpu=true".to_string()); // Ensure classpath is set if not already if !args.iter().any(|a| a == "-cp" || a == "-classpath") { From 551aab67f54093d3c72b81a7d04f8776dbb4159a Mon Sep 17 00:00:00 2001 From: krypton Date: Wed, 1 Apr 2026 14:23:15 +0800 Subject: [PATCH 3/3] refactor: improve GPU params - remove forcegpu, respect user prism.order --- src-tauri/src/main.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 5ae1c8db..7f7c4c02 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -660,18 +660,19 @@ async fn start_game( args.push(format!("-Djava.library.path={}", natives_path)); } - // Add GPU acceleration parameters by default + // Add GPU acceleration parameters if not already set by user // JavaFX Prism rendering pipeline settings for hardware acceleration - // Platform-specific rendering order: - // - Windows: d3d (Direct3D) > es2 (OpenGL ES 2) > sw (software) - // - Linux/macOS: es2 > sw (no Direct3D available) - if cfg!(target_os = "windows") { - args.push("-Dprism.order=d3d,es2,sw".to_string()); - } else { - args.push("-Dprism.order=es2,sw".to_string()); + // Only set prism.order if user hasn't already specified it + if !args.iter().any(|a| a.contains("-Dprism.order=")) { + // Platform-specific rendering order: + // - Windows: d3d (Direct3D) > es2 (OpenGL ES 2) > sw (software) + // - Linux/macOS: es2 > sw (no Direct3D available) + if cfg!(target_os = "windows") { + args.push("-Dprism.order=d3d,es2,sw".to_string()); + } else { + args.push("-Dprism.order=es2,sw".to_string()); + } } - // Force GPU usage instead of software fallback - args.push("-Dprism.forcegpu=true".to_string()); // Ensure classpath is set if not already if !args.iter().any(|a| a == "-cp" || a == "-classpath") {