{"record":{"id":"b709fe5124706bd5","repo":"gfx-rs/wgpu","slug":"multi-plane-textures-are-not-supported","errorCode":null,"errorMessage":"multi-plane textures are not supported","messagePattern":"multi-plane textures are not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":731,"sourceCode":"        crate::ExternalImageSource::OffscreenCanvas(offscreen_canvas) => {\n            webgpu_sys::GpuCopyExternalImageSourceInfo::new_with_offscreen_canvas(offscreen_canvas)\n        }\n        crate::ExternalImageSource::VideoFrame(video_frame) => {\n            webgpu_sys::GpuCopyExternalImageSourceInfo::new_with_video_frame(video_frame)\n        }\n    };\n    mapped.set_origin_gpu_origin_2d_dict(&map_origin_2d(view.origin));\n    mapped.set_flip_y(view.flip_y);\n    mapped\n}\n\nfn map_texture_aspect(aspect: wgt::TextureAspect) -> webgpu_sys::GpuTextureAspect {\n    match aspect {\n        wgt::TextureAspect::All => webgpu_sys::GpuTextureAspect::All,\n        wgt::TextureAspect::StencilOnly => webgpu_sys::GpuTextureAspect::StencilOnly,\n        wgt::TextureAspect::DepthOnly => webgpu_sys::GpuTextureAspect::DepthOnly,\n        wgt::TextureAspect::Plane0 | wgt::TextureAspect::Plane1 | wgt::TextureAspect::Plane2 => {\n            panic!(\"multi-plane textures are not supported\")\n        }\n    }\n}\n\nfn map_component_swizzle(swizzle: wgt::ComponentSwizzle) -> char {\n    match swizzle {\n        wgt::ComponentSwizzle::Zero => '0',\n        wgt::ComponentSwizzle::One => '1',\n        wgt::ComponentSwizzle::R => 'r',\n        wgt::ComponentSwizzle::G => 'g',\n        wgt::ComponentSwizzle::B => 'b',\n        wgt::ComponentSwizzle::A => 'a',\n    }\n}\nfn map_texture_component_swizzle(\n    swizzle: wgt::TextureComponentSwizzle,\n) -> arrayvec::ArrayString<4> {\n    let mut s = arrayvec::ArrayString::new();","sourceCodeStart":713,"sourceCodeEnd":749,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L713-L749","documentation":"This panic is raised in the WebGPU (browser) backend when a texture aspect of Plane0, Plane1, or Plane2 is requested. Multi-plane (planar) texture formats, used e.g. by YUV video frames, have no equivalent in the browser's WebGPU API surface exposed to this backend, so the mapping from wgpu's TextureAspect to GpuTextureAspect cannot be performed. The library panics instead of returning an error because the request is fundamentally unsupported on this backend.","triggerScenarios":"Creating a texture view with aspect: TextureAspect::Plane0/Plane1/Plane2, or performing a copy whose view maps such an aspect (map_texture_copy_view, map_tagged_texture_copy_view, or create_view) on the web backend.","commonSituations":"Porting native wgpu code that decodes video or uses NV12/I420 planar formats to WASM/browser; sharing code that samples separate depth/stencil/planar aspects across backends; accidentally setting Plane0 as default in shared config code.","solutions":["Use TextureAspect::All, DepthOnly, or StencilOnly instead of a plane aspect on the web backend.","Convert planar (YUV) data to a single-plane RGBA format on the CPU or via a shader before uploading on web.","Gate plane-aspect usage behind a runtime backend check so it only runs on native backends."],"exampleFix":"// before\nlet view = texture.create_view(&wgpu::TextureViewDescriptor { aspect: wgpu::TextureAspect::Plane0, ..Default::default() });\n// after\nlet aspect = if cfg!(target_arch = \"wasm32\") { wgpu::TextureAspect::All } else { wgpu::TextureAspect::Plane0 };\nlet view = texture.create_view(&wgpu::TextureViewDescriptor { aspect, ..Default::default() });","handlingStrategy":"validation","validationCode":"// before creating the view/copy\nassert!(!matches!(aspect, wgpu::TextureAspect::Plane0 | wgpu::TextureAspect::Plane1 | wgpu::TextureAspect::Plane2), \"plane aspects unsupported on web backend\");","typeGuard":"fn is_web_safe_aspect(a: wgpu::TextureAspect) -> bool {\n    matches!(a, wgpu::TextureAspect::All | wgpu::TextureAspect::DepthOnly | wgpu::TextureAspect::StencilOnly)\n}","tryCatchPattern":null,"preventionTips":["Only use plane aspects after confirming a native (Vulkan/GL) backend.","Convert YUV/planar input to RGBA before upload on web.","Centralize TextureAspect selection in one helper that is backend-aware."],"tags":["webgpu","wasm","texture","unsupported-feature"],"backgroundTag":"multi-plane-texture-unsupported","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}