From 52bfb0aeb048d0571ca649a9c656e7b837d7c933 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 18 Apr 2021 20:40:43 +0900 Subject: [PATCH] [vulkan] Label the drawing command buffers --- libs/video/renderer/vulkan/vulkan_alias.c | 5 +++++ libs/video/renderer/vulkan/vulkan_bsp.c | 3 ++- libs/video/renderer/vulkan/vulkan_compose.c | 3 +++ libs/video/renderer/vulkan/vulkan_draw.c | 8 ++++++++ libs/video/renderer/vulkan/vulkan_lighting.c | 7 +++++-- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libs/video/renderer/vulkan/vulkan_alias.c b/libs/video/renderer/vulkan/vulkan_alias.c index b00814427..f84e4e9c8 100644 --- a/libs/video/renderer/vulkan/vulkan_alias.c +++ b/libs/video/renderer/vulkan/vulkan_alias.c @@ -191,6 +191,10 @@ alias_begin_subpass (QFV_AliasSubpass subpass, VkPipeline pipeline, }; dfunc->vkBeginCommandBuffer (cmd, &beginInfo); + QFV_duCmdBeginLabel (device, cmd, va (ctx->va_ctx, "alias:%s", + alias_pass_names[subpass]), + { 0.6, 0.5, 0, 1}); + dfunc->vkCmdBindPipeline (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); //VkDescriptorSet sets[] = { // aframe->descriptors[0].dstSet, @@ -216,6 +220,7 @@ alias_end_subpass (VkCommandBuffer cmd, vulkan_ctx_t *ctx) qfv_device_t *device = ctx->device; qfv_devfuncs_t *dfunc = device->funcs; + QFV_duCmdEndLabel (device, cmd); dfunc->vkEndCommandBuffer (cmd); } diff --git a/libs/video/renderer/vulkan/vulkan_bsp.c b/libs/video/renderer/vulkan/vulkan_bsp.c index 07d573caa..c498ee09b 100644 --- a/libs/video/renderer/vulkan/vulkan_bsp.c +++ b/libs/video/renderer/vulkan/vulkan_bsp.c @@ -891,7 +891,8 @@ bsp_begin_subpass (QFV_BspSubpass subpass, VkPipeline pipeline, }; dfunc->vkBeginCommandBuffer (cmd, &beginInfo); - QFV_duCmdBeginLabel (device, cmd, bsp_pass_names[subpass], + QFV_duCmdBeginLabel (device, cmd, va (ctx->va_ctx, "bsp:%s", + bsp_pass_names[subpass]), {0, 0.5, 0.6, 1}); dfunc->vkCmdBindPipeline (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, diff --git a/libs/video/renderer/vulkan/vulkan_compose.c b/libs/video/renderer/vulkan/vulkan_compose.c index 66a9afc6d..70b41e92a 100644 --- a/libs/video/renderer/vulkan/vulkan_compose.c +++ b/libs/video/renderer/vulkan/vulkan_compose.c @@ -79,6 +79,8 @@ Vulkan_Compose_Draw (vulkan_ctx_t *ctx) }; dfunc->vkBeginCommandBuffer (cmd, &beginInfo); + QFV_duCmdBeginLabel (device, cmd, "compose", { 0, 0.2, 0.6, 1}); + dfunc->vkCmdBindPipeline (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, cctx->pipeline); @@ -101,6 +103,7 @@ Vulkan_Compose_Draw (vulkan_ctx_t *ctx) dfunc->vkCmdBindVertexBuffers (cmd, 0, 1, &ctx->quad_buffer, &offset); dfunc->vkCmdDraw (cmd, 4, 1, 0, 0); + QFV_duCmdEndLabel (device, cmd); dfunc->vkEndCommandBuffer (cmd); } diff --git a/libs/video/renderer/vulkan/vulkan_draw.c b/libs/video/renderer/vulkan/vulkan_draw.c index f7aeabb97..9aa532d58 100644 --- a/libs/video/renderer/vulkan/vulkan_draw.c +++ b/libs/video/renderer/vulkan/vulkan_draw.c @@ -46,6 +46,7 @@ #include "QF/quakefs.h" #include "QF/render.h" #include "QF/sys.h" +#include "QF/va.h" #include "QF/vid.h" #include "compat.h" @@ -54,6 +55,7 @@ #include "QF/Vulkan/barrier.h" #include "QF/Vulkan/buffer.h" #include "QF/Vulkan/command.h" +#include "QF/Vulkan/debug.h" #include "QF/Vulkan/descriptor.h" #include "QF/Vulkan/device.h" #include "QF/Vulkan/image.h" @@ -440,6 +442,9 @@ Vulkan_Draw_Init (vulkan_ctx_t *ctx) }; dfunc->vkUpdateDescriptorSets (device->dev, 2, write, 0, 0); dframe->cmd = cmdBuffers->a[i]; + QFV_duSetObjectName (device, VK_OBJECT_TYPE_COMMAND_BUFFER, + dframe->cmd, + va (ctx->va_ctx, "cmd:draw:%zd", i)); } free (sets); } @@ -730,6 +735,8 @@ Vulkan_FlushText (vulkan_ctx_t *ctx) }; dfunc->vkBeginCommandBuffer (cmd, &beginInfo); + QFV_duCmdBeginLabel (device, cmd, "twod", { 0.6, 0.2, 0, 1}); + dfunc->vkCmdBindPipeline (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, dctx->pipeline); dfunc->vkCmdSetViewport (cmd, 0, 1, &ctx->viewport); @@ -745,6 +752,7 @@ Vulkan_FlushText (vulkan_ctx_t *ctx) dfunc->vkCmdDrawIndexed (cmd, dframe->num_quads * INDS_PER_QUAD, 1, 0, 0, 0); + QFV_duCmdEndLabel (device, cmd); dfunc->vkEndCommandBuffer (cmd); dframe->num_quads = 0; diff --git a/libs/video/renderer/vulkan/vulkan_lighting.c b/libs/video/renderer/vulkan/vulkan_lighting.c index 9a4ab76a4..1a1ce9e47 100644 --- a/libs/video/renderer/vulkan/vulkan_lighting.c +++ b/libs/video/renderer/vulkan/vulkan_lighting.c @@ -143,8 +143,8 @@ update_lights (vulkan_ctx_t *ctx) VectorZero (light_data->lights[i].direction); light_data->lights[i].cone = 1; } - for (size_t i = 0; - i < lframe->lightvis.size && light_data->lightCount < NUM_LIGHTS; i++) { + for (size_t i = 0; (i < lframe->lightvis.size + && light_data->lightCount < NUM_LIGHTS); i++) { if (lframe->lightvis.a[i]) { light_data->lights[light_data->lightCount++] = lctx->lights.a[i]; } @@ -207,6 +207,8 @@ Vulkan_Lighting_Draw (vulkan_ctx_t *ctx) }; dfunc->vkBeginCommandBuffer (cmd, &beginInfo); + QFV_duCmdBeginLabel (device, cmd, "lighting", { 0.6, 0.5, 0.6, 1}); + dfunc->vkCmdBindPipeline (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, lctx->pipeline); @@ -237,6 +239,7 @@ Vulkan_Lighting_Draw (vulkan_ctx_t *ctx) dfunc->vkCmdBindVertexBuffers (cmd, 0, 1, &ctx->quad_buffer, &offset); dfunc->vkCmdDraw (cmd, 4, 1, 0, 0); + QFV_duCmdEndLabel (device, cmd); dfunc->vkEndCommandBuffer (cmd); }