Make queue family available in vkCmd* functions

This allows much simpler analysis of queue families. E.g. in
`vkCmdPipelineBarrier`, we can differentiate between queue family
release and acquire operations; we can also mark used subresources as
implicitly acquired by the command buffer's queue family.

Change-Id: I3e90ea1be5938781bdec675e69918b5f2bc49a49
This commit is contained in:
Benson Joeris
2020-01-27 20:44:54 +00:00
committed by Baldur Karlsson
parent e7303660d7
commit 8ccff3de48
4 changed files with 30 additions and 1 deletions
+16
View File
@@ -4056,6 +4056,22 @@ const DrawcallDescription *WrappedVulkan::GetDrawcall(uint32_t eventId)
return m_Drawcalls[eventId];
}
uint32_t WrappedVulkan::FindCommandQueueFamily(ResourceId cmdId)
{
auto it = m_commandQueueFamilies.find(cmdId);
if(it == m_commandQueueFamilies.end())
{
RDCERR("Unknown queue family for %s", ToStr(cmdId).c_str());
return m_QueueFamilyIdx;
}
return it->second;
}
void WrappedVulkan::InsertCommandQueueFamily(ResourceId cmdId, uint32_t queueFamilyIndex)
{
m_commandQueueFamilies[cmdId] = queueFamilyIndex;
}
#if ENABLED(ENABLE_UNIT_TESTS)
#undef None
+5
View File
@@ -747,6 +747,9 @@ private:
m_ForcedReferences.push_back(record);
}
// used on replay side to track the queue family of command buffers and pools
std::map<ResourceId, uint32_t> m_commandQueueFamilies;
// used both on capture and replay side to track image layouts. Only locked
// in capture
std::map<ResourceId, ImageLayouts> m_ImageLayouts;
@@ -1043,6 +1046,8 @@ public:
return m_PhysicalDeviceData.performanceQueryFeatures;
}
VkDriverInfo GetDriverInfo() { return m_PhysicalDeviceData.driverInfo; }
uint32_t FindCommandQueueFamily(ResourceId cmdId);
void InsertCommandQueueFamily(ResourceId cmdId, uint32_t queueFamilyIndex);
// Device initialization
IMPLEMENT_FUNCTION_SERIALISED(VkResult, vkCreateInstance, const VkInstanceCreateInfo *pCreateInfo,
+1 -1
View File
@@ -1724,7 +1724,7 @@ public:
PipelineLayoutData *pipeLayoutInfo; // only for pipeline layouts
DescriptorSetData *descInfo; // only for descriptor sets and descriptor set layouts
DescUpdateTemplate *descTemplateInfo; // only for descriptor update templates
uint32_t queueFamilyIndex; // only for queues
uint32_t queueFamilyIndex; // only for queues and command pools
};
VkResourceRecord *bakedCommands;
@@ -453,6 +453,8 @@ bool WrappedVulkan::Serialise_vkCreateCommandPool(SerialiserType &ser, VkDevice
// remap the queue family index
CreateInfo.queueFamilyIndex = m_QueueRemapping[CreateInfo.queueFamilyIndex][0].family;
m_commandQueueFamilies[CmdPool] = CreateInfo.queueFamilyIndex;
VkResult ret = ObjDisp(device)->CreateCommandPool(Unwrap(device), &CreateInfo, NULL, &pool);
if(ret != VK_SUCCESS)
@@ -464,6 +466,7 @@ bool WrappedVulkan::Serialise_vkCreateCommandPool(SerialiserType &ser, VkDevice
{
ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), pool);
GetResourceManager()->AddLiveResource(CmdPool, pool);
m_commandQueueFamilies[live] = CreateInfo.queueFamilyIndex;
}
AddResource(CmdPool, ResourceType::Pool, "Command Pool");
@@ -500,6 +503,7 @@ VkResult WrappedVulkan::vkCreateCommandPool(VkDevice device,
}
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pCmdPool);
record->queueFamilyIndex = pCreateInfo->queueFamilyIndex;
record->AddChunk(chunk);
}
else
@@ -557,8 +561,12 @@ bool WrappedVulkan::Serialise_vkAllocateCommandBuffers(SerialiserType &ser, VkDe
{
ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), cmd);
GetResourceManager()->AddLiveResource(CommandBuffer, cmd);
m_commandQueueFamilies[live] = m_commandQueueFamilies[GetResID(AllocateInfo.commandPool)];
}
m_commandQueueFamilies[CommandBuffer] =
m_commandQueueFamilies[GetResID(AllocateInfo.commandPool)];
AddResource(CommandBuffer, ResourceType::CommandBuffer, "Command Buffer");
DerivedResource(device, CommandBuffer);
DerivedResource(AllocateInfo.commandPool, CommandBuffer);