{"record":{"id":"bffaf9c34f1071c6","repo":"bevyengine/bevy","slug":"texture-format-is-not-supported-by-the-pipeline-bffaf9","errorCode":null,"errorMessage":"Texture format is not supported by the pipeline","messagePattern":"Texture format is not supported by the pipeline","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_sprite_render/src/mesh2d/mesh.rs","lineNumber":674,"sourceCode":"        - Self::MSAA_MASK_BITS.count_ones() as u64;\n    const TONEMAP_METHOD_MASK_BITS: u64 = 0b1111;\n    const TONEMAP_METHOD_SHIFT_BITS: u64 =\n        Self::MSAA_SHIFT_BITS - Self::TONEMAP_METHOD_MASK_BITS.count_ones() as u64;\n    pub const INDEX_FORMAT_MASK_BITS: u64 = 0b11;\n    pub const INDEX_FORMAT_SHIFT_BITS: u64 =\n        Self::TONEMAP_METHOD_SHIFT_BITS - Self::TONEMAP_METHOD_MASK_BITS.count_ones() as u64;\n\n    pub fn from_msaa_samples(msaa_samples: u32) -> Self {\n        let msaa_bits = ((msaa_samples.trailing_zeros() as u64) & Self::MSAA_MASK_BITS)\n            << Self::MSAA_SHIFT_BITS;\n        Self::from_bits_retain(msaa_bits)\n    }\n\n    /// Create a pipeline key from the view's color target format.\n    #[inline]\n    pub fn from_target_format(format: TextureFormat) -> Self {\n        let code = texture_format_to_code(format)\n            .expect(\"Texture format is not supported by the pipeline\") as u64;\n        Self::from_bits_retain(\n            (code & Self::COLOR_TARGET_FORMAT_MASK_BITS) << Self::COLOR_TARGET_FORMAT_SHIFT_BITS,\n        )\n    }\n\n    /// Color target format of the main pass for this pipeline key.\n    #[inline]\n    pub fn target_format(&self) -> TextureFormat {\n        let code = ((self.bits() >> Self::COLOR_TARGET_FORMAT_SHIFT_BITS)\n            & Self::COLOR_TARGET_FORMAT_MASK_BITS) as u8;\n        texture_format_from_code(code)\n            .expect(\"Unknown bits in `COLOR_TARGET_FORMAT_MASK_BITS` of the pipeline key\")\n    }\n\n    pub fn msaa_samples(&self) -> u32 {\n        1 << ((self.bits() >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)\n    }\n","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/bevyengine/bevy/blob/227d3a6c661b3bdf3020d3e8290b5a6ffd0226f7/crates/bevy_sprite_render/src/mesh2d/mesh.rs#L656-L692","documentation":"Mesh2dPipelineKey::from_target_format (mesh2d/mesh.rs:669-676) encodes the view's color target format into a 5-bit field using bevy_render::view::texture_format_to_code, and expects Some. That table (bevy_render/src/view/mod.rs:106-133) covers only WebGPU renderable AND blendable formats (~23). A 2D camera whose render target uses any other format — integer formats, Rgb9e5Ufloat, compressed, etc. — panics here.","triggerScenarios":"A Camera with RenderTarget::Texture rendering mesh2d content into an Image whose TextureFormat is outside the table, e.g. Rgba8Uint for an ID pass, Rgba16Uint, Rgb9e5Ufloat, or a compressed format.","commonSituations":"Reusing picking/segmentation/ID-pass textures (uint formats) as 2D camera targets; copying exotic formats from compute examples into camera output targets; custom post-processing chains with unusual intermediate formats.","solutions":["Use a format from the supported blendable set for the camera target: Rgba8UnormSrgb, Bgra8UnormSrgb, Rgba16Float, Rgba32Float, Rg11b10Ufloat, etc.","Render the 2D content to a standard target and convert to the special format in a separate pass","Guard with bevy_render::view::texture_format_to_code(format).is_some() before assigning the target"],"exampleFix":"// before — uint target is not blendable, mesh2d pipeline key panics\nlet image = Image::new_fill(\n    size,\n    bevy_render::render_resource::Extent3d::default(),\n    &[0, 0, 0, 255],\n    bevy_render::render_resource::TextureFormat::Rgba8Uint,\n    RenderAssetUsages::RENDER_WORLD,\n);\ncamera.target = image.clone().into();\n\n// after — use a supported blendable format\nlet image = Image::new_fill(\n    size,\n    bevy_render::render_resource::Extent3d::default(),\n    &[0, 0, 0, 255],\n    bevy_render::render_resource::TextureFormat::Rgba8UnormSrgb,\n    RenderAssetUsages::RENDER_WORLD,\n);","handlingStrategy":"validation","validationCode":"use bevy_render::view::texture_format_to_code;\n\n// run before pointing a 2D camera at a custom target\nfn ensure_mesh2d_supported_target(format: TextureFormat) -> bool {\n    texture_format_to_code(format).is_some()\n}","typeGuard":"fn is_mesh2d_target_format(format: TextureFormat) -> bool {\n    bevy_render::view::texture_format_to_code(format).is_some()\n}","tryCatchPattern":null,"preventionTips":["Stick to standard blendable formats (Rgba8UnormSrgb, Bgra8UnormSrgb, Rgba16Float, Rgba32Float) for camera targets","Reserve integer/compressed formats for storage textures and readback, never direct camera output of the 2D renderer"],"tags":["bevy","render-target","texture-format","mesh2d","pipeline-key","panic"],"backgroundTag":"unsupported-texture-format","analyzedSha":"227d3a6c661b3bdf3020d3e8290b5a6ffd0226f7","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}