Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions examples/runners/wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
// #![allow()]

use clap::Parser;
use clap::ValueEnum;
use std::borrow::Cow;
use strum::{Display, EnumString};

Expand All @@ -81,14 +82,24 @@ mod compute;

mod graphics;

#[derive(EnumString, Display, PartialEq, Eq, Copy, Clone)]
#[derive(Debug, EnumString, Display, PartialEq, Eq, Copy, Clone, ValueEnum)]
pub enum RustGPUShader {
Simplest,
Sky,
Compute,
Mouse,
}

impl RustGPUShader {
pub fn help_string() -> String {
let variants: Vec<String> = Self::value_variants()
.iter()
.map(|v| v.to_possible_value().unwrap().get_name().to_owned())
.collect();
format!("Shader to run [{}]", variants.join(", "))
}
}

struct CompiledShaderModules {
named_spv_modules: Vec<(Option<String>, wgpu::ShaderModuleDescriptorSpirV<'static>)>,
}
Expand Down Expand Up @@ -224,7 +235,7 @@ fn maybe_watch(
#[derive(Parser, Clone)]
#[command()]
pub struct Options {
#[arg(short, long, default_value = "Sky")]
#[arg(short, long, default_value = "Sky", help = RustGPUShader::help_string())]
shader: RustGPUShader,

#[arg(long)]
Expand Down