{"record":{"id":"831aa099e69b7398","repo":"bevyengine/bevy","slug":"enable-feature-shader-format-spirv-to-use-spir-v","errorCode":null,"errorMessage":"Enable feature \"shader_format_spirv\" to use SPIR-V shaders","messagePattern":"Enable feature \"shader_format_spirv\" to use SPIR-V shaders","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_render/src/render_resource/pipeline_cache.rs","lineNumber":136,"sourceCode":"                    .map(BindGroupLayout::value)\n                    .map(Some)\n                    .collect::<SmallVec<[_; BIND_GROUP_LAYOUTS_INLINE_CAPACITY]>>();\n                Arc::new(WgpuPipelineLayout::new(\n                    render_device.create_pipeline_layout(&PipelineLayoutDescriptor {\n                        bind_group_layouts: &bind_group_layouts,\n                        immediate_size: *immediate_size,\n                        ..default()\n                    }),\n                ))\n            })\n            .clone()\n    }\n}\n\nfn load_module(\n    render_device: &RenderDevice,\n    shader_source: ShaderCacheSource,\n    validate_shader: &ValidateShader,\n) -> Result<WgpuShaderModule, ShaderCacheError> {\n    let shader_source = match shader_source {\n        #[cfg(feature = \"shader_format_spirv\")]\n        ShaderCacheSource::SpirV(data) => wgpu::util::make_spirv(data),\n        #[cfg(not(feature = \"shader_format_spirv\"))]\n        ShaderCacheSource::SpirV(_) => {\n            unimplemented!(\"Enable feature \\\"shader_format_spirv\\\" to use SPIR-V shaders\")\n        }\n        ShaderCacheSource::Wgsl(src) => ShaderSource::Wgsl(Cow::Owned(src)),\n    };\n    let module_descriptor = ShaderModuleDescriptor {\n        label: None,\n        source: shader_source,\n    };\n\n    let scope = render_device\n        .wgpu_device()\n        .push_error_scope(wgpu::ErrorFilter::Validation);","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_render/src/render_resource/pipeline_cache.rs#L118-L154","documentation":"load_module, the shader-module construction step of PipelineCache, hits unimplemented!() when a queued pipeline's shader source is ShaderCacheSource::SpirV(data) but the cargo feature 'shader_format_spirv' is not enabled on bevy_render. Bevy makes naga's SPIR-V frontend optional, so SPIR-V ingestion simply does not exist without the feature.","triggerScenarios":"Creating a shader from SPIR-V bytes (e.g. Shader::from_spirv or a custom asset loader producing ShaderCacheSource::SpirV) and then queueing a render/compute pipeline with it, while the default (non-spirv) feature set is in use.","commonSituations":"Porting an old project that used .spv shaders; using a third-party crate that hands SPIR-V to Bevy; trimming Bevy's default features for compile time and forgetting SPIR-V is now opt-in.","solutions":["Enable the feature: bevy = { features = [\"shader_format_spirv\"] } (or add the feature to your bevy_render dependency)","Prefer WGSL: convert the shader with naga-cli (naga --input shader.spv --output shader.wgsl) and use the WGSL source instead","If the SPIR-V is generated at build time, switch the generator to emit WGSL"],"exampleFix":"# before\nbevy = { version = \"...\" }  # SPIR-V shaders panic at pipeline creation\n\n# after\nbevy = { version = \"...\", features = [\"shader_format_spirv\"] }","handlingStrategy":"validation","validationCode":"// Cargo.toml check before using SPIR-V shaders:\n// [dependencies] bevy = { features = [\"shader_format_spirv\"] }\n// At runtime, guard the shader source:\nenum SafeShaderSource<'a> { Wgsl(&'a str), SpirvDisabled }\nfn classify(bytes: &'a [u8]) -> SafeShaderSource<'a> {\n    if cfg!(feature = \"shader_format_spirv\") { /* ... */ }\n    SafeShaderSource::Wgsl(\"/* fallback */\")\n}","typeGuard":"fn accepts_spirv() -> bool {\n    cfg!(feature = \"shader_format_spirv\")\n}","tryCatchPattern":null,"preventionTips":["Add the shader_format_spirv feature to Cargo.toml the moment you introduce .spv assets","Prefer WGSL for new shaders so no optional feature is required","Document required cargo features next to SPIR-V asset paths in your project README"],"tags":["bevy","spirv","shader","cargo-features","panic"],"backgroundTag":"missing-feature-flag","analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}