From 0e9322e6105305f57998e808ab5901ca0f468d11 Mon Sep 17 00:00:00 2001 From: Cam Mannett Date: Tue, 5 Nov 2024 13:04:43 +0000 Subject: [PATCH] Skip incompatible image formats when building discard pattern If the pattern's dimensions are not an integer multiple of the format's block size, then do not attempt to create the discard pattern, just exit early. Fixes 3466 --- renderdoc/driver/vulkan/vk_debug.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/vulkan/vk_debug.cpp b/renderdoc/driver/vulkan/vk_debug.cpp index 7cd5b425c..88cab12fb 100644 --- a/renderdoc/driver/vulkan/vk_debug.cpp +++ b/renderdoc/driver/vulkan/vk_debug.cpp @@ -2381,9 +2381,16 @@ void VulkanDebugManager::FillWithDiscardPattern(VkCommandBuffer cmd, DiscardType if(buf == VK_NULL_HANDLE) { GPUBuffer &stage = m_DiscardStage[key]; - bytebuf pattern = GetDiscardPattern(key.second, MakeResourceFormat(key.first)); BlockShape shape = GetBlockShape(key.first, 0); + if((PatternBatchWidth % shape.width) != 0 || (PatternBatchHeight % shape.height) != 0) + { + RDCWARN("Skipping discard pattern for %s as block size is incompatible (%d * %d)", + ToStr(MakeResourceFormat(key.first).type).c_str(), shape.width, shape.height); + return; + } + + bytebuf pattern = GetDiscardPattern(key.second, MakeResourceFormat(key.first)); if(key.first == VK_FORMAT_D32_SFLOAT_S8_UINT) shape = {1, 1, 4};