diff --git a/voxygen/src/cli.rs b/voxygen/src/cli.rs index 2aefc2abe9..d39a0521bd 100644 --- a/voxygen/src/cli.rs +++ b/voxygen/src/cli.rs @@ -7,7 +7,10 @@ //! //! Airshipper should only use arguments listed above! Since we will not try to //! be careful about their stability otherwise. -use clap::Parser; +//! +//! Likewise Airshipper should only use the following subcommands: +//! * `ListWgpuBackends` +use clap::{Parser, Subcommand}; #[derive(Parser)] pub struct Args { @@ -16,4 +19,14 @@ pub struct Args { /// This allows passing in server selection performed in airshipper. #[clap(short, long)] pub server: Option, + + #[clap(subcommand)] + pub command: Option, +} + +#[derive(Subcommand)] +pub enum Commands { + /// List available wgpu backends. This is called by Airshipper to show a + /// dropbox of available backends. + ListWgpuBackends, } diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index b8a65f6458..f09999c422 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -42,6 +42,28 @@ use tracing::{info, warn}; use veloren_voxygen::ui::egui::EguiState; fn main() { + // Process CLI arguments + use clap::Parser; + let args = cli::Args::parse(); + + if let Some(command) = args.command { + match command { + cli::Commands::ListWgpuBackends => { + #[cfg(target_os = "windows")] + let backends = &["dx11", "dx12", "vulkan"]; + #[cfg(target_os = "linux")] + let backends = &["vulkan"]; + #[cfg(target_os = "macos")] + let backends = &["metal"]; + + for backend in backends { + println!("{backend}"); + } + return; + }, + } + } + #[cfg(feature = "tracy")] common_base::tracy_client::Client::start(); @@ -93,10 +115,6 @@ fn main() { panic_handler::set_panic_hook(log_filename, logs_dir); - // Process CLI arguments - use clap::Parser; - let args = cli::Args::parse(); - // Setup tokio runtime use common::consts::MIN_RECOMMENDED_TOKIO_THREADS; use std::sync::{