bevyengine/bevy · critical

Texture format is not supported by the pipeline

Error message

Texture format is not supported by the pipeline

What it means

SpritePipelineKey::from_target_format (sprite render/mod.rs:141-148) encodes the view's color target format into a 5-bit pipeline-key field via bevy_render::view::texture_format_to_code and expects Some. The code table only covers WebGPU renderable and blendable formats; any other texture format as a sprite camera's render target panics with this message.

Source

Thrown at crates/bevy_sprite_render/src/render/mod.rs:145

    #[inline]
    pub const fn from_msaa_samples(msaa_samples: u32) -> Self {
        let msaa_bits =
            (msaa_samples.trailing_zeros() & Self::MSAA_MASK_BITS) << Self::MSAA_SHIFT_BITS;
        Self::from_bits_retain(msaa_bits)
    }

    #[inline]
    pub const fn msaa_samples(&self) -> u32 {
        1 << ((self.bits() >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
    }

    /// Create a pipeline key from the view's color target format.
    #[inline]
    pub fn from_target_format(format: TextureFormat) -> Self {
        let code = texture_format_to_code(format)
            .expect("Texture format is not supported by the pipeline") as u32;
        Self::from_bits_retain(
            (code & Self::COLOR_TARGET_FORMAT_MASK_BITS) << Self::COLOR_TARGET_FORMAT_SHIFT_BITS,
        )
    }

    /// Color target format of the main pass for this pipeline key.
    #[inline]
    pub fn target_format(&self) -> TextureFormat {
        let code = ((self.bits() >> Self::COLOR_TARGET_FORMAT_SHIFT_BITS)
            & Self::COLOR_TARGET_FORMAT_MASK_BITS) as u8;
        texture_format_from_code(code)
            .expect("Unknown bits in `COLOR_TARGET_FORMAT_MASK_BITS` of the pipeline key")
    }

    /// Key bits for a view's resolved [`CompositingSpace`].
    #[inline]
    pub fn from_compositing_space(space: Option<CompositingSpace>) -> Self {
        match space {
            Some(CompositingSpace::Srgb) => Self::SRGB_COMPOSITING,
            Some(CompositingSpace::Oklab) => Self::OKLAB_COMPOSITING,

View on GitHub (pinned to 221e52ae32)

Solutions

  1. Switch the target Image to a supported blendable format (Rgba8UnormSrgb, Bgra8UnormSrgb, Rgba16Float, Rgba32Float, Rg11b10Ufloat, ...)
  2. Insert a conversion pass: render sprites to a standard-format target, then copy/convert into the special-format texture
  3. Validate the format with texture_format_to_code before configuring the camera

Example fix

// before — sprite camera renders into a uint picking texture
let target = Image::new_fill(size, Extent3d::default(), &[0; 4], TextureFormat::Rgba8Uint, RenderAssetUsages::RENDER_WORLD);
camera.target = target.clone().into();

// after — sprites render to a blendable target; a later pass encodes IDs
let target = Image::new_fill(size, Extent3d::default(), &[0; 4], TextureFormat::Rgba8UnormSrgb, RenderAssetUsages::RENDER_WORLD);
Defensive patterns

Strategy: validation

Validate before calling

use bevy_render::view::texture_format_to_code;

assert!(
    texture_format_to_code(image.texture_descriptor().format).is_some(),
    "format {:?} cannot back a sprite camera target",
    image.texture_descriptor().format
);

Type guard

fn is_sprite_target_format(format: TextureFormat) -> bool {
    bevy_render::view::texture_format_to_code(format).is_some()
}

Prevention

When it happens

Trigger: A 2D camera rendering sprites into an Image target whose format is unsupported: integer formats (Rgba8Uint/Rgba32Uint), Rgb9e5Ufloat, compressed formats, or any non-blendable variant.

Common situations: UI/sprite compositing into custom picking or readback textures; post-process intermediate targets with exotic formats; formats copied from non-rendering examples (storage textures) into camera targets.

Related errors


AI-assisted analysis of bevyengine/bevy@221e52ae32 (2026-08-20). Data as JSON: /api/errors/37a098b5932e05a2. Report an issue: GitHub.