From fa93c596ee3b8350a56071b235f6fb6631945936 Mon Sep 17 00:00:00 2001 From: Fighter19 <1475802+Fighter19@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:58:04 +0200 Subject: [PATCH] Revert determination of seperate stencil usage Fix crash on Vivante GPU (#2192) --- vulkano/src/device/physical.rs | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/vulkano/src/device/physical.rs b/vulkano/src/device/physical.rs index cfee29512c..3ba1f2e0a8 100644 --- a/vulkano/src/device/physical.rs +++ b/vulkano/src/device/physical.rs @@ -1033,25 +1033,8 @@ impl PhysicalDevice { #[inline] pub unsafe fn image_format_properties_unchecked( &self, - mut image_format_info: ImageFormatInfo, + image_format_info: ImageFormatInfo, ) -> Result, VulkanError> { - { - let ImageFormatInfo { - format, - usage, - stencil_usage, - .. - } = &mut image_format_info; - - let aspects = format.unwrap().aspects(); - - if stencil_usage.is_empty() - || !aspects.contains(ImageAspects::DEPTH | ImageAspects::STENCIL) - { - *stencil_usage = *usage; - } - } - self.image_format_properties .get_or_try_insert(image_format_info, |image_format_info| { /* Input */ @@ -1061,13 +1044,22 @@ impl PhysicalDevice { image_type, tiling, usage, - stencil_usage, + mut stencil_usage, external_memory_handle_type, image_view_type, _ne: _, } = image_format_info; - let has_separate_stencil_usage = stencil_usage == usage; + + let aspects = format.unwrap().aspects(); + + let has_separate_stencil_usage = + if stencil_usage.is_empty() || !aspects.contains(ImageAspects::DEPTH | ImageAspects::STENCIL) { + stencil_usage = usage; + false + } else { + stencil_usage == usage + }; let mut info2_vk = ash::vk::PhysicalDeviceImageFormatInfo2 { format: format.unwrap().into(),