Move object names to creation info, rename replay side maps for clarity

This commit is contained in:
baldurk
2015-10-21 14:21:43 +02:00
parent 0ff8501561
commit deea8362db
8 changed files with 23 additions and 21 deletions
+6 -5
View File
@@ -360,12 +360,13 @@ private:
map<ResourceId, ImgState> m_ImageInfo;
map<ResourceId, CmdBufferInfo> m_CmdBufferInfo;
// READING only
map<ResourceId, ResourceId> m_BufferMemBinds;
map<ResourceId, string> m_ObjectNames;
map<ResourceId, DescriptorSetInfo> m_DescriptorSetInfo;
// below are replay-side data only, doesn't have to be thread protected
// only used in replay side, so doesn't need to be thread protected
// current memory bindings, image/buffer id -> memory id
map<ResourceId, ResourceId> m_MemBindState;
// current descriptor set contents
map<ResourceId, DescriptorSetInfo> m_DescriptorSetState;
// immutable creation data
VulkanCreationInfo m_CreationInfo;
static const char *GetChunkName(uint32_t idx);
+2 -1
View File
@@ -207,7 +207,8 @@ struct VulkanCreationInfo
ShaderBindpointMapping mapping;
};
map<ResourceId, Shader> m_Shader;
map<ResourceId, string> m_Names;
map<ResourceId, SwapchainInfo> m_SwapChain;
map<ResourceId, DescSetLayout> m_DescSetLayout;
};
+2 -2
View File
@@ -214,7 +214,7 @@ bool WrappedVulkan::Serialise_InitialState(WrappedVkRes *res)
m_pSerialiser->SerialiseComplexArray("Bindings", bindings, numElems);
const DescSetLayout &layout = m_CreationInfo.m_DescSetLayout[ m_DescriptorSetInfo[id].layout ];
const DescSetLayout &layout = m_CreationInfo.m_DescSetLayout[ m_DescriptorSetState[id].layout ];
uint32_t numBinds = (uint32_t)layout.bindings.size();
@@ -456,7 +456,7 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, VulkanResourceManager
// need to blat over the current descriptor set contents, so these are available
// when we want to fetch pipeline state
vector<VkDescriptorInfo *> &bindings = m_DescriptorSetInfo[GetResourceManager()->GetOriginalID(id)].currentBindings;
vector<VkDescriptorInfo *> &bindings = m_DescriptorSetState[GetResourceManager()->GetOriginalID(id)].currentBindings;
for(uint32_t i=0; i < initial.num; i++)
{
+7 -7
View File
@@ -1194,8 +1194,8 @@ vector<byte> VulkanReplay::GetBufferData(ResourceId buff, uint32_t offset, uint3
ResourceId memid;
{
auto it = m_pDriver->m_BufferMemBinds.find(buff);
if(it == m_pDriver->m_BufferMemBinds.end())
auto it = m_pDriver->m_MemBindState.find(buff);
if(it == m_pDriver->m_MemBindState.end())
{
RDCWARN("Buffer has no memory bound, or no buffer of this ID");
return vector<byte>();
@@ -1349,7 +1349,7 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
}
ret.customName = true;
ret.name = m_pDriver->m_ObjectNames[id];
ret.name = m_pDriver->m_CreationInfo.m_Names[id];
if(ret.name.count == 0)
{
ret.customName = false;
@@ -1512,11 +1512,11 @@ void VulkanReplay::SavePipelineState()
VulkanPipelineState::Pipeline::DescriptorSet &dst = (*dsts[p])[i];
dst.descset = src;
dst.layout = m_pDriver->m_DescriptorSetInfo[src].layout;
create_array_uninit(dst.bindings, m_pDriver->m_DescriptorSetInfo[src].currentBindings.size());
for(size_t b=0; b < m_pDriver->m_DescriptorSetInfo[src].currentBindings.size(); b++)
dst.layout = m_pDriver->m_DescriptorSetState[src].layout;
create_array_uninit(dst.bindings, m_pDriver->m_DescriptorSetState[src].currentBindings.size());
for(size_t b=0; b < m_pDriver->m_DescriptorSetState[src].currentBindings.size(); b++)
{
VkDescriptorInfo *info = m_pDriver->m_DescriptorSetInfo[src].currentBindings[b];
VkDescriptorInfo *info = m_pDriver->m_DescriptorSetState[src].currentBindings[b];
const DescSetLayout::Binding &layoutBind = c.m_DescSetLayout[dst.layout].bindings[b];
dst.bindings[b].arraySize = layoutBind.arraySize;
@@ -939,7 +939,7 @@ bool WrappedVulkan::Serialise_vkCmdBindDescriptorSets(
for(uint32_t a=0; a < layout.bindings[b].arraySize; a++)
{
RDCASSERT(o < offsCount);
uint32_t *alias = (uint32_t *)&m_DescriptorSetInfo[descriptorIDs[i]].currentBindings[b][a].imageLayout;
uint32_t *alias = (uint32_t *)&m_DescriptorSetState[descriptorIDs[i]].currentBindings[b][a].imageLayout;
*alias = offs[o++];
}
}
@@ -225,8 +225,8 @@ bool WrappedVulkan::Serialise_vkAllocDescriptorSets(
GetResourceManager()->AddLiveResource(id, descset);
// this is stored in the resource record on capture, we need to be able to look to up
m_DescriptorSetInfo[id].layout = layoutId;
m_CreationInfo.m_DescSetLayout[layoutId].CreateBindingsArray(m_DescriptorSetInfo[id].currentBindings);
m_DescriptorSetState[id].layout = layoutId;
m_CreationInfo.m_DescSetLayout[layoutId].CreateBindingsArray(m_DescriptorSetState[id].currentBindings);
}
}
@@ -437,7 +437,7 @@ bool WrappedVulkan::Serialise_vkUpdateDescriptorSets(
ObjDisp(device)->UpdateDescriptorSets(Unwrap(device), 1, &writeDesc, 0, NULL);
// update our local tracking
vector<VkDescriptorInfo *> &bindings = m_DescriptorSetInfo[GetResourceManager()->GetOriginalID(GetResourceManager()->GetNonDispWrapper(writeDesc.destSet)->id)].currentBindings;
vector<VkDescriptorInfo *> &bindings = m_DescriptorSetState[GetResourceManager()->GetOriginalID(GetResourceManager()->GetNonDispWrapper(writeDesc.destSet)->id)].currentBindings;
{
RDCASSERT(writeDesc.destBinding < bindings.size());
@@ -407,7 +407,7 @@ bool WrappedVulkan::Serialise_vkBindBufferMemory(
buffer = GetResourceManager()->GetLiveHandle<VkBuffer>(bufId);
mem = GetResourceManager()->GetLiveHandle<VkDeviceMemory>(memId);
m_BufferMemBinds[GetResID(buffer)] = GetResID(mem);
m_MemBindState[GetResID(buffer)] = GetResID(mem);
ObjDisp(device)->BindBufferMemory(Unwrap(device), Unwrap(buffer), Unwrap(mem), offs);
}
@@ -286,7 +286,7 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(
m_ImageInfo[liveId].arraySize = info.imageArraySize;
m_ImageInfo[liveId].creationFlags = eTextureCreate_SRV|eTextureCreate_RTV|eTextureCreate_SwapBuffer;
m_ObjectNames[liveId] = StringFormat::Fmt("Presentable Image %u", i);
m_CreationInfo.m_Names[liveId] = StringFormat::Fmt("Presentable Image %u", i);
VkImageSubresourceRange range;
range.baseMipLevel = range.baseArrayLayer = 0;