@@ -290,6 +290,9 @@ typedef struct _plDevice
290290 PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBegin ;
291291 PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEnd ;
292292 PFN_vkCmdDebugMarkerInsertEXT vkCmdDebugMarkerInsert ;
293+ PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabel ;
294+ PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabel ;
295+ PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabel ;
293296
294297 // memory blocks
295298 plDeviceMemoryAllocation * sbtMemoryBlocks ;
@@ -1977,6 +1980,150 @@ pl_update_render_pass_attachments(plDevice* ptDevice, plRenderPassHandle tHandle
19771980 }
19781981}
19791982
1983+ void
1984+ pl_insert_debug_label (plCommandBuffer * ptCmdBuffer , const char * pcLabel , plVec4 tColor )
1985+ {
1986+ plDevice * ptDevice = ptCmdBuffer -> ptDevice ;
1987+
1988+ if (ptDevice -> vkCmdInsertDebugUtilsLabel == NULL )
1989+ return ;
1990+
1991+ VkDebugUtilsLabelEXT tLabel = {
1992+ .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT ,
1993+ .pNext = NULL ,
1994+ .pLabelName = pcLabel ,
1995+ .color = {
1996+ tColor .r ,
1997+ tColor .g ,
1998+ tColor .b ,
1999+ tColor .a
2000+ }
2001+ };
2002+ ptDevice -> vkCmdInsertDebugUtilsLabel (ptCmdBuffer -> tCmdBuffer , & tLabel );
2003+ }
2004+
2005+ void
2006+ pl_push_debug_group (plCommandBuffer * ptCmdBuffer , const char * pcLabel , plVec4 tColor )
2007+ {
2008+
2009+ plDevice * ptDevice = ptCmdBuffer -> ptDevice ;
2010+
2011+ if (ptDevice -> vkCmdBeginDebugUtilsLabel == NULL )
2012+ return ;
2013+
2014+ VkDebugUtilsLabelEXT tLabel = {
2015+ .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT ,
2016+ .pNext = NULL ,
2017+ .pLabelName = pcLabel ,
2018+ .color = {
2019+ tColor .r ,
2020+ tColor .g ,
2021+ tColor .b ,
2022+ tColor .a
2023+ }
2024+ };
2025+ ptDevice -> vkCmdBeginDebugUtilsLabel (ptCmdBuffer -> tCmdBuffer , & tLabel );
2026+ }
2027+
2028+ void
2029+ pl_pop_debug_group (plCommandBuffer * ptCmdBuffer )
2030+ {
2031+ plDevice * ptDevice = ptCmdBuffer -> ptDevice ;
2032+ if (ptDevice -> vkCmdEndDebugUtilsLabel )
2033+ ptDevice -> vkCmdEndDebugUtilsLabel (ptCmdBuffer -> tCmdBuffer );
2034+ }
2035+
2036+ void
2037+ pl_push_render_debug_group (plRenderEncoder * ptEncoder , const char * pcLabel , plVec4 tColor )
2038+ {
2039+
2040+ plDevice * ptDevice = ptEncoder -> ptCommandBuffer -> ptDevice ;
2041+
2042+ if (ptDevice -> vkCmdBeginDebugUtilsLabel == NULL )
2043+ return ;
2044+
2045+ VkDebugUtilsLabelEXT tLabel = {
2046+ .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT ,
2047+ .pNext = NULL ,
2048+ .pLabelName = pcLabel ,
2049+ .color = {
2050+ tColor .r ,
2051+ tColor .g ,
2052+ tColor .b ,
2053+ tColor .a
2054+ }
2055+ };
2056+ ptDevice -> vkCmdBeginDebugUtilsLabel (ptEncoder -> ptCommandBuffer -> tCmdBuffer , & tLabel );
2057+ }
2058+
2059+ void
2060+ pl_pop_render_debug_group (plRenderEncoder * ptEncoder )
2061+ {
2062+ plDevice * ptDevice = ptEncoder -> ptCommandBuffer -> ptDevice ;
2063+ if (ptDevice -> vkCmdEndDebugUtilsLabel )
2064+ ptDevice -> vkCmdEndDebugUtilsLabel (ptEncoder -> ptCommandBuffer -> tCmdBuffer );
2065+ }
2066+
2067+ void
2068+ pl_push_blit_debug_group (plBlitEncoder * ptEncoder , const char * pcLabel , plVec4 tColor )
2069+ {
2070+ plDevice * ptDevice = ptEncoder -> ptCommandBuffer -> ptDevice ;
2071+
2072+ if (ptDevice -> vkCmdBeginDebugUtilsLabel == NULL )
2073+ return ;
2074+
2075+ VkDebugUtilsLabelEXT tLabel = {
2076+ .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT ,
2077+ .pNext = NULL ,
2078+ .pLabelName = pcLabel ,
2079+ .color = {
2080+ tColor .r ,
2081+ tColor .g ,
2082+ tColor .b ,
2083+ tColor .a
2084+ }
2085+ };
2086+ ptDevice -> vkCmdBeginDebugUtilsLabel (ptEncoder -> ptCommandBuffer -> tCmdBuffer , & tLabel );
2087+ }
2088+
2089+ void
2090+ pl_pop_blit_debug_group (plBlitEncoder * ptEncoder )
2091+ {
2092+ plDevice * ptDevice = ptEncoder -> ptCommandBuffer -> ptDevice ;
2093+ if (ptDevice -> vkCmdEndDebugUtilsLabel )
2094+ ptDevice -> vkCmdEndDebugUtilsLabel (ptEncoder -> ptCommandBuffer -> tCmdBuffer );
2095+ }
2096+
2097+ void
2098+ pl_push_compute_debug_group (plComputeEncoder * ptEncoder , const char * pcLabel , plVec4 tColor )
2099+ {
2100+ plDevice * ptDevice = ptEncoder -> ptCommandBuffer -> ptDevice ;
2101+
2102+ if (ptDevice -> vkCmdBeginDebugUtilsLabel == NULL )
2103+ return ;
2104+
2105+ VkDebugUtilsLabelEXT tLabel = {
2106+ .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT ,
2107+ .pNext = NULL ,
2108+ .pLabelName = pcLabel ,
2109+ .color = {
2110+ tColor .r ,
2111+ tColor .g ,
2112+ tColor .b ,
2113+ tColor .a
2114+ }
2115+ };
2116+ ptDevice -> vkCmdBeginDebugUtilsLabel (ptEncoder -> ptCommandBuffer -> tCmdBuffer , & tLabel );
2117+ }
2118+
2119+ void
2120+ pl_pop_compute_debug_group (plComputeEncoder * ptEncoder )
2121+ {
2122+ plDevice * ptDevice = ptEncoder -> ptCommandBuffer -> ptDevice ;
2123+ if (ptDevice -> vkCmdEndDebugUtilsLabel )
2124+ ptDevice -> vkCmdEndDebugUtilsLabel (ptEncoder -> ptCommandBuffer -> tCmdBuffer );
2125+ }
2126+
19802127void
19812128pl_begin_command_recording (plCommandBuffer * ptCommandBuffer , const plBeginCommandInfo * ptBeginInfo )
19822129{
@@ -1995,9 +2142,23 @@ pl_begin_command_recording(plCommandBuffer* ptCommandBuffer, const plBeginComman
19952142plRenderEncoder *
19962143pl_begin_render_pass (plCommandBuffer * ptCmdBuffer , plRenderPassHandle tPass , const plPassResources * ptResource )
19972144{
1998- plDevice * ptDevice = ptCmdBuffer -> ptDevice ;
19992145
2146+ plDevice * ptDevice = ptCmdBuffer -> ptDevice ;
20002147 plRenderPass * ptRenderPass = & ptDevice -> sbtRenderPassesCold [tPass .uIndex ];
2148+
2149+ // VkDebugUtilsLabelEXT tLabel = {
2150+ // .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
2151+ // .pNext = NULL,
2152+ // .pLabelName = ptRenderPass->tDesc.pcDebugName,
2153+ // .color[0] = 0.33f,
2154+ // .color[1] = 0.02f,
2155+ // .color[2] = 0.10f,
2156+ // .color[3] = 1.0f
2157+ // };
2158+
2159+ // if(ptDevice->vkCmdBeginDebugUtilsLabel)
2160+ // ptDevice->vkCmdBeginDebugUtilsLabel(ptCmdBuffer->tCmdBuffer, &tLabel);
2161+
20012162 plVulkanRenderPass * ptVulkanRenderPass = & ptDevice -> sbtRenderPassesHot [tPass .uIndex ];
20022163 plRenderPassLayout * ptLayout = & ptDevice -> sbtRenderPassLayoutsCold [ptRenderPass -> tDesc .tLayout .uIndex ];
20032164
@@ -2136,6 +2297,9 @@ pl_end_render_pass(plRenderEncoder* ptEncoder)
21362297 }
21372298 vkCmdEndRenderPass (ptCmdBuffer -> tCmdBuffer );
21382299
2300+ // if(ptDevice->vkCmdEndDebugUtilsLabel)
2301+ // ptDevice->vkCmdEndDebugUtilsLabel(ptCmdBuffer->tCmdBuffer);
2302+
21392303 pl__return_render_encoder (ptEncoder );
21402304}
21412305
@@ -3124,11 +3288,14 @@ pl_create_device(const plDeviceInit* ptInit)
31243288
31253289 if (gptGraphics -> bValidationActive )
31263290 {
3127- ptDevice -> vkDebugMarkerSetObjectTag = (PFN_vkDebugMarkerSetObjectTagEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkDebugMarkerSetObjectTagEXT" );
3291+ ptDevice -> vkDebugMarkerSetObjectTag = (PFN_vkDebugMarkerSetObjectTagEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkDebugMarkerSetObjectTagEXT" );
31283292 ptDevice -> vkDebugMarkerSetObjectName = (PFN_vkDebugMarkerSetObjectNameEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkDebugMarkerSetObjectNameEXT" );
3129- ptDevice -> vkCmdDebugMarkerBegin = (PFN_vkCmdDebugMarkerBeginEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdDebugMarkerBeginEXT" );
3130- ptDevice -> vkCmdDebugMarkerEnd = (PFN_vkCmdDebugMarkerEndEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdDebugMarkerEndEXT" );
3131- ptDevice -> vkCmdDebugMarkerInsert = (PFN_vkCmdDebugMarkerInsertEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdDebugMarkerInsertEXT" );
3293+ ptDevice -> vkCmdDebugMarkerBegin = (PFN_vkCmdDebugMarkerBeginEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdDebugMarkerBeginEXT" );
3294+ ptDevice -> vkCmdDebugMarkerEnd = (PFN_vkCmdDebugMarkerEndEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdDebugMarkerEndEXT" );
3295+ ptDevice -> vkCmdDebugMarkerInsert = (PFN_vkCmdDebugMarkerInsertEXT )vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdDebugMarkerInsertEXT" );
3296+ ptDevice -> vkCmdBeginDebugUtilsLabel = (PFN_vkCmdBeginDebugUtilsLabelEXT ) vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdBeginDebugUtilsLabelEXT" );
3297+ ptDevice -> vkCmdEndDebugUtilsLabel = (PFN_vkCmdEndDebugUtilsLabelEXT ) vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdEndDebugUtilsLabelEXT" );
3298+ ptDevice -> vkCmdInsertDebugUtilsLabel = (PFN_vkCmdInsertDebugUtilsLabelEXT ) vkGetDeviceProcAddr (ptDevice -> tLogicalDevice , "vkCmdInsertDebugUtilsLabelEXT" );
31323299 }
31333300
31343301 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~main descriptor pool~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments