From 80644680abc8c5cbf4a1c7446bb52f3a179957e3 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 18 Feb 2019 11:40:42 +0000 Subject: [PATCH] Handle drivers that support 4x MSAA but not 2x --- renderdoc/driver/vulkan/vk_debug.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/renderdoc/driver/vulkan/vk_debug.cpp b/renderdoc/driver/vulkan/vk_debug.cpp index 467d26a45..6227d4083 100644 --- a/renderdoc/driver/vulkan/vk_debug.cpp +++ b/renderdoc/driver/vulkan/vk_debug.cpp @@ -519,6 +519,20 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver) imInfo.samples = VK_SAMPLE_COUNT_2_BIT; + // MoltenVK seems to only support 4/8 samples and not 2... + if(imgprops.sampleCounts & VK_SAMPLE_COUNT_2_BIT) + imInfo.samples = VK_SAMPLE_COUNT_2_BIT; + else if(imgprops.sampleCounts & VK_SAMPLE_COUNT_4_BIT) + imInfo.samples = VK_SAMPLE_COUNT_4_BIT; + else if(imgprops.sampleCounts & VK_SAMPLE_COUNT_8_BIT) + imInfo.samples = VK_SAMPLE_COUNT_8_BIT; + else if(imgprops.sampleCounts & VK_SAMPLE_COUNT_16_BIT) + imInfo.samples = VK_SAMPLE_COUNT_16_BIT; + else if(imgprops.sampleCounts & VK_SAMPLE_COUNT_32_BIT) + imInfo.samples = VK_SAMPLE_COUNT_32_BIT; + else + RDCWARN("Can't find supported MSAA sample count"); + RDCASSERT(imgprops.sampleCounts & imInfo.samples, imgprops.sampleCounts, imInfo.samples); vkr = driver->vkCreateImage(driver->GetDev(), &imInfo, NULL, &m_DummyStencilImage[1]);