Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions framework/rendering/render_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,14 @@ void RenderPipeline::draw(vkb::core::CommandBufferC &command_buffer, RenderTarge
command_buffer.next_subpass();
}

if (subpass->get_debug_name().empty())
if (contents != VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS)
{
subpass->set_debug_name(fmt::format("RP subpass #{}", i));
if (subpass->get_debug_name().empty())
{
subpass->set_debug_name(fmt::format("RP subpass #{}", i));
}
ScopedDebugLabel subpass_debug_label{command_buffer, subpass->get_debug_name().c_str()};
}
ScopedDebugLabel subpass_debug_label{command_buffer, subpass->get_debug_name().c_str()};

subpass->draw(command_buffer);
}
Expand Down
18 changes: 13 additions & 5 deletions samples/performance/command_buffer_usage/command_buffer_usage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <algorithm>
#include <numeric>

#include "core/debug.h"
#include "core/device.h"
#include "core/pipeline_layout.h"
#include "core/shader_module.h"
Expand Down Expand Up @@ -287,6 +288,7 @@ std::shared_ptr<vkb::core::CommandBufferC>
const std::vector<std::pair<vkb::scene_graph::NodeC *, vkb::sg::SubMesh *>> &nodes,
uint32_t mesh_start,
uint32_t mesh_end,
uint32_t subpass_index,
size_t thread_index)
{
const auto &queue = get_render_context().get_device().get_queue_by_flags(VK_QUEUE_GRAPHICS_BIT, 0);
Expand All @@ -298,11 +300,15 @@ std::shared_ptr<vkb::core::CommandBufferC>

secondary_command_buffer->begin(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT, &primary_command_buffer);

secondary_command_buffer->set_viewport(0, {viewport});
{
vkb::ScopedDebugLabel subpass_debug_label{*secondary_command_buffer, fmt::format("Record secondary command buffer, subpass #{}", subpass_index).c_str()};

secondary_command_buffer->set_viewport(0, {viewport});

secondary_command_buffer->set_scissor(0, {scissor});
secondary_command_buffer->set_scissor(0, {scissor});

record_draw(*secondary_command_buffer, nodes, mesh_start, mesh_end, thread_index);
record_draw(*secondary_command_buffer, nodes, mesh_start, mesh_end, thread_index);
}

secondary_command_buffer->end();

Expand Down Expand Up @@ -378,13 +384,14 @@ void CommandBufferUsage::ForwardSubpassSecondary::draw(vkb::core::CommandBufferC
std::cref(sorted_opaque_nodes),
mesh_start,
mesh_end,
cb_count,
std::placeholders::_1));

secondary_cmd_buf_futures.push_back(std::move(fut));
}
else
{
secondary_command_buffers.push_back(record_draw_secondary(primary_command_buffer, sorted_opaque_nodes, mesh_start, mesh_end));
secondary_command_buffers.push_back(record_draw_secondary(primary_command_buffer, sorted_opaque_nodes, mesh_start, mesh_end, cb_count));
}

mesh_start = mesh_end;
Expand Down Expand Up @@ -416,7 +423,8 @@ void CommandBufferUsage::ForwardSubpassSecondary::draw(vkb::core::CommandBufferC
{
if (use_secondary_command_buffers)
{
secondary_command_buffers.push_back(record_draw_secondary(primary_command_buffer, sorted_transparent_nodes, 0, transparent_submeshes));
secondary_command_buffers.push_back(
record_draw_secondary(primary_command_buffer, sorted_transparent_nodes, 0, transparent_submeshes, state.secondary_cmd_buf_count));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,15 @@ class CommandBufferUsage : public vkb::VulkanSampleC
* @param nodes The meshes to draw
* @param mesh_start Index to the first mesh to draw
* @param mesh_end Index to the mesh where recording will stop (not included)
* @param subpass_index Index of the subpass being recorded
* @param thread_index Identifies the resources allocated for this thread
* @return a pointer to the recorded secondary command buffer
*/
std::shared_ptr<vkb::core::CommandBufferC> record_draw_secondary(vkb::core::CommandBufferC &primary_command_buffer,
const std::vector<std::pair<vkb::scene_graph::NodeC *, vkb::sg::SubMesh *>> &nodes,
uint32_t mesh_start,
uint32_t mesh_end,
uint32_t subpass_index,
size_t thread_index = 0);

VkViewport viewport{};
Expand Down
Loading