From 04474a885aeee86f137811f9377d4511609c5959 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 23 May 2025 14:32:12 +0100 Subject: [PATCH] Record unique texel buffer formats seen during replay --- renderdoc/driver/vulkan/vk_core.cpp | 9 +++++++++ renderdoc/driver/vulkan/vk_core.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index adc621f16..c7420c18d 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -5457,6 +5457,15 @@ size_t WrappedVulkan::DescriptorDataSize(VkDescriptorType type) void WrappedVulkan::RegisterDescriptor(const bytebuf &key, const DescriptorSetSlot &data) { m_DescriptorLookup.fallback.insert(key, data); + + // store unique texel buffer formats used, expecting this to be small and it will help descriptor lookups + if(data.type == DescriptorSlotType::UniformTexelBuffer || + data.type == DescriptorSlotType::StorageTexelBuffer) + { + VkFormat fmt = VkFormat(data.imageLayoutOrFormat); + if(data.resource != ResourceId() && !m_DescriptorLookup.texelFormats.contains(fmt)) + m_DescriptorLookup.texelFormats.push_back(fmt); + } } bool WrappedVulkan::IsPartialRenderPassActive() diff --git a/renderdoc/driver/vulkan/vk_core.h b/renderdoc/driver/vulkan/vk_core.h index b6d1ca894..5be82437c 100644 --- a/renderdoc/driver/vulkan/vk_core.h +++ b/renderdoc/driver/vulkan/vk_core.h @@ -472,6 +472,11 @@ private: // overall lookup of all descriptors by bytes, fallback in case any others don't work - we // expect this to always hit rdcbytetrie fallback; + + // unique texel formats. So that if we fast identify a buffer via address+size we can iterate + // over all of these if we know it's a texel buffer. The expectation is this is short so we + // don't have to store this per-buffer but globally and can just try different possibilities. + rdcarray texelFormats; }; DescriptorLookups m_DescriptorLookup;