diff --git a/framework/rendering/render_pipeline.cpp b/framework/rendering/render_pipeline.cpp index 01fdb5ec5..661f81c94 100644 --- a/framework/rendering/render_pipeline.cpp +++ b/framework/rendering/render_pipeline.cpp @@ -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); } diff --git a/samples/performance/command_buffer_usage/command_buffer_usage.cpp b/samples/performance/command_buffer_usage/command_buffer_usage.cpp index 91a7fa649..908884993 100644 --- a/samples/performance/command_buffer_usage/command_buffer_usage.cpp +++ b/samples/performance/command_buffer_usage/command_buffer_usage.cpp @@ -20,6 +20,7 @@ #include #include +#include "core/debug.h" #include "core/device.h" #include "core/pipeline_layout.h" #include "core/shader_module.h" @@ -287,6 +288,7 @@ std::shared_ptr const std::vector> &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); @@ -298,11 +300,15 @@ std::shared_ptr 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(); @@ -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; @@ -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 { diff --git a/samples/performance/command_buffer_usage/command_buffer_usage.h b/samples/performance/command_buffer_usage/command_buffer_usage.h index 204ea387c..2c2728f4e 100644 --- a/samples/performance/command_buffer_usage/command_buffer_usage.h +++ b/samples/performance/command_buffer_usage/command_buffer_usage.h @@ -183,6 +183,7 @@ 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 */ @@ -190,6 +191,7 @@ class CommandBufferUsage : public vkb::VulkanSampleC const std::vector> &nodes, uint32_t mesh_start, uint32_t mesh_end, + uint32_t subpass_index, size_t thread_index = 0); VkViewport viewport{};