Vulkan: Add method to query debug group of node
When debugging render graph the debug group name can narrow down the place where a node originates from. This PR adds a function to retrieve the full debug group name of a specific node. Pull Request: https://projects.blender.org/blender/blender/pulls/131081
This commit is contained in:
@@ -93,8 +93,9 @@ void VKCommandBuilder::build_node_group(VKRenderGraph &render_graph,
|
||||
for (NodeHandle node_handle : node_group) {
|
||||
VKRenderGraphNode &node = render_graph.nodes_[node_handle];
|
||||
#if 0
|
||||
std::cout << "node_group: " << node_group.first() << "-" << node_group.last()
|
||||
<< ", node_handle: " << node_handle << ", node_type: " << node.type << "\n";
|
||||
std::cout << "node_group=" << node_group.first() << "-" << node_group.last()
|
||||
<< ", node_handle=" << node_handle << ", node_type=" << node.type
|
||||
<< ", debug_group=" << render_graph.full_debug_group(node_handle) << "\n";
|
||||
#endif
|
||||
#if 0
|
||||
render_graph.debug_print(node_handle);
|
||||
@@ -142,13 +143,15 @@ void VKCommandBuilder::build_node_group(VKRenderGraph &render_graph,
|
||||
is_rendering = true;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
std::cout << "node_group: " << node_group.first() << "-" << node_group.last()
|
||||
<< ", node_handle: " << node_handle << ", node_type: " << node.type << "\n";
|
||||
#endif
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
activate_debug_group(render_graph, command_buffer, node_handle);
|
||||
}
|
||||
#if 0
|
||||
std::cout << "node_group=" << node_group.first() << "-" << node_group.last()
|
||||
<< ", node_handle=" << node_handle << ", node_type=" << node.type
|
||||
<< ", debug group=" << render_graph.full_debug_group(node_handle) << "\n";
|
||||
|
||||
#endif
|
||||
node.build_commands(command_buffer, state_.active_pipelines);
|
||||
|
||||
/* When layered image has different layouts we reset the layouts to
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "vk_render_graph.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::gpu::render_graph {
|
||||
|
||||
VKRenderGraph::VKRenderGraph(std::unique_ptr<VKCommandBufferInterface> command_buffer,
|
||||
@@ -137,6 +139,25 @@ void VKRenderGraph::debug_print(NodeHandle node_handle) const
|
||||
}
|
||||
}
|
||||
|
||||
std::string VKRenderGraph::full_debug_group(NodeHandle node_handle) const
|
||||
{
|
||||
if ((G.debug & G_DEBUG_GPU) == 0) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
DebugGroupID debug_group = debug_.node_group_map[node_handle];
|
||||
if (debug_group == -1) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
for (const VKRenderGraph::DebugGroupNameID &name_id : debug_.used_groups[debug_group]) {
|
||||
ss << "/" << debug_.group_names[name_id];
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::gpu::render_graph
|
||||
|
||||
@@ -249,6 +249,12 @@ class VKRenderGraph : public NonCopyable {
|
||||
*/
|
||||
void debug_group_end();
|
||||
|
||||
/**
|
||||
* Return the full debug group of the given node_handle. Returns an empty string when debug
|
||||
* groups are not enabled (`--debug-gpu`).
|
||||
*/
|
||||
std::string full_debug_group(NodeHandle node_handle) const;
|
||||
|
||||
/**
|
||||
* Utility function that is used during debugging.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user