{"record":{"id":"ffed877266e64b2a","repo":"bevyengine/bevy","slug":"the-downsample-shader-doesn-t-support-texture-format","errorCode":null,"errorMessage":"The downsample shader doesn't support texture format {:?}","messagePattern":"The downsample shader doesn't support texture format (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_core_pipeline/src/mip_generation/mod.rs","lineNumber":145,"sourceCode":"/// Note that, despite the name, the single-pass downsampling shader has two\n/// passes, not one. This is because WGSL doesn't presently support\n/// globally-coherent buffers; the only way to have a synchronization point is\n/// to issue a second dispatch.\n#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]\npub enum DownsamplePass {\n    /// Produces mip levels 1 to 6.\n    First,\n    /// Produces mip levels 7 to 12.\n    Second,\n}\n\nimpl SpecializedComputePipeline for DownsamplePipeline {\n    type Key = DownsamplePipelineKey;\n\n    fn specialize(&self, key: Self::Key) -> ComputePipelineDescriptor {\n        let mut shader_defs = vec![\n            texture_format_shader_def(key.texture_format).unwrap_or_else(|| {\n                panic!(\n                    \"The downsample shader doesn't support texture format {:?}\",\n                    key.texture_format\n                )\n            }),\n            ShaderDefVal::Bool(\"ARRAY_TEXTURE\".into(), key.array_texture),\n        ];\n        if self.subgroup_support {\n            shader_defs.push(\"SUBGROUP_SUPPORT\".into());\n        }\n        shader_defs.push(\n            match (key.combine_bind_groups, key.pass) {\n                (true, _) => \"COMBINE_BIND_GROUP\",\n                (false, DownsamplePass::First) => \"SPLIT_BIND_GROUP_FIRST\",\n                (false, DownsamplePass::Second) => \"SPLIT_BIND_GROUP_SECOND\",\n            }\n            .into(),\n        );\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/bevyengine/bevy/blob/a62cce8c05ceacd3bd102e678c83e2b42e5dfbe2/crates/bevy_core_pipeline/src/mip_generation/mod.rs#L127-L163","documentation":"specialize() in DownsamplePipeline panics when texture_format_shader_def returns None for the requested texture format, meaning the mip-generation/downsample compute shader has no shader def for that format. It's a hard panic, not a recoverable error, because the pipeline cannot be created for unsupported formats.","triggerScenarios":"Creating/downsizing a texture in a format the downsample shader doesn't support (e.g. non-standard or 64-bit color formats) and then running the mip generation / downsample pipeline with that format as the DownsamplePipelineKey.","commonSituations":"Using a custom render target texture format (e.g. Rgb16Float variants, depth formats) that bevy_core_pipeline's downsample shader lacks mappings for; upgrading Bevy and relying on a format no longer supported.","solutions":["Use a supported texture format (e.g. Rgba8Unorm, Rgba16Float) for textures passed to downsample/mip generation","Add a mapping in texture_format_shader_def and the shader for your format if you control the fork","Fall back to CPU-side mip generation or a custom pipeline for exotic formats"],"exampleFix":"// before\nlet image = Image::new_fill(size, TextureDimension::D2, &[0;2], TextureFormat::Rg16Float, ...);\n\n// after\nlet image = Image::new_fill(size, TextureDimension::D2, &[0;4], TextureFormat::Rgba16Float, ...);","handlingStrategy":"fallback","validationCode":"const SUPPORTED: &[TextureFormat] = &[TextureFormat::Rgba8Unorm, TextureFormat::Rgba16Float];\nfn downsample_supported(f: TextureFormat) -> bool { SUPPORTED.contains(&f) }","typeGuard":"fn downsample_supported(f: TextureFormat) -> bool {\n    matches!(f, TextureFormat::Rgba8Unorm | TextureFormat::Rgba16Float | TextureFormat::Rgba32Float)\n}","tryCatchPattern":"if downsample_supported(format) { spawn downsample pipeline } else { // fallback: CPU mip generation or convert image to supported format }","preventionTips":["Stick to common RGBA color formats for textures needing mip generation","Check texture_format_shader_def mappings when adding new formats"],"tags":["bevy","rendering","shaders","texture-format"],"backgroundTag":"unsupported-enum-value","analyzedSha":"a62cce8c05ceacd3bd102e678c83e2b42e5dfbe2","analyzedAt":"2026-09-19T21:23:06.616Z","contentChangedAt":"2026-09-19T21:23:06.616Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}