Skip to content

Commit cf7be18

Browse files
Add descriptor type descriptor uniqueness key.
Avoids problem when storage image and sampled image are extracted from the same view object.
1 parent 6f0cbfa commit cf7be18

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

renderdoc/driver/vulkan/vk_resources.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,23 +1028,24 @@ DECLARE_REFLECTION_STRUCT(AspectSparseTable);
10281028

10291029
struct DescriptorUniquenessKey
10301030
{
1031-
DescriptorUniquenessKey(VkImageLayout layout)
1032-
: layout(layout), offset(0), size(0), fmt(VK_FORMAT_UNDEFINED)
1031+
DescriptorUniquenessKey(VkImageLayout layout, VkDescriptorType type)
1032+
: layout(layout), offset(0), size(0), fmt(VK_FORMAT_UNDEFINED), type(type)
10331033
{
10341034
}
1035-
DescriptorUniquenessKey(uint64_t offset, uint64_t size, VkFormat fmt)
1036-
: layout(VK_IMAGE_LAYOUT_UNDEFINED), offset(offset), size(size), fmt(fmt)
1035+
DescriptorUniquenessKey(uint64_t offset, uint64_t size, VkFormat fmt, VkDescriptorType type)
1036+
: layout(VK_IMAGE_LAYOUT_UNDEFINED), offset(offset), size(size), fmt(fmt), type(type)
10371037
{
10381038
}
10391039

10401040
bool operator==(const DescriptorUniquenessKey &key) const
10411041
{
1042-
return layout == key.layout && offset == key.offset && size == key.size && fmt == key.fmt;
1042+
return layout == key.layout && offset == key.offset && size == key.size && fmt == key.fmt && type == key.type;
10431043
}
10441044

10451045
VkImageLayout layout;
10461046
uint64_t offset, size;
10471047
VkFormat fmt;
1048+
VkDescriptorType type;
10481049
};
10491050

10501051
namespace std
@@ -1058,6 +1059,7 @@ struct hash<DescriptorUniquenessKey>
10581059
hash ^= std::hash<uint64_t>()(key.offset) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
10591060
hash ^= std::hash<uint64_t>()(key.size) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
10601061
hash ^= std::hash<uint32_t>()(key.fmt) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
1062+
hash ^= std::hash<uint32_t>()(key.type) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
10611063
return hash;
10621064
}
10631065
};

renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,7 +3454,8 @@ void WrappedVulkan::vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInf
34543454
DescriptorUniquenessKey descKey(
34553455
m_IgnoreLayoutForDescriptors
34563456
? VK_IMAGE_LAYOUT_UNDEFINED
3457-
: pDescriptorInfo->data.pCombinedImageSampler->imageLayout);
3457+
: pDescriptorInfo->data.pCombinedImageSampler->imageLayout,
3458+
pDescriptorInfo->type);
34583459

34593460
// this is internally locked
34603461
if(!dstRecord->resInfo->AddDescriptor(descKey))
@@ -3523,7 +3524,8 @@ void WrappedVulkan::vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInf
35233524

35243525
dstRecord = GetResourceManager()->GetResourceRecord(id);
35253526

3526-
DescriptorUniquenessKey descKey(offs, pDescriptorInfo->data.pUniformBuffer->range, fmt);
3527+
DescriptorUniquenessKey descKey(offs, pDescriptorInfo->data.pUniformBuffer->range, fmt,
3528+
pDescriptorInfo->type);
35273529

35283530
// this is internally locked
35293531
if(!dstRecord->resInfo->AddDescriptor(descKey))

0 commit comments

Comments
 (0)