mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Block allocate storage for current descriptor set bindings
This commit is contained in:
@@ -448,6 +448,30 @@ struct DescriptorSetSlot
|
||||
uint32_t inlineOffset;
|
||||
};
|
||||
|
||||
struct BindingStorage
|
||||
{
|
||||
~BindingStorage() { clear(); }
|
||||
bytebuf inlineBytes;
|
||||
rdcarray<DescriptorSetSlot *> binds;
|
||||
|
||||
void clear()
|
||||
{
|
||||
inlineBytes.clear();
|
||||
binds.clear();
|
||||
elems.clear();
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
memset(inlineBytes.data(), 0, inlineBytes.size());
|
||||
memset(elems.data(), 0, elems.byteSize());
|
||||
}
|
||||
|
||||
private:
|
||||
rdcarray<DescriptorSetSlot> elems;
|
||||
friend struct DescSetLayout;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(DescriptorSetSlotBufferInfo);
|
||||
DECLARE_REFLECTION_STRUCT(DescriptorSetSlotImageInfo);
|
||||
DECLARE_REFLECTION_STRUCT(DescriptorSetSlot);
|
||||
|
||||
@@ -4042,7 +4042,7 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, rdcarray<DebugMes
|
||||
|
||||
ResourceUsage usage = ResourceUsage(uint32_t(types[t].usage) + shad);
|
||||
|
||||
if(bind >= (int32_t)descset.currentBindings.size())
|
||||
if(bind >= (int32_t)descset.data.binds.size())
|
||||
{
|
||||
msg.description = StringFormat::Fmt(
|
||||
"Shader referenced a bind %i in descriptor set %i that does not exist. Mismatched "
|
||||
@@ -4062,7 +4062,7 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, rdcarray<DebugMes
|
||||
|
||||
for(uint32_t a = 0; a < layout.bindings[bind].descriptorCount; a++)
|
||||
{
|
||||
DescriptorSetSlot &slot = descset.currentBindings[bind][a];
|
||||
DescriptorSetSlot &slot = descset.data.binds[bind][a];
|
||||
|
||||
ResourceId id;
|
||||
|
||||
|
||||
@@ -715,18 +715,13 @@ private:
|
||||
DescriptorSetInfo &operator=(const DescriptorSetInfo &) = delete;
|
||||
~DescriptorSetInfo() { clear(); }
|
||||
ResourceId layout;
|
||||
rdcarray<DescriptorSetSlot *> currentBindings;
|
||||
bytebuf inlineData;
|
||||
BindingStorage data;
|
||||
bool push;
|
||||
|
||||
void clear()
|
||||
{
|
||||
layout = ResourceId();
|
||||
|
||||
for(size_t i = 0; i < currentBindings.size(); i++)
|
||||
delete[] currentBindings[i];
|
||||
inlineData.clear();
|
||||
currentBindings.clear();
|
||||
data.clear();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1031,11 +1026,11 @@ public:
|
||||
}
|
||||
const rdcarray<DescriptorSetSlot *> &GetCurrentDescSetBindings(ResourceId descSet)
|
||||
{
|
||||
return m_DescriptorSetState[descSet].currentBindings;
|
||||
return m_DescriptorSetState[descSet].data.binds;
|
||||
}
|
||||
const bytebuf &GetCurrentDescSetInlineData(ResourceId descSet)
|
||||
{
|
||||
return m_DescriptorSetState[descSet].inlineData;
|
||||
return m_DescriptorSetState[descSet].data.inlineBytes;
|
||||
}
|
||||
|
||||
uint32_t GetReadbackMemoryIndex(uint32_t resourceCompatibleBitmask);
|
||||
|
||||
@@ -2657,7 +2657,7 @@ void VulkanReplay::PatchReservedDescriptors(const VulkanStatePipeline &pipe,
|
||||
// Only write bindings that actually exist in the current descriptor
|
||||
// set. If there are bindings that aren't set, assume the app knows
|
||||
// what it's doing and the remaining bindings are unused.
|
||||
for(size_t b = 0; b < setInfo.currentBindings.size(); b++)
|
||||
for(size_t b = 0; b < setInfo.data.binds.size(); b++)
|
||||
{
|
||||
const DescSetLayout::Binding &bind = origLayout.bindings[b];
|
||||
|
||||
@@ -2665,7 +2665,7 @@ void VulkanReplay::PatchReservedDescriptors(const VulkanStatePipeline &pipe,
|
||||
if(bind.descriptorType == VK_DESCRIPTOR_TYPE_MAX_ENUM)
|
||||
continue;
|
||||
|
||||
DescriptorSetSlot *slot = setInfo.currentBindings[b];
|
||||
DescriptorSetSlot *slot = setInfo.data.binds[b];
|
||||
|
||||
write.dstBinding = uint32_t(b + newBindingsCount);
|
||||
write.dstArrayElement = 0;
|
||||
@@ -2729,7 +2729,7 @@ void VulkanReplay::PatchReservedDescriptors(const VulkanStatePipeline &pipe,
|
||||
inlineWrite->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT;
|
||||
inlineWrite->pNext = NULL;
|
||||
inlineWrite->dataSize = bind.descriptorCount;
|
||||
inlineWrite->pData = setInfo.inlineData.data() + slot[0].inlineOffset;
|
||||
inlineWrite->pData = setInfo.data.inlineBytes.data() + slot[0].inlineOffset;
|
||||
write.pNext = inlineWrite;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -158,75 +158,122 @@ void DescSetLayout::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo
|
||||
bindings[b].immutableSampler[s] = GetResID(pCreateInfo->pBindings[i].pImmutableSamplers[s]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DescSetLayout::CreateBindingsArray(bytebuf &inlineData,
|
||||
rdcarray<DescriptorSetSlot *> &descBindings) const
|
||||
{
|
||||
uint32_t inlineOffset = 0;
|
||||
descBindings.resize(bindings.size());
|
||||
for(size_t i = 0; i < bindings.size(); i++)
|
||||
// assign offsets in sorted bindings order, as the bindings we were provided by the application
|
||||
// don't have to appear in bindings order
|
||||
uint32_t elemOffset = 0;
|
||||
|
||||
for(size_t b = 0; b < bindings.size(); b++)
|
||||
{
|
||||
if(bindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
|
||||
bindings[b].elemOffset = elemOffset;
|
||||
|
||||
if(bindings[b].descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
|
||||
{
|
||||
descBindings[i] = new DescriptorSetSlot[1];
|
||||
memset(descBindings[i], 0, sizeof(DescriptorSetSlot));
|
||||
descBindings[i]->inlineOffset = inlineOffset;
|
||||
inlineOffset = AlignUp4(inlineOffset + bindings[i].descriptorCount);
|
||||
elemOffset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
descBindings[i] = new DescriptorSetSlot[bindings[i].descriptorCount];
|
||||
memset(descBindings[i], 0, sizeof(DescriptorSetSlot) * bindings[i].descriptorCount);
|
||||
elemOffset += bindings[b].descriptorCount;
|
||||
}
|
||||
}
|
||||
|
||||
inlineData.resize(inlineByteSize);
|
||||
totalElems = elemOffset;
|
||||
}
|
||||
|
||||
void DescSetLayout::UpdateBindingsArray(const DescSetLayout &prevLayout, bytebuf &inlineData,
|
||||
rdcarray<DescriptorSetSlot *> &descBindings) const
|
||||
void DescSetLayout::CreateBindingsArray(BindingStorage &bindingStorage) const
|
||||
{
|
||||
// if we have fewer bindings now, delete the orphaned bindings arrays
|
||||
for(size_t i = bindings.size(); i < prevLayout.bindings.size(); i++)
|
||||
SAFE_DELETE_ARRAY(descBindings[i]);
|
||||
|
||||
inlineData.resize(inlineByteSize);
|
||||
|
||||
// resize to the new number of bindings
|
||||
descBindings.resize(bindings.size());
|
||||
|
||||
uint32_t inlineOffset = 0;
|
||||
// re-allocate slots and move any previous bindings that overlapped over.
|
||||
for(size_t i = 0; i < bindings.size(); i++)
|
||||
if(!bindings.empty())
|
||||
{
|
||||
if(bindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
|
||||
bindingStorage.elems.resize(totalElems);
|
||||
bindingStorage.binds.resize(bindings.size());
|
||||
|
||||
if(inlineByteSize == 0)
|
||||
{
|
||||
SAFE_DELETE_ARRAY(descBindings[i]);
|
||||
descBindings[i] = new DescriptorSetSlot[1];
|
||||
memset(descBindings[i], 0, sizeof(DescriptorSetSlot));
|
||||
descBindings[i]->inlineOffset = inlineOffset;
|
||||
inlineOffset = AlignUp4(inlineOffset + bindings[i].descriptorCount);
|
||||
for(size_t i = 0; i < bindings.size(); i++)
|
||||
bindingStorage.binds[i] = bindingStorage.elems.data() + bindings[i].elemOffset;
|
||||
|
||||
bindingStorage.inlineBytes.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
// allocate new slot array
|
||||
DescriptorSetSlot *newSlots = new DescriptorSetSlot[bindings[i].descriptorCount];
|
||||
memset(newSlots, 0, sizeof(DescriptorSetSlot) * bindings[i].descriptorCount);
|
||||
uint32_t inlineOffset = 0;
|
||||
for(size_t i = 0; i < bindings.size(); i++)
|
||||
{
|
||||
bindingStorage.binds[i] = bindingStorage.elems.data() + bindings[i].elemOffset;
|
||||
|
||||
// copy over any previous bindings that overlapped
|
||||
if(i < prevLayout.bindings.size())
|
||||
memcpy(newSlots, descBindings[i],
|
||||
sizeof(DescriptorSetSlot) *
|
||||
RDCMIN(prevLayout.bindings[i].descriptorCount, bindings[i].descriptorCount));
|
||||
if(bindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
|
||||
{
|
||||
bindingStorage.binds[i]->inlineOffset = inlineOffset;
|
||||
inlineOffset = AlignUp4(inlineOffset + bindings[i].descriptorCount);
|
||||
}
|
||||
}
|
||||
|
||||
// delete old array, and assign the new one
|
||||
SAFE_DELETE_ARRAY(descBindings[i]);
|
||||
descBindings[i] = newSlots;
|
||||
bindingStorage.inlineBytes.resize(inlineByteSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DescSetLayout::UpdateBindingsArray(const DescSetLayout &prevLayout,
|
||||
BindingStorage &bindingStorage) const
|
||||
{
|
||||
if(bindings.empty())
|
||||
{
|
||||
bindingStorage.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
rdcarray<DescriptorSetSlot> newElems;
|
||||
newElems.resize(totalElems);
|
||||
|
||||
// resize to the new size, discarding any excess we don't need anymore
|
||||
bindingStorage.binds.resize(bindings.size());
|
||||
|
||||
if(inlineByteSize == 0)
|
||||
{
|
||||
for(size_t i = 0; i < bindings.size(); i++)
|
||||
{
|
||||
DescriptorSetSlot *newSlots = newElems.data() + bindings[i].elemOffset;
|
||||
|
||||
// copy over any previous bindings that overlapped
|
||||
if(i < prevLayout.bindings.size())
|
||||
memcpy(newSlots, bindingStorage.binds[i],
|
||||
sizeof(DescriptorSetSlot) *
|
||||
RDCMIN(prevLayout.bindings[i].descriptorCount, bindings[i].descriptorCount));
|
||||
|
||||
bindingStorage.binds[i] = newSlots;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t inlineOffset = 0;
|
||||
for(size_t i = 0; i < bindings.size(); i++)
|
||||
{
|
||||
DescriptorSetSlot *newSlots = newElems.data() + bindings[i].elemOffset;
|
||||
|
||||
if(bindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
|
||||
{
|
||||
bindingStorage.binds[i]->inlineOffset = inlineOffset;
|
||||
inlineOffset = AlignUp4(inlineOffset + bindings[i].descriptorCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
// copy over any previous bindings that overlapped
|
||||
if(i < prevLayout.bindings.size())
|
||||
memcpy(newSlots, bindingStorage.binds[i],
|
||||
sizeof(DescriptorSetSlot) *
|
||||
RDCMIN(prevLayout.bindings[i].descriptorCount, bindings[i].descriptorCount));
|
||||
}
|
||||
|
||||
bindingStorage.binds[i] = newSlots;
|
||||
}
|
||||
|
||||
bindingStorage.inlineBytes.resize(inlineByteSize);
|
||||
}
|
||||
|
||||
bindingStorage.elems.swap(newElems);
|
||||
}
|
||||
}
|
||||
|
||||
bool DescSetLayout::operator==(const DescSetLayout &other) const
|
||||
{
|
||||
// shortcut for equality to ourselves
|
||||
|
||||
@@ -72,9 +72,8 @@ struct DescSetLayout
|
||||
void Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo);
|
||||
|
||||
void CreateBindingsArray(bytebuf &inlineData, rdcarray<DescriptorSetSlot *> &descBindings) const;
|
||||
void UpdateBindingsArray(const DescSetLayout &prevLayout, bytebuf &inlineData,
|
||||
rdcarray<DescriptorSetSlot *> &descBindings) const;
|
||||
void CreateBindingsArray(BindingStorage &bindingStorage) const;
|
||||
void UpdateBindingsArray(const DescSetLayout &prevLayout, BindingStorage &bindingStorage) const;
|
||||
|
||||
struct Binding
|
||||
{
|
||||
@@ -83,6 +82,7 @@ struct DescSetLayout
|
||||
// elements
|
||||
Binding()
|
||||
: descriptorType(VK_DESCRIPTOR_TYPE_MAX_ENUM),
|
||||
elemOffset(0),
|
||||
descriptorCount(0),
|
||||
stageFlags(0),
|
||||
immutableSampler(NULL)
|
||||
@@ -91,6 +91,7 @@ struct DescSetLayout
|
||||
// Copy the immutable sampler
|
||||
Binding(const Binding &b)
|
||||
: descriptorType(b.descriptorType),
|
||||
elemOffset(b.elemOffset),
|
||||
descriptorCount(b.descriptorCount),
|
||||
stageFlags(b.stageFlags),
|
||||
immutableSampler(NULL)
|
||||
@@ -107,6 +108,7 @@ struct DescSetLayout
|
||||
return *this;
|
||||
|
||||
descriptorType = b.descriptorType;
|
||||
elemOffset = b.elemOffset;
|
||||
descriptorCount = b.descriptorCount;
|
||||
stageFlags = b.stageFlags;
|
||||
SAFE_DELETE_ARRAY(immutableSampler);
|
||||
@@ -119,12 +121,14 @@ struct DescSetLayout
|
||||
}
|
||||
~Binding() { SAFE_DELETE_ARRAY(immutableSampler); }
|
||||
VkDescriptorType descriptorType;
|
||||
uint32_t elemOffset;
|
||||
uint32_t descriptorCount;
|
||||
VkShaderStageFlags stageFlags;
|
||||
ResourceId *immutableSampler;
|
||||
};
|
||||
rdcarray<Binding> bindings;
|
||||
|
||||
uint32_t totalElems;
|
||||
uint32_t dynamicCount;
|
||||
VkDescriptorSetLayoutCreateFlags flags;
|
||||
|
||||
|
||||
@@ -74,20 +74,20 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
{
|
||||
if(layout.bindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
|
||||
{
|
||||
initialContents.descriptorSlots[e++] = record->descInfo->descBindings[i][0];
|
||||
initialContents.descriptorSlots[e++] = record->descInfo->data.binds[i][0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uint32_t b = 0; b < layout.bindings[i].descriptorCount; b++)
|
||||
{
|
||||
initialContents.descriptorSlots[e++] = record->descInfo->descBindings[i][b];
|
||||
initialContents.descriptorSlots[e++] = record->descInfo->data.binds[i][b];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initialContents.inlineData = AllocAlignedBuffer(record->descInfo->inlineData.size());
|
||||
memcpy(initialContents.inlineData, record->descInfo->inlineData.data(),
|
||||
record->descInfo->inlineData.size());
|
||||
initialContents.inlineData = AllocAlignedBuffer(record->descInfo->data.inlineBytes.size());
|
||||
memcpy(initialContents.inlineData, record->descInfo->data.inlineBytes.data(),
|
||||
record->descInfo->data.inlineBytes.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1354,8 +1354,8 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, const VkInitialConten
|
||||
|
||||
// need to blat over the current descriptor set contents, so these are available
|
||||
// when we want to fetch pipeline state
|
||||
rdcarray<DescriptorSetSlot *> &bindings = m_DescriptorSetState[id].currentBindings;
|
||||
bytebuf &inlineData = m_DescriptorSetState[id].inlineData;
|
||||
rdcarray<DescriptorSetSlot *> &bindings = m_DescriptorSetState[id].data.binds;
|
||||
bytebuf &inlineData = m_DescriptorSetState[id].data.inlineBytes;
|
||||
|
||||
for(uint32_t i = 0; i < initial.numDescriptors; i++)
|
||||
{
|
||||
|
||||
@@ -1604,10 +1604,10 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
|
||||
}
|
||||
|
||||
dst.layoutResourceId = rm->GetOriginalID(layoutId);
|
||||
dst.bindings.resize(m_pDriver->m_DescriptorSetState[src].currentBindings.size());
|
||||
for(size_t b = 0; b < m_pDriver->m_DescriptorSetState[src].currentBindings.size(); b++)
|
||||
dst.bindings.resize(m_pDriver->m_DescriptorSetState[src].data.binds.size());
|
||||
for(size_t b = 0; b < m_pDriver->m_DescriptorSetState[src].data.binds.size(); b++)
|
||||
{
|
||||
DescriptorSetSlot *info = m_pDriver->m_DescriptorSetState[src].currentBindings[b];
|
||||
DescriptorSetSlot *info = m_pDriver->m_DescriptorSetState[src].data.binds[b];
|
||||
const DescSetLayout::Binding &layoutBind = c.m_DescSetLayout[layoutId].bindings[b];
|
||||
|
||||
curBind.bind = (uint32_t)b;
|
||||
@@ -1997,7 +1997,7 @@ void VulkanReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader,
|
||||
{
|
||||
bytebuf inlineData;
|
||||
inlineData.assign(
|
||||
setData.inlineData.data() + setData.currentBindings[bind.bind]->inlineOffset,
|
||||
setData.data.inlineBytes.data() + setData.data.binds[bind.bind]->inlineOffset,
|
||||
layoutBind.descriptorCount);
|
||||
StandardFillCBufferVariables(refl.resourceId, c.variables, outvars, inlineData);
|
||||
return;
|
||||
|
||||
@@ -1043,19 +1043,12 @@ struct DescriptorSetData
|
||||
DescriptorSetData() : layout(NULL) {}
|
||||
DescriptorSetData(const DescriptorSetData &) = delete;
|
||||
DescriptorSetData &operator=(const DescriptorSetData &) = delete;
|
||||
~DescriptorSetData()
|
||||
{
|
||||
for(size_t i = 0; i < descBindings.size(); i++)
|
||||
delete[] descBindings[i];
|
||||
descBindings.clear();
|
||||
}
|
||||
|
||||
~DescriptorSetData() { data.clear(); }
|
||||
DescSetLayout *layout;
|
||||
|
||||
// descriptor set bindings for this descriptor set. Filled out on
|
||||
// create from the layout.
|
||||
rdcarray<DescriptorSetSlot *> descBindings;
|
||||
bytebuf inlineData;
|
||||
BindingStorage data;
|
||||
|
||||
// lock protecting bindFrameRefs and bindMemRefs
|
||||
Threading::CriticalSection refLock;
|
||||
|
||||
@@ -464,7 +464,7 @@ void VulkanRenderState::BindDescriptorSet(WrappedVulkan *vk, const DescSetLayout
|
||||
push.descriptorType = bind.descriptorType;
|
||||
push.descriptorCount = bind.descriptorCount;
|
||||
|
||||
DescriptorSetSlot *slots = setInfo.currentBindings[b];
|
||||
const DescriptorSetSlot *slots = setInfo.data.binds[b];
|
||||
|
||||
if(push.descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER ||
|
||||
push.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
|
||||
@@ -506,7 +506,7 @@ void VulkanRenderState::BindDescriptorSet(WrappedVulkan *vk, const DescSetLayout
|
||||
inlineWrite->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT;
|
||||
inlineWrite->pNext = NULL;
|
||||
inlineWrite->dataSize = bind.descriptorCount;
|
||||
inlineWrite->pData = setInfo.inlineData.data() + slots[0].inlineOffset;
|
||||
inlineWrite->pData = setInfo.data.inlineBytes.data() + slots[0].inlineOffset;
|
||||
|
||||
push.pNext = inlineWrite;
|
||||
push.descriptorCount = bind.descriptorCount;
|
||||
|
||||
@@ -2816,7 +2816,7 @@ bool WrappedVulkan::Serialise_vkCmdBindDescriptorSets(
|
||||
{
|
||||
RDCASSERT(o < dynamicOffsetCount);
|
||||
uint32_t *alias =
|
||||
(uint32_t *)&m_DescriptorSetState[descId].currentBindings[b][a].imageInfo.imageLayout;
|
||||
(uint32_t *)&m_DescriptorSetState[descId].data.binds[b][a].imageInfo.imageLayout;
|
||||
*alias = pDynamicOffsets[o++];
|
||||
}
|
||||
}
|
||||
@@ -4391,17 +4391,18 @@ void WrappedVulkan::ApplyPushDescriptorWrites(VkPipelineBindPoint pipelineBindPo
|
||||
|
||||
const DescSetLayout &desclayout = m_CreationInfo.m_DescSetLayout[descSetLayouts[set]];
|
||||
|
||||
rdcarray<DescriptorSetSlot *> &bindings = m_DescriptorSetState[setId].currentBindings;
|
||||
bytebuf &inlineData = m_DescriptorSetState[setId].inlineData;
|
||||
rdcarray<DescriptorSetSlot *> &bindings = m_DescriptorSetState[setId].data.binds;
|
||||
bytebuf &inlineData = m_DescriptorSetState[setId].data.inlineBytes;
|
||||
ResourceId prevLayout = m_DescriptorSetState[setId].layout;
|
||||
|
||||
if(prevLayout == ResourceId())
|
||||
{
|
||||
desclayout.CreateBindingsArray(inlineData, bindings);
|
||||
desclayout.CreateBindingsArray(m_DescriptorSetState[setId].data);
|
||||
}
|
||||
else if(prevLayout != descSetLayouts[set])
|
||||
{
|
||||
desclayout.UpdateBindingsArray(m_CreationInfo.m_DescSetLayout[prevLayout], inlineData, bindings);
|
||||
desclayout.UpdateBindingsArray(m_CreationInfo.m_DescSetLayout[prevLayout],
|
||||
m_DescriptorSetState[setId].data);
|
||||
}
|
||||
|
||||
m_DescriptorSetState[setId].layout = descSetLayouts[set];
|
||||
|
||||
@@ -451,8 +451,7 @@ bool WrappedVulkan::Serialise_vkAllocateDescriptorSets(SerialiserType &ser, VkDe
|
||||
|
||||
// this is stored in the resource record on capture, we need to be able to look to up
|
||||
m_DescriptorSetState[live].layout = layoutId;
|
||||
m_CreationInfo.m_DescSetLayout[layoutId].CreateBindingsArray(
|
||||
m_DescriptorSetState[live].inlineData, m_DescriptorSetState[live].currentBindings);
|
||||
m_CreationInfo.m_DescSetLayout[layoutId].CreateBindingsArray(m_DescriptorSetState[live].data);
|
||||
}
|
||||
|
||||
AddResource(DescriptorSet, ResourceType::ShaderBinding, "Descriptor Set");
|
||||
@@ -525,8 +524,7 @@ VkResult WrappedVulkan::vkAllocateDescriptorSets(VkDevice device,
|
||||
|
||||
record->descInfo = new DescriptorSetData();
|
||||
record->descInfo->layout = layoutRecord->descInfo->layout;
|
||||
record->descInfo->layout->CreateBindingsArray(record->descInfo->inlineData,
|
||||
record->descInfo->descBindings);
|
||||
record->descInfo->layout->CreateBindingsArray(record->descInfo->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -668,8 +666,8 @@ void WrappedVulkan::ReplayDescriptorSetWrite(VkDevice device, const VkWriteDescr
|
||||
|
||||
// update our local tracking
|
||||
rdcarray<DescriptorSetSlot *> &bindings =
|
||||
m_DescriptorSetState[GetResID(writeDesc.dstSet)].currentBindings;
|
||||
bytebuf &inlineData = m_DescriptorSetState[GetResID(writeDesc.dstSet)].inlineData;
|
||||
m_DescriptorSetState[GetResID(writeDesc.dstSet)].data.binds;
|
||||
bytebuf &inlineData = m_DescriptorSetState[GetResID(writeDesc.dstSet)].data.inlineBytes;
|
||||
|
||||
{
|
||||
RDCASSERT(writeDesc.dstBinding < bindings.size());
|
||||
@@ -768,8 +766,8 @@ void WrappedVulkan::ReplayDescriptorSetCopy(VkDevice device, const VkCopyDescrip
|
||||
ResourceId srcSetId = GetResID(copyDesc.srcSet);
|
||||
|
||||
// update our local tracking
|
||||
rdcarray<DescriptorSetSlot *> &dstbindings = m_DescriptorSetState[dstSetId].currentBindings;
|
||||
rdcarray<DescriptorSetSlot *> &srcbindings = m_DescriptorSetState[srcSetId].currentBindings;
|
||||
rdcarray<DescriptorSetSlot *> &dstbindings = m_DescriptorSetState[dstSetId].data.binds;
|
||||
rdcarray<DescriptorSetSlot *> &srcbindings = m_DescriptorSetState[srcSetId].data.binds;
|
||||
|
||||
{
|
||||
RDCASSERT(copyDesc.dstBinding < dstbindings.size());
|
||||
@@ -796,8 +794,8 @@ void WrappedVulkan::ReplayDescriptorSetCopy(VkDevice device, const VkCopyDescrip
|
||||
// inline uniform blocks are special, the descriptor count is a byte count. The layouts may
|
||||
// not match so inline offsets might not match, so we just copy the data and break.
|
||||
|
||||
bytebuf &dstInlineData = m_DescriptorSetState[dstSetId].inlineData;
|
||||
bytebuf &srcInlineData = m_DescriptorSetState[srcSetId].inlineData;
|
||||
bytebuf &dstInlineData = m_DescriptorSetState[dstSetId].data.inlineBytes;
|
||||
bytebuf &srcInlineData = m_DescriptorSetState[srcSetId].data.inlineBytes;
|
||||
|
||||
memcpy(dstInlineData.data() + (*dstbind)[0].inlineOffset + copyDesc.dstArrayElement,
|
||||
srcInlineData.data() + (*srcbind)[0].inlineOffset + copyDesc.srcArrayElement,
|
||||
@@ -897,7 +895,7 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
RDCASSERT(record->descInfo && record->descInfo->layout);
|
||||
const DescSetLayout &layout = *record->descInfo->layout;
|
||||
|
||||
RDCASSERT(unwrappedWrites[i].dstBinding < record->descInfo->descBindings.size());
|
||||
RDCASSERT(unwrappedWrites[i].dstBinding < record->descInfo->data.binds.size());
|
||||
const DescSetLayout::Binding *layoutBinding = &layout.bindings[unwrappedWrites[i].dstBinding];
|
||||
|
||||
hasImmutable = layoutBinding->immutableSampler != NULL;
|
||||
@@ -1067,10 +1065,10 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
RDCASSERT(record->descInfo && record->descInfo->layout);
|
||||
const DescSetLayout &layout = *record->descInfo->layout;
|
||||
|
||||
RDCASSERT(descWrite.dstBinding < record->descInfo->descBindings.size());
|
||||
RDCASSERT(descWrite.dstBinding < record->descInfo->data.binds.size());
|
||||
|
||||
DescriptorSetSlot **binding = &record->descInfo->descBindings[descWrite.dstBinding];
|
||||
bytebuf &inlineData = record->descInfo->inlineData;
|
||||
DescriptorSetSlot **binding = &record->descInfo->data.binds[descWrite.dstBinding];
|
||||
bytebuf &inlineData = record->descInfo->data.inlineBytes;
|
||||
|
||||
const DescSetLayout::Binding *layoutBinding = &layout.bindings[descWrite.dstBinding];
|
||||
|
||||
@@ -1190,13 +1188,13 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
RDCASSERT(srcrecord->descInfo && srcrecord->descInfo->layout);
|
||||
const DescSetLayout &srclayout = *srcrecord->descInfo->layout;
|
||||
|
||||
RDCASSERT(pDescriptorCopies[i].dstBinding < dstrecord->descInfo->descBindings.size());
|
||||
RDCASSERT(pDescriptorCopies[i].srcBinding < srcrecord->descInfo->descBindings.size());
|
||||
RDCASSERT(pDescriptorCopies[i].dstBinding < dstrecord->descInfo->data.binds.size());
|
||||
RDCASSERT(pDescriptorCopies[i].srcBinding < srcrecord->descInfo->data.binds.size());
|
||||
|
||||
DescriptorSetSlot **dstbinding =
|
||||
&dstrecord->descInfo->descBindings[pDescriptorCopies[i].dstBinding];
|
||||
&dstrecord->descInfo->data.binds[pDescriptorCopies[i].dstBinding];
|
||||
DescriptorSetSlot **srcbinding =
|
||||
&srcrecord->descInfo->descBindings[pDescriptorCopies[i].srcBinding];
|
||||
&srcrecord->descInfo->data.binds[pDescriptorCopies[i].srcBinding];
|
||||
|
||||
const DescSetLayout::Binding *dstlayoutBinding =
|
||||
&dstlayout.bindings[pDescriptorCopies[i].dstBinding];
|
||||
@@ -1219,8 +1217,8 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
// inline uniform blocks are special, the descriptor count is a byte count. The layouts
|
||||
// may not match so inline offsets might not match, so we just copy the data and break.
|
||||
|
||||
bytebuf &dstInlineData = dstrecord->descInfo->inlineData;
|
||||
bytebuf &srcInlineData = srcrecord->descInfo->inlineData;
|
||||
bytebuf &dstInlineData = dstrecord->descInfo->data.inlineBytes;
|
||||
bytebuf &srcInlineData = srcrecord->descInfo->data.inlineBytes;
|
||||
|
||||
memcpy(dstInlineData.data() + (*dstbinding)[0].inlineOffset +
|
||||
pDescriptorCopies[i].dstArrayElement,
|
||||
@@ -1508,10 +1506,10 @@ void WrappedVulkan::vkUpdateDescriptorSetWithTemplate(
|
||||
RDCASSERT(record->descInfo && record->descInfo->layout);
|
||||
const DescSetLayout &layout = *record->descInfo->layout;
|
||||
|
||||
RDCASSERT(entry.dstBinding < record->descInfo->descBindings.size());
|
||||
RDCASSERT(entry.dstBinding < record->descInfo->data.binds.size());
|
||||
|
||||
DescriptorSetSlot **binding = &record->descInfo->descBindings[entry.dstBinding];
|
||||
bytebuf &inlineData = record->descInfo->inlineData;
|
||||
DescriptorSetSlot **binding = &record->descInfo->data.binds[entry.dstBinding];
|
||||
bytebuf &inlineData = record->descInfo->data.inlineBytes;
|
||||
|
||||
const DescSetLayout::Binding *layoutBinding = &layout.bindings[entry.dstBinding];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user