Add native2d feature: wgpu 2D viewport window inside Tauri process
Spawns a GTK-free winit window with its own wgpu surface from Tauri's setup hook on a background thread, sidestepping the WebKitGTK surface contention on Wayland. Reuses render2d's renderer via a shared demo module. Opt-in behind the native2d cargo feature; default build unaffected.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
// Tauri-v2-Einstieg. Die eigentliche Geometrie liegt im serde-only Crate
|
||||
// `geometry`; hier nur die Befehls-Bruecke und der App-Start.
|
||||
|
||||
// M2-Spike: nativer wgpu-2D-Viewport im Tauri-Prozess (nur mit Feature `native2d`).
|
||||
#[cfg(feature = "native2d")]
|
||||
mod native2d;
|
||||
|
||||
/// Berechnet die Wand-Gehrungen im Rust-Kern und liefert sie ans Frontend.
|
||||
#[tauri::command]
|
||||
async fn compute_joins(
|
||||
@@ -12,6 +16,13 @@ async fn compute_joins(
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.setup(|_app| {
|
||||
// Nur mit Feature `native2d`: das native GPU-Fenster auf einem eigenen
|
||||
// Thread hochfahren, damit der Tauri-/GTK-Hauptthread frei bleibt.
|
||||
#[cfg(feature = "native2d")]
|
||||
native2d::spawn();
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![compute_joins])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user