Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions dive_core/gfxr_vulkan_command_hierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,51 @@ void GfxrVulkanCommandHierarchyCreator::OnCommand(
AddNode(NodeType::kGfxrVulkanBeginCommandBufferNode, vk_cmd_string_stream.str());
m_cur_command_buffer_node_index = cmd_buffer_index;
GetArgs(vulkan_cmd_args, m_cur_command_buffer_node_index);
AddChild(CommandHierarchy::TopologyType::kAllEventTopology, m_cur_submit_node_index,
cmd_buffer_index);
if (m_cur_parent_node_index_stack.empty())
{
AddChild(CommandHierarchy::TopologyType::kAllEventTopology, m_cur_submit_node_index,
cmd_buffer_index);
}
else
{
AddChild(CommandHierarchy::TopologyType::kAllEventTopology,
m_cur_parent_node_index_stack.top(), cmd_buffer_index);
}
}
else if (vulkan_cmd_name == "vkEndCommandBuffer")
{
uint64_t cmd_buffer_index =
AddNode(NodeType::kGfxrVulkanEndCommandBufferNode, vk_cmd_string_stream.str());

GetArgs(vulkan_cmd_args, cmd_buffer_index);
AddChild(CommandHierarchy::TopologyType::kAllEventTopology, m_cur_command_buffer_node_index,
cmd_buffer_index);

if (m_cur_parent_node_index_stack.empty())
{
AddChild(CommandHierarchy::TopologyType::kAllEventTopology, m_cur_submit_node_index,
cmd_buffer_index);
}
else
{
AddChild(CommandHierarchy::TopologyType::kAllEventTopology,
m_cur_parent_node_index_stack.top(), cmd_buffer_index);
}
}
else if (vulkan_cmd_name.find("BeginDebugUtilsLabelEXT") != std::string::npos)
{
std::string label_name = vulkan_cmd_args["pLabelInfo"]["pLabelName"];

uint64_t begin_debug_utils_label_cmd_index =
AddNode(NodeType::kGfxrBeginDebugUtilsLabelCommandNode, label_name.c_str());
GetArgs(vulkan_cmd_args, begin_debug_utils_label_cmd_index);
ConditionallyAddChild(begin_debug_utils_label_cmd_index);
if (m_cur_parent_node_index_stack.empty())
{
AddChild(CommandHierarchy::TopologyType::kAllEventTopology, m_cur_submit_node_index,
begin_debug_utils_label_cmd_index);
}
else
{
AddChild(CommandHierarchy::TopologyType::kAllEventTopology,
m_cur_parent_node_index_stack.top(), begin_debug_utils_label_cmd_index);
}
m_cur_parent_node_index_stack.push(begin_debug_utils_label_cmd_index);
}
else if (vulkan_cmd_name.find("EndDebugUtilsLabelEXT") != std::string::npos)
Expand Down Expand Up @@ -157,7 +182,6 @@ void GfxrVulkanCommandHierarchyCreator::OnCommand(
AddNode(NodeType::kGfxrVulkanBeginRenderPassCommandNode, vk_cmd_string_stream.str());
GetArgs(vulkan_cmd_args, vk_cmd_index);
ConditionallyAddChild(vk_cmd_index);
m_cur_parent_node_index_stack.push(vk_cmd_index);
}
else if (vulkan_cmd_name.find("vkCmdEndRenderPass") != std::string::npos)
{
Expand All @@ -168,7 +192,11 @@ void GfxrVulkanCommandHierarchyCreator::OnCommand(
if (!m_cur_parent_node_index_stack.empty())
{
// Remove the corresponding vkCmdBeginRenderPass node from the stack
m_cur_parent_node_index_stack.pop();
if (m_command_hierarchy.GetNodeType(m_cur_parent_node_index_stack.top()) ==
NodeType::kGfxrVulkanBeginRenderPassCommandNode)
{
m_cur_parent_node_index_stack.pop();
}
}
}
else
Expand Down Expand Up @@ -218,12 +246,6 @@ bool GfxrVulkanCommandHierarchyCreator::ProcessVkCmds(
OnCommand(vk_cmd_info, draw_call_count, mutable_render_pass_draw_call_counts);
}

// Ensure the parent node index stack is cleared
while (!m_cur_parent_node_index_stack.empty())
{
m_cur_parent_node_index_stack.pop();
}

return true;
}

Expand Down
Loading