Debug opt-out of serialising all buffer descriptors

This commit is contained in:
baldurk
2025-07-30 22:10:26 +01:00
parent d1abd44314
commit e0d9a8888b
2 changed files with 34 additions and 6 deletions
+2
View File
@@ -521,6 +521,8 @@ private:
// unique image layouts. In case image layout affects the descriptor bits
rdcarray<VkImageLayout> generalImageLayouts;
rdcarray<VkImageLayout> depthImageLayouts;
Threading::CriticalSection lock;
};
DescriptorLookups m_DescriptorLookup;
@@ -29,6 +29,10 @@
RDOC_DEBUG_CONFIG(bool, Vulkan_Debug_AllowDescriptorSetReuse, true,
"Allow the re-use of descriptor sets via vkResetDescriptorPool.");
RDOC_CONFIG(
uint32_t, Vulkan_Debug_DangerousDescriptorSerialisation, 0,
"DANGEROUS, MAY CAUSE CAPTURE FAILURES: Disable serialising plain untyped buffer descriptors.");
template <>
VkDescriptorSetLayoutCreateInfo WrappedVulkan::UnwrapInfo(const VkDescriptorSetLayoutCreateInfo *info)
{
@@ -2145,12 +2149,6 @@ void WrappedVulkan::vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInf
// logic can be done in common
if(pDescriptorInfo->data.pUniformBuffer)
{
ResourceId id;
uint64_t offs = 0;
GetResIDFromAddr(pDescriptorInfo->data.pUniformBuffer->address, id, offs);
dstRecord = GetResourceManager()->GetResourceRecord(id);
VkFormat fmt = VK_FORMAT_UNDEFINED;
if(pDescriptorInfo->type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER ||
pDescriptorInfo->type == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
@@ -2158,6 +2156,34 @@ void WrappedVulkan::vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInf
fmt = pDescriptorInfo->data.pUniformTexelBuffer->format;
}
if(Vulkan_Debug_DangerousDescriptorSerialisation() == 122333)
{
if(pDescriptorInfo->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER ||
pDescriptorInfo->type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
{
dstRecord = NULL;
break;
}
// serialise any one random descriptor per unique format so the tracking on replay still works
if(pDescriptorInfo->type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER ||
pDescriptorInfo->type == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
{
SCOPED_LOCK(m_DescriptorLookup.lock);
if(m_DescriptorLookup.texelFormats.contains(fmt))
{
dstRecord = NULL;
break;
}
m_DescriptorLookup.texelFormats.push_back(fmt);
}
}
ResourceId id;
uint64_t offs = 0;
GetResIDFromAddr(pDescriptorInfo->data.pUniformBuffer->address, id, offs);
dstRecord = GetResourceManager()->GetResourceRecord(id);
DescriptorUniquenessKey descKey(offs, pDescriptorInfo->data.pUniformBuffer->range, fmt);
// this is internally locked