{"record":{"id":"60db41fe3803440c","repo":"bevyengine/bevy","slug":"texture-format-is-not-supported-by-the-pipeline","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_pbr/src/render/mesh.rs","lineNumber":3169,"sourceCode":"    const SCREEN_SPACE_SPECULAR_TRANSMISSION_SHIFT_BITS: u64 =\n        Self::VIEW_PROJECTION_MASK_BITS.count_ones() as u64 + Self::VIEW_PROJECTION_SHIFT_BITS;\n\n    const COLOR_TARGET_FORMAT_MASK_BITS: u64 = view::COLOR_TARGET_FORMAT_MASK_BITS as u64;\n    const COLOR_TARGET_FORMAT_SHIFT_BITS: u64 = Self::SCREEN_SPACE_SPECULAR_TRANSMISSION_MASK_BITS\n        .count_ones() as u64\n        + Self::SCREEN_SPACE_SPECULAR_TRANSMISSION_SHIFT_BITS;\n\n    pub fn from_msaa_samples(msaa_samples: u32) -> Self {\n        let msaa_bits =\n            (msaa_samples.trailing_zeros() as u64 & Self::MSAA_MASK_BITS) << 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":3151,"sourceCodeEnd":3187,"githubUrl":"https://github.com/bevyengine/bevy/blob/227d3a6c661b3bdf3020d3e8290b5a6ffd0226f7/crates/bevy_pbr/src/render/mesh.rs#L3151-L3187","documentation":"`MeshPipelineKey::from_target_format` (crates/bevy_pbr/src/render/mesh.rs:3168) encodes the view's color target format into a 5-bit field of the pipeline key using `texture_format_to_code` (crates/bevy_render/src/view/mod.rs:106). That function only maps WebGPU 'plain' renderable+blendable formats (R8/Rg8/Rgba8 unorm/snorm/srgb, Bgra8 variants, R16/Rg16/Rgba16 float+unorm+snorm, R32Float/Rg32Float/Rgba32Float, Rgb10a2Unorm, Rg11b10Ufloat). Any other format returns `None` and the `.expect` panics.","triggerScenarios":"Rendering a 3D camera whose color target uses a format outside that list: `TextureFormat::Rgba32Uint`, `Rgba8Uint`, `Rgb10a2Uint`, `Rg16Uint`, `Rgb9e5Ufloat`, 64-bit formats, or block-compressed formats — e.g. `Camera { target: RenderTarget::Texture(handle) }` pointing at an ID/picking buffer. Also triggered by manually calling `MeshPipelineKey::from_target_format` with such a format.","commonSituations":"Offscreen targets for mouse picking or object-ID passes written directly as the Camera output; data textures reused as render targets; post-processing setups that chose an integer or 64-bit format for precision without checking the mesh pipeline's supported set.","solutions":["Switch the camera's render target to a supported format: Rgba16Float for HDR, Bgra8UnormSrgb (default swapchain) for LDR","Keep special-format buffers out of the main camera target: render the scene to a supported intermediate texture, then copy/resolve into the special-format texture in a custom pass","Before assigning a target format, assert `bevy_render::view::texture_format_to_code(format).is_some()`"],"exampleFix":"// before: integer format as the main camera target -> panic in from_target_format\nimage.texture_descriptor.format = TextureFormat::Rgba32Uint; // picking buffer\n\n// after: scene renders to a supported format; blit to the picking buffer separately\nimage.texture_descriptor.format = TextureFormat::Rgba16Float;\n// ... then copy into the Rgba32Uint texture from a dedicated render node","handlingStrategy":"validation","validationCode":"use bevy_render::view::texture_format_to_code;\n\nfn assert_camera_format_supported(format: TextureFormat) {\n    assert!(\n        texture_format_to_code(format).is_some(),\n        \"format {format:?} is not encodable in MeshPipelineKey; \\\n         use a plain renderable+blendable format (e.g. Rgba16Float)\"\n    );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never point Camera::target at integer/data textures; render to a supported intermediate and copy in a custom pass","Restrict user-configurable target formats to a whitelist checked against texture_format_to_code","Add a startup system that validates every camera's target format once and panics with a clear message"],"tags":["bevy","render","texture-format","camera-target","pipeline","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"}