gfx-rs/wgpu · error

found `ShaderSource::Dummy`

Error message

found `ShaderSource::Dummy`

What it means

Panic while converting a ShaderSource to a wgpu-core module: the enum held the Dummy variant, which exists only as a placeholder for doc/tests builds and carries no actual shader code, so the match's catch-all arm aborts.

Source

Thrown at wgpu/src/backend/wgpu_core.rs:828

            ShaderSource::Glsl {
                ref shader,
                stage,
                defines,
            } => {
                let options = naga::front::glsl::Options {
                    stage,
                    defines: defines
                        .iter()
                        .map(|&(key, value)| (String::from(key), String::from(value)))
                        .collect(),
                };
                wgc::pipeline::ShaderModuleSource::Glsl(Borrowed(shader), options)
            }
            #[cfg(feature = "wgsl")]
            ShaderSource::Wgsl(ref code) => wgc::pipeline::ShaderModuleSource::Wgsl(Borrowed(code)),
            #[cfg(feature = "naga-ir")]
            ShaderSource::Naga(module) => wgc::pipeline::ShaderModuleSource::Naga(module),
            ShaderSource::Dummy(_) => panic!("found `ShaderSource::Dummy`"),
        };
        let (wgpu_shader_module, error) =
            self.wgpu_device.create_shader_module(&descriptor, source);
        let compilation_info = match error {
            Some(cause) => {
                self.wgpu_device.handle_error(
                    cause.clone(),
                    desc.label,
                    "Device::create_shader_module",
                );
                CompilationInfo::from(cause)
            }
            None => CompilationInfo { messages: vec![] },
        };

        CoreShaderModule {
            wgpu_shader_module,
            compilation_info,

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Pass a real ShaderSource (Wgsl, SpirV, Glsl, Naga, or VulkanNaga) instead of ShaderSource::Dummy
  2. Avoid code paths that construct the Dummy variant outside cfg(test) builds
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at wgpu/src/backend/wgpu_core.rs:828 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/e0950287cb20279b. Report an issue: GitHub.