diff --git a/renderdoc/driver/vulkan/vk_debug.cpp b/renderdoc/driver/vulkan/vk_debug.cpp index 1457d8efc..429e33237 100644 --- a/renderdoc/driver/vulkan/vk_debug.cpp +++ b/renderdoc/driver/vulkan/vk_debug.cpp @@ -731,6 +731,22 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev) "version"); } + // another workaround, on some AMD driver versions creating an MSAA image with STORAGE_BIT + // causes graphical corruption trying to sample from it. We workaround it by preventing the + // MSAA <-> Array pipelines from creating, which removes the STORAGE_BIT and skips the copies. + // It means initial contents of MSAA images are missing but that's less important than being + // able to inspect MSAA images properly. + bool amdStorageMSAABrokenDriver = false; + +// same as above, only affects the AMD official driver +#if ENABLED(RDOC_WIN32) + if(driverVersion.IsAMD()) + { + // not fixed yet + amdStorageMSAABrokenDriver = true; + } +#endif + // needed in both replay and capture, create depth MS->array pipelines { { @@ -1054,7 +1070,8 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev) RDCASSERTEQUAL(vkr, VK_SUCCESS); } - if(!texelFetchBrokenDriver && m_pDriver->GetDeviceFeatures().shaderStorageImageMultisample && + if(!texelFetchBrokenDriver && !amdStorageMSAABrokenDriver && + m_pDriver->GetDeviceFeatures().shaderStorageImageMultisample && m_pDriver->GetDeviceFeatures().shaderStorageImageWriteWithoutFormat) { compPipeInfo.stage.module = ms2arrayModule; @@ -1979,7 +1996,8 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev) RDCASSERTEQUAL(vkr, VK_SUCCESS); } - if(!texelFetchBrokenDriver && m_pDriver->GetDeviceFeatures().shaderStorageImageMultisample && + if(!texelFetchBrokenDriver && !amdStorageMSAABrokenDriver && + m_pDriver->GetDeviceFeatures().shaderStorageImageMultisample && m_pDriver->GetDeviceFeatures().shaderStorageImageWriteWithoutFormat) { compPipeInfo.stage.module = module[MS2ARRAYCS]; diff --git a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp index 6a49dc1a6..849974137 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp @@ -23,6 +23,7 @@ ******************************************************************************/ #include "../vk_core.h" +#include "../vk_debug.h" /************************************************************************ * @@ -1143,9 +1144,18 @@ bool WrappedVulkan::Serialise_vkCreateImage(Serialiser *localSerialiser, VkDevic // colour targets we do a simple compute copy, for depth-stencil we need // to take a slower path that uses drawing if(!IsDepthOrStencilFormat(info.format)) - info.usage |= VK_IMAGE_USAGE_STORAGE_BIT; + { + // only add STORAGE_BIT if we have an MS2Array pipeline. If it failed to create due to lack + // of capability or because we disabled it as a workaround then we don't need this + // capability (and it might be the bug we're trying to work around by disabling the + // pipeline) + if(GetDebugManager()->m_MS2ArrayPipe) + info.usage |= VK_IMAGE_USAGE_STORAGE_BIT; + } else + { info.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + } } VkResult ret = ObjDisp(device)->CreateImage(Unwrap(device), &info, NULL, &img); @@ -1216,9 +1226,14 @@ VkResult WrappedVulkan::vkCreateImage(VkDevice device, const VkImageCreateInfo * if(m_State >= WRITING) { if(!IsDepthOrStencilFormat(createInfo_adjusted.format)) - createInfo_adjusted.usage |= VK_IMAGE_USAGE_STORAGE_BIT; + { + if(GetDebugManager()->m_MS2ArrayPipe) + createInfo_adjusted.usage |= VK_IMAGE_USAGE_STORAGE_BIT; + } else + { createInfo_adjusted.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + } } }