{"record":{"id":"6d69e61201b0d77e","repo":"gfx-rs/wgpu","slug":"found-shadersource-dummy","errorCode":null,"errorMessage":"found `ShaderSource::Dummy`","messagePattern":"found `ShaderSource::Dummy`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":2086,"sourceCode":"                    shader_module,\n                    WebShaderCompilationInfo::Wgsl {\n                        source: code.to_string(),\n                    },\n                ))\n            }\n            #[cfg(feature = \"naga-ir\")]\n            crate::ShaderSource::Naga(ref module) => {\n                validate_transformed_shader_module(module, \"\", &desc).map(|v| {\n                    (\n                        v,\n                        WebShaderCompilationInfo::Transformed {\n                            compilation_info: crate::CompilationInfo { messages: vec![] },\n                        },\n                    )\n                })\n            }\n            crate::ShaderSource::Dummy(_) => {\n                panic!(\"found `ShaderSource::Dummy`\")\n            }\n        };\n\n        #[cfg(naga)]\n        fn validate_transformed_shader_module(\n            module: &naga::Module,\n            source: &str,\n            desc: &crate::ShaderModuleDescriptor<'_>,\n        ) -> Result<webgpu_sys::GpuShaderModuleDescriptor, crate::CompilationInfo> {\n            use naga::{back, valid};\n            let mut validator =\n                valid::Validator::new(valid::ValidationFlags::all(), valid::Capabilities::all());\n            let module_info = validator.validate(module).map_err(|err| {\n                crate::CompilationInfo::from(naga::error::ShaderError {\n                    source: source.to_string(),\n                    label: desc.label.map(|s| s.to_string()),\n                    inner: err,\n                })","sourceCodeStart":2068,"sourceCodeEnd":2104,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L2068-L2104","documentation":"The web backend's shader module creation matches on ShaderSource and panics if it encounters ShaderSource::Dummy. Dummy is an internal placeholder source (used for dummy/passthrough pipelines on native) that carries no real WGSL/SPIR-V, so there is nothing to send to the browser; hitting it means internal-only source reached the create_shader_module path.","triggerScenarios":"Calling device.create_shader_module (or create_shader_module_passthrough) with ShaderSource::Dummy on the web backend; using internal APIs that inject a Dummy source for testing or pipeline layouts on web.","commonSituations":"Misuse of internal/wgpu-core style APIs from application code; passthrough pipeline helpers intended for native only; library code that substitutes Dummy source when real shader text is unavailable.","solutions":["Always pass a real ShaderSource::Wgsl (or SpirV) to create_shader_module on web.","Do not use create_shader_module_passthrough / Dummy on the web backend; reserve it for native-only paths.","Guard code paths that fall back to Dummy so they are skipped when running under wasm32."],"exampleFix":"// before\nlet module = device.create_shader_module(wgpu::ShaderModuleDescriptor { source: wgpu::ShaderSource::Dummy(Default::default()), .. });\n// after\nlet module = device.create_shader_module(wgpu::ShaderModuleDescriptor { source: wgpu::ShaderSource::Wgsl(include_str!(\"shader.wgsl\").into()), .. });","handlingStrategy":"validation","validationCode":"if let wgpu::ShaderSource::Dummy(_) = descriptor.source {\n    panic!(\"ShaderSource::Dummy is not valid for create_shader_module on web\");\n}","typeGuard":"fn has_real_source(d: &wgpu::ShaderModuleDescriptor) -> bool {\n    !matches!(d.source, wgpu::ShaderSource::Dummy(_))\n}","tryCatchPattern":null,"preventionTips":["Never pass Dummy source on the web backend; use it only in native-only internal paths.","Assert shader sources are Wgsl/SpirV in debug builds before module creation.","Keep passthrough/Dummy helpers behind cfg gates for non-web targets."],"tags":["webgpu","wasm","shader","unsupported-feature"],"backgroundTag":"shader-source-dummy-unsupported","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}