Skip to content

[BUG] Broken examples? #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alphastrata opened this issue May 21, 2025 · 1 comment · Fixed by #254
Closed

[BUG] Broken examples? #253

alphastrata opened this issue May 21, 2025 · 1 comment · Fixed by #254
Labels
bug Something isn't working

Comments

@alphastrata
Copy link
Contributor

Expected Behaviour

Expect the examples to work per the instrcutions in the docs + the clap help i.e

Usage: example-runner-wgpu.exe [OPTIONS]

Options:
  -s, --shader <SHADER>       [default: Sky]
      --force-spirv-passthru
  -h, --help                  Print help

Example & Steps To Reproduce

Here's a table summarizing which examples work and which don't:

Command/Example Works?
cargo run --bin example-runner-wgpu Yes
cargo run --bin example-runner-wgpu -- -s Sky Yes
cargo run --bin example-runner-wgpu -- -s simplest-shader No
cargo run --bin example-runner-wgpu -- -s mouse-shader No
cargo run --bin example-runner-wgpu -- -s compute-shader No
cd ./examples/shaders/compute-shader && cargo run Yes

If you throw a dbg! print on the crate_name defined here:

// ./examples/runners/wgpu/src/lib.rs:140

        let crate_name = match options.shader {
            RustGPUShader::Simplest => "simplest-shader",
            RustGPUShader::Sky => "sky-shader",
            RustGPUShader::Compute => "compute-shader",
            RustGPUShader::Mouse => "mouse-shader",
        };

The EnumString is working fine as in, clap is parsing it correctly.
I do not have time right now to investigate why -- perhaps the compilation logic in each of the individual shader crates' is wrong?

System Info

  • Rust: rustc 1.84.0-nightly (b19329a37 2024-11-21) (Why do you ask for this if there's a version specified in the rust-toolchain.toml ?
  • OS: Windows 11 (using rust-lld.exe see Fix windows builds #252)
  • GPU: NVIDIA RTX TITAN (20-series)
  • SPIR-V: SPIRV-Tools v2023.3 v2022.4-198-ge7c6084f
  • SysInfo Generic: (fastfetch, like neofetch for windows)
/////////////////  /////////////////    jer@winbox
/////////////////  /////////////////    ----------
/////////////////  /////////////////    OS: Windows 11 Pro x86_64
/////////////////  /////////////////    Host: X570 AORUS ELITE WIFI (-CF)
/////////////////  /////////////////    Kernel: WIN32_NT 10.0.22631.5189 (23H2)
/////////////////  /////////////////    Uptime: 3 hours, 29 mins
/////////////////  /////////////////    Packages: 5 (scoop), 32 (choco)
/////////////////  /////////////////    Shell: PowerShell 7.5.1
                                        Display (DELA17F): 3840x1600 @ 144 Hz in 38" [External] *
/////////////////  /////////////////    Display (BenQ PD2700U): 2560x1440 @ 60 Hz in 27" [External]
/////////////////  /////////////////    DE: Fluent
/////////////////  /////////////////    WM: Desktop Window Manager 10.0.22621.5124
/////////////////  /////////////////    WM Theme: Custom - #1B3D5A (System: Dark, Apps: Dark)
/////////////////  /////////////////    Icons: Recycle Bin
/////////////////  /////////////////    Font: Segoe UI (12pt) [Caption / Menu / Message / Status]
/////////////////  /////////////////    Cursor: Windows Default (32px)
/////////////////  /////////////////    Terminal: Visual Studio Code 1.100.2
                                        CPU: AMD Ryzen 9 5950X (32) @ 5.05 GHz
                                        GPU 1: NVIDIA Parsec Virtual Display Adapter (23.69 GiB) [Discrete]
                                        GPU 2: NVIDIA TITAN RTX (23.69 GiB) [Discrete]
                                        Memory: 16.17 GiB / 31.94 GiB (51%)

Backtrace

Backtrace

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
     Running `D:\rust-gpu\target\debug\example-runner-wgpu.exe --shader compute-shader`
error: invalid value 'compute-shader' for '--shader <SHADER>': Matching variant not found

Substitute the computer-shader string for any value of:

  compute-shader
  mouse-shader
  reduce
  shared
  simplest-shader
  sky-shader

for the same errors.

@alphastrata alphastrata added the bug Something isn't working label May 21, 2025
@alphastrata
Copy link
Contributor Author

alphastrata commented May 21, 2025

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

turns out you need to use exactly the variants
i.e -> cargo run --bin example-runner-wgpu -- -s Compute not cargo run --bin example-runner-wgpu -- -s compute-shader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant