Skip to content

Commit c8b7cd2

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 c8b7cd2

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,9 +3452,9 @@ void WrappedVulkan::vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInf
34523452
dstRecord = GetRecord(pDescriptorInfo->data.pSampledImage->imageView);
34533453

34543454
DescriptorUniquenessKey descKey(
3455-
m_IgnoreLayoutForDescriptors
3456-
? VK_IMAGE_LAYOUT_UNDEFINED
3457-
: pDescriptorInfo->data.pCombinedImageSampler->imageLayout);
3455+
m_IgnoreLayoutForDescriptors ? VK_IMAGE_LAYOUT_UNDEFINED
3456+
: pDescriptorInfo->data.pCombinedImageSampler->imageLayout,
3457+
pDescriptorInfo->type);
34583458

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

35243524
dstRecord = GetResourceManager()->GetResourceRecord(id);
35253525

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

35283529
// this is internally locked
35293530
if(!dstRecord->resInfo->AddDescriptor(descKey))

0 commit comments

Comments
 (0)