Merge branch 'isse/list-backends' into 'master'

Voxygen list backends subcommand

See merge request veloren/veloren!4288
This commit is contained in:
Isse 2024-01-29 17:48:55 +00:00
commit 5e987efe99
2 changed files with 36 additions and 5 deletions

View File

@ -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<String>,
#[clap(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand)]
pub enum Commands {
/// List available wgpu backends. This is called by Airshipper to show a
/// dropbox of available backends.
ListWgpuBackends,
}

View File

@ -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::{