mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-04 04:45:48 +00:00
Handle mutable descriptor types in descriptor buffers
This commit is contained in:
@@ -832,10 +832,31 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarray<VkWriteDescri
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan, ShaderReflection *refl,
|
||||
ResourceId specStorage,
|
||||
rdcarray<DescriptorAccess> &descriptorAccess,
|
||||
rdcarray<const DescSetLayout *> setLayoutInfos)
|
||||
uint32_t GetDescriptorSizeOfBind(VulkanResourceManager *resourceMan,
|
||||
const rdcarray<DescSetLayout::Binding> &bindings,
|
||||
const rdcarray<uint64_t> &mutableBitmasks, uint32_t fixedBindNumber)
|
||||
{
|
||||
if(bindings[fixedBindNumber].layoutDescType != VK_DESCRIPTOR_TYPE_MUTABLE_EXT)
|
||||
return resourceMan->DescriptorDataSize(bindings[fixedBindNumber].layoutDescType);
|
||||
|
||||
uint64_t bitmask = mutableBitmasks[fixedBindNumber];
|
||||
uint32_t ret = 0;
|
||||
|
||||
for(uint64_t m = 0; m < (uint64_t)DescriptorSlotType::Count; m++)
|
||||
{
|
||||
if(bitmask & (1ULL << m))
|
||||
{
|
||||
ret = RDCMAX(ret, resourceMan->DescriptorDataSize(convert(DescriptorSlotType(m))));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan,
|
||||
ShaderReflection *refl, ResourceId specStorage,
|
||||
rdcarray<DescriptorAccess> &descriptorAccess,
|
||||
rdcarray<const DescSetLayout *> setLayoutInfos)
|
||||
{
|
||||
if(!refl)
|
||||
return;
|
||||
@@ -912,7 +933,8 @@ void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan, ShaderRef
|
||||
{
|
||||
access.descriptorStore =
|
||||
VulkanCreationInfo::descriptorBufferStorage[bind.fixedBindSetOrSpace];
|
||||
access.byteSize = resourceMan->DescriptorDataSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
|
||||
access.byteSize = GetDescriptorSizeOfBind(
|
||||
resourceMan, setLayout->bindings, setLayout->mutableBitmasks, bind.fixedBindNumber);
|
||||
}
|
||||
|
||||
// we are only handling non-arrays here
|
||||
@@ -963,7 +985,8 @@ void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan, ShaderRef
|
||||
VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT)
|
||||
{
|
||||
access.descriptorStore = VulkanCreationInfo::descriptorBufferStorage[bind.fixedBindSetOrSpace];
|
||||
access.byteSize = resourceMan->DescriptorDataSize(VK_DESCRIPTOR_TYPE_SAMPLER);
|
||||
access.byteSize = GetDescriptorSizeOfBind(resourceMan, setLayout->bindings,
|
||||
setLayout->mutableBitmasks, bind.fixedBindNumber);
|
||||
|
||||
// we are only handling non-arrays here
|
||||
access.byteOffset = setLayout->bindings[bind.fixedBindNumber].elemOffset;
|
||||
@@ -1016,8 +1039,8 @@ void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan, ShaderRef
|
||||
VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT)
|
||||
{
|
||||
access.descriptorStore = VulkanCreationInfo::descriptorBufferStorage[bind.fixedBindSetOrSpace];
|
||||
access.byteSize = resourceMan->DescriptorDataSize(
|
||||
MakeVkDescriptorType(bind.descriptorType, bind.isInputAttachment));
|
||||
access.byteSize = GetDescriptorSizeOfBind(resourceMan, setLayout->bindings,
|
||||
setLayout->mutableBitmasks, bind.fixedBindNumber);
|
||||
|
||||
// we are only handling non-arrays here
|
||||
access.byteOffset = setLayout->bindings[bind.fixedBindNumber].elemOffset;
|
||||
@@ -1064,8 +1087,8 @@ void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan, ShaderRef
|
||||
VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT)
|
||||
{
|
||||
access.descriptorStore = VulkanCreationInfo::descriptorBufferStorage[bind.fixedBindSetOrSpace];
|
||||
access.byteSize =
|
||||
resourceMan->DescriptorDataSize(MakeVkDescriptorType(bind.descriptorType, false));
|
||||
access.byteSize = GetDescriptorSizeOfBind(resourceMan, setLayout->bindings,
|
||||
setLayout->mutableBitmasks, bind.fixedBindNumber);
|
||||
|
||||
// we are only handling non-arrays here
|
||||
access.byteOffset = setLayout->bindings[bind.fixedBindNumber].elemOffset;
|
||||
|
||||
@@ -142,6 +142,9 @@ struct DescSetLayout
|
||||
bool isCompatible(const DescSetLayout &other) const;
|
||||
};
|
||||
|
||||
uint32_t GetDescriptorSizeOfBind(VulkanResourceManager *resourceMan,
|
||||
const rdcarray<DescSetLayout::Binding> &bindings,
|
||||
const rdcarray<uint64_t> &mutableBitmasks, uint32_t fixedBindNumber);
|
||||
bool IsValid(bool allowNULLDescriptors, const VkWriteDescriptorSet &write, uint32_t arrayElement);
|
||||
bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarray<VkWriteDescriptorSet> &writes,
|
||||
VkDescriptorBufferInfo *&writeScratch,
|
||||
|
||||
@@ -2627,7 +2627,10 @@ rdcarray<Descriptor> VulkanReplay::GetDescriptors(ResourceId descriptorStore,
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pDriver->LookupDescriptor(descriptor, r.descriptorSize, r.type, tmp);
|
||||
uint32_t size = m_pDriver->DescriptorDataSize(MakeVkDescriptorType(r.type, false));
|
||||
// should not be larger, only smaller with mutable descriptors
|
||||
RDCASSERT(size <= r.descriptorSize);
|
||||
m_pDriver->LookupDescriptor(descriptor, size, r.type, tmp);
|
||||
|
||||
FillDescriptor(ret[dst], tmp);
|
||||
}
|
||||
@@ -2763,7 +2766,10 @@ rdcarray<SamplerDescriptor> VulkanReplay::GetSamplerDescriptors(ResourceId descr
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pDriver->LookupDescriptor(descriptor, r.descriptorSize, r.type, tmp);
|
||||
uint32_t size = m_pDriver->DescriptorDataSize(MakeVkDescriptorType(r.type, false));
|
||||
// should not be larger, only smaller with mutable descriptors
|
||||
RDCASSERT(size <= r.descriptorSize);
|
||||
m_pDriver->LookupDescriptor(descriptor, size, r.type, tmp);
|
||||
|
||||
FillSamplerDescriptor(ret[dst], tmp);
|
||||
}
|
||||
|
||||
@@ -1611,7 +1611,9 @@ bool VulkanReplay::FetchShaderFeedback(uint32_t eventId)
|
||||
access.descriptorStore = m_pDriver->GetResourceManager()->GetOriginalID(id);
|
||||
access.byteOffset += uint32_t(offs + descSets[bindset].descBufferOffset) +
|
||||
descLayouts[bindset]->bindings[bind].elemOffset;
|
||||
access.byteSize = m_pDriver->DescriptorDataSize(MakeVkDescriptorType(type, inputAttachment));
|
||||
access.byteSize =
|
||||
GetDescriptorSizeOfBind(m_pDriver->GetResourceManager(), descLayouts[bindset]->bindings,
|
||||
descLayouts[bindset]->mutableBitmasks, bind);
|
||||
|
||||
if(descLayouts[bindset]->bindings[bind].variableSize || arraySize == ~0U)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user