{"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":"critical","filePath":"crates/bevy_render/src/render_resource/pipeline_cache.rs","lineNumber":135,"sourceCode":"                        ..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<WgpuWrapper<ShaderModule>, 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);\n\n    let shader_module = WgpuWrapper::new(match validate_shader {\n        ValidateShader::Enabled => {\n            render_device.create_and_validate_shader_module(module_descriptor)\n        }\n        // SAFETY: we are interfacing with shader code, which may contain undefined behavior,\n        // such as indexing out of bounds.","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/bevyengine/bevy/blob/78002f65fa984ededb80915b4a5613f195bc864d/crates/bevy_render/src/render_resource/pipeline_cache.rs#L117-L153","documentation":"bevy_render's PipelineCache can only turn SPIR-V bytes into a wgpu ShaderModule when the `shader_format_spirv` cargo feature is enabled. When a Shader's source is `ShaderCacheSource::SpirV` and the feature is off, `load_module` calls `unimplemented!()` and panics with this message. wgpu gates `wgpu::util::make_spirv` behind the feature, so Bevy forwards the gate to the user.","triggerScenarios":"Loading a shader built from SPIR-V bytes (e.g. `Shader::from_spirv(...)`, a `.spv` asset, or a third-party crate that constructs SpirV shader sources) in a project where bevy_render was compiled without the `shader_format_spirv` feature. The panic occurs on first pipeline compilation for that shader.","commonSituations":"Using default Bevy features (SPIR-V is NOT in bevy's default feature set) while depending on a crate that ships SPIR-V shaders; trimming features with `default-features = false` and forgetting this one; migrating SPIR-V shaders from an older engine/workflow into a WGsl-first Bevy project.","solutions":["Enable the feature in Cargo.toml: `bevy = { version = \"...\", features = [\"shader_format_spirv\"] }`","If you control the shader, port it to WGSL (`Shader::from_wgsl`) and drop the SPIR-V dependency entirely","If a dependency pulls in SPIR-V shaders, check that crate's docs for a feature that enables `shader_format_spirv` transitively","Run `cargo tree -e features -i bevy_render | grep spirv` to confirm whether the feature is actually active in your build"],"exampleFix":"# before\n[dependencies]\nbevy = \"0.17\" # SPIR-V sources panic: unimplemented!()\n\n# after\n[dependencies]\nbevy = { version = \"0.17\", features = [\"shader_format_spirv\"] }\n\n# or, prefer WGSL in code:\n// let shader = Shader::from_spirv(spirv_bytes); // before\nlet shader = Shader::from_wgsl(WGSL_SOURCE);    // after","handlingStrategy":"validation","validationCode":"# Cargo.toml — proxy feature so your code can gate on it\n[features]\nspirv_shaders = [\"bevy/shader_format_spirv\"]\n\n// code that loads SPIR-V:\n#[cfg(not(feature = \"spirv_shaders\"))]\ncompile_error!(\"SPIR-V shaders require enabling the `spirv_shaders` feature (bevy/shader_format_spirv)\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer WGSL for all new shaders; SPIR-V support is a legacy/on-ramp path in Bevy","If any dependency ships SPIR-V, enable bevy's `shader_format_spirv` feature once in the root Cargo.toml","Verify with `cargo tree -e features -i bevy_render | grep spirv` before shipping"],"tags":["bevy","wgpu","spirv","feature-flags","shaders","panic","pipeline-cache"],"backgroundTag":null,"analyzedSha":"78002f65fa984ededb80915b4a5613f195bc864d","analyzedAt":"2026-08-16T09:07:20.800Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}