Voxygen list backends subcommand

This commit is contained in:
Isse 2024-01-28 18:44:18 +01:00
parent d11c58b75b
commit b523423404
2 changed files with 32 additions and 5 deletions

View File

@ -7,7 +7,7 @@
//!
//! Airshipper should only use arguments listed above! Since we will not try to
//! be careful about their stability otherwise.
use clap::Parser;
use clap::{Parser, Subcommand};
#[derive(Parser)]
pub struct Args {
@ -16,4 +16,13 @@ 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.
ListBackends,
}

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::ListBackends => {
#[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::{