Skip to content

Commit 10cca57

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 10cca57

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

renderdoc/driver/vulkan/vk_resources.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,23 +1028,25 @@ 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 &&
1043+
type == key.type;
10431044
}
10441045

10451046
VkImageLayout layout;
10461047
uint64_t offset, size;
10471048
VkFormat fmt;
1049+
VkDescriptorType type;
10481050
};
10491051

10501052
namespace std
@@ -1058,6 +1060,7 @@ struct hash<DescriptorUniquenessKey>
10581060
hash ^= std::hash<uint64_t>()(key.offset) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
10591061
hash ^= std::hash<uint64_t>()(key.size) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
10601062
hash ^= std::hash<uint32_t>()(key.fmt) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
1063+
hash ^= std::hash<uint32_t>()(key.type) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
10611064
return hash;
10621065
}
10631066
};

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)