From b31069f14a8850056216833ea73d37fbb40df814 Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Sat, 28 Jan 2023 20:03:43 +0800 Subject: [PATCH] Improve vk format msaa capabilities detection (#3429) * Improve vk format msaa capabilities detection * Update CHANGELOG * Follow the suggestions * Update wgpu-hal/src/vulkan/adapter.rs Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ wgpu-hal/src/vulkan/adapter.rs | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23572c4c6..dcf255466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,10 @@ Bottom level categories: - Implement `CommandEncoder::clear_buffer`. By @raphlinus in [#3426](https://github.com/gfx-rs/wgpu/pull/3426) +#### Vulkan + +- Improve format MSAA capabilities detection. By @jinleili in [#3429](https://github.com/gfx-rs/wgpu/pull/3429) + ## wgpu-0.15.0 (2023-01-25) ### Major Changes diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index c86dbb917..c8315390b 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1502,11 +1502,15 @@ impl crate::Adapter for super::Adapter { .framebuffer_stencil_sample_counts .min(limits.sampled_image_stencil_sample_counts) } else { - limits - .framebuffer_color_sample_counts - .min(limits.sampled_image_color_sample_counts) - .min(limits.sampled_image_integer_sample_counts) - .min(limits.storage_image_sample_counts) + match format.describe().sample_type { + wgt::TextureSampleType::Float { filterable: _ } => limits + .framebuffer_color_sample_counts + .min(limits.sampled_image_color_sample_counts), + wgt::TextureSampleType::Sint | wgt::TextureSampleType::Uint => { + limits.sampled_image_integer_sample_counts + } + _ => unreachable!(), + } }; flags.set( @@ -1517,7 +1521,6 @@ impl crate::Adapter for super::Adapter { Tfc::MULTISAMPLE_X4, sample_flags.contains(vk::SampleCountFlags::TYPE_4), ); - flags.set( Tfc::MULTISAMPLE_X8, sample_flags.contains(vk::SampleCountFlags::TYPE_8),