bevyengine/bevy · critical
The downsample shader doesn't support texture format
Error message
The downsample shader doesn't support texture format {:?} What it means
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.
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
Example fix
// before let image = Image::new_fill(size, TextureDimension::D2, &[0;2], TextureFormat::Rg16Float, ...); // after let image = Image::new_fill(size, TextureDimension::D2, &[0;4], TextureFormat::Rgba16Float, ...);
Defensive patterns
Strategy: fallback
Validate before calling
const SUPPORTED: &[TextureFormat] = &[TextureFormat::Rgba8Unorm, TextureFormat::Rgba16Float];
fn downsample_supported(f: TextureFormat) -> bool { SUPPORTED.contains(&f) } Type guard
fn downsample_supported(f: TextureFormat) -> bool {
matches!(f, TextureFormat::Rgba8Unorm | TextureFormat::Rgba16Float | TextureFormat::Rgba32Float)
} Try / catch
if downsample_supported(format) { spawn downsample pipeline } else { // fallback: CPU mip generation or convert image to supported format } Prevention
- Stick to common RGBA color formats for textures needing mip generation
- Check texture_format_shader_def mappings when adding new formats
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Can't create depth attachment. Texture format is not a…
- Failed to calculate aspect ratio for Cluster: screen…
- RenderPipelineDescriptor has no FragmentState configured
- Texture format is not supported by the pipeline
- Texture format is not supported by the pipeline
AI-assisted analysis of bevyengine/bevy@a62cce8c05 (2026-09-19).
Data as JSON: /api/errors/ffed877266e64b2a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/bevy_core_pipeline/src/mip_generation/mod.rs:145
/// Note that, despite the name, the single-pass downsampling shader has two
/// passes, not one. This is because WGSL doesn't presently support
/// globally-coherent buffers; the only way to have a synchronization point is
/// to issue a second dispatch.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum DownsamplePass {
/// Produces mip levels 1 to 6.
First,
/// Produces mip levels 7 to 12.
Second,
}
impl SpecializedComputePipeline for DownsamplePipeline {
type Key = DownsamplePipelineKey;
fn specialize(&self, key: Self::Key) -> ComputePipelineDescriptor {
let mut shader_defs = vec![
texture_format_shader_def(key.texture_format).unwrap_or_else(|| {
panic!(
"The downsample shader doesn't support texture format {:?}",
key.texture_format
)
}),
ShaderDefVal::Bool("ARRAY_TEXTURE".into(), key.array_texture),
];
if self.subgroup_support {
shader_defs.push("SUBGROUP_SUPPORT".into());
}
shader_defs.push(
match (key.combine_bind_groups, key.pass) {
(true, _) => "COMBINE_BIND_GROUP",
(false, DownsamplePass::First) => "SPLIT_BIND_GROUP_FIRST",
(false, DownsamplePass::Second) => "SPLIT_BIND_GROUP_SECOND",
}
.into(),
);
View on GitHub (pinned to a62cce8c05)