From 388f10e1517f7e79598f03a9484640cf805ce7b4 Mon Sep 17 00:00:00 2001 From: xiaopengli89 Date: Tue, 5 Dec 2023 21:16:22 +0800 Subject: [PATCH] check multi-planar format --- wgpu-hal/src/vulkan/device.rs | 2 +- wgpu-types/src/lib.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index d9aba50281..28ff5b1265 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -980,7 +980,7 @@ impl crate::Device for super::Device { wgt_view_formats = desc.view_formats.clone(); wgt_view_formats.push(desc.format); - if self.shared.private_caps.image_format_list { + if self.shared.private_caps.image_format_list && !desc.format.is_multi_planar_format() { vk_view_formats = desc .view_formats .iter() diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index bdef49a60c..07fa3276be 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -2890,6 +2890,11 @@ impl TextureFormat { } } + /// Returns `true` if the format is a multi-planar format + pub fn is_multi_planar_format(&self) -> bool { + matches!(*self, Self::NV12) + } + /// Returns `true` if the format has a color aspect pub fn has_color_aspect(&self) -> bool { !self.is_depth_stencil_format()