Skip to content

Commit f5ae024

Browse files
committed
feat: add debug names to vulkan pipelines (v1.1.5)
1 parent 1a6bd38 commit f5ae024

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

docs/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ the API is complete. It just means we won't break what currently exists.
5959
* Draw v1.2.0 (pl_draw_ext.h)
6060
* Draw Backend v1.0.1 (pl_draw_backend_ext.h)
6161
* GPU Allocators v1.0.0 (pl_gpu_allocators_ext.h)
62-
* Graphics v1.1.4 (pl_graphics_ext.h)
62+
* Graphics v1.1.5 (pl_graphics_ext.h)
6363
* Image v1.0.0 (pl_image_ext.h)
6464
* Job v2.0.0 (pl_job_ext.h)
6565
* Atomics v1.0.0 (pl_platform_ext.h)

extensions/pl_graphics_ext.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Index of this file:
114114
// [SECTION] apis
115115
//-----------------------------------------------------------------------------
116116

117-
#define plGraphicsI_version {1, 1, 4}
117+
#define plGraphicsI_version {1, 1, 5}
118118

119119
//-----------------------------------------------------------------------------
120120
// [SECTION] includes
@@ -818,6 +818,7 @@ typedef struct _plComputeShaderDesc
818818
plBindGroupLayoutDesc atBindGroupLayouts[3];
819819
plSpecializationConstant atConstants[PL_MAX_SHADER_SPECIALIZATION_CONSTANTS];
820820
const void* pTempConstantData;
821+
const char* pcDebugName; // default: "unnamed compute shader"
821822

822823
// [INTERNAL]
823824
uint32_t _uConstantCount;
@@ -894,6 +895,7 @@ typedef struct _plShaderDesc
894895
plBindGroupLayoutDesc atBindGroupLayouts[3];
895896
plRenderPassLayoutHandle tRenderPassLayout;
896897
plSampleCount tMSAASampleCount;
898+
const char* pcDebugName; // default: "unnamed shader"
897899

898900
// [INTERNAL]
899901
uint32_t _uConstantCount;

extensions/pl_graphics_vulkan.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,9 @@ pl_create_compute_shader(plDevice* ptDevice, const plComputeShaderDesc* ptDescri
13561356
plComputeShaderHandle tHandle = pl__get_new_compute_shader_handle(ptDevice);
13571357
plComputeShader* ptShader = pl__get_compute_shader(ptDevice, tHandle);
13581358
ptShader->tDesc = *ptDescription;
1359+
1360+
if(ptShader->tDesc.pcDebugName == NULL)
1361+
ptShader->tDesc.pcDebugName = "unnamed compute shader";
13591362

13601363
plVulkanComputeShader* ptVulkanShader = &ptDevice->sbtComputeShadersHot[tHandle.uIndex];
13611364

@@ -1437,7 +1440,7 @@ pl_create_compute_shader(plDevice* ptDevice, const plComputeShaderDesc* ptDescri
14371440
.stage = tShaderStage
14381441
};
14391442
PL_VULKAN(vkCreateComputePipelines(ptDevice->tLogicalDevice, VK_NULL_HANDLE, 1, &tPipelineCreateInfo, gptGraphics->ptAllocationCallbacks, &ptVulkanShader->tPipeline));
1440-
1443+
pl__set_vulkan_object_name(ptDevice, (uint64_t)ptVulkanShader->tPipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, ptShader->tDesc.pcDebugName);
14411444
return tHandle;
14421445
}
14431446

@@ -1449,6 +1452,9 @@ pl_create_shader(plDevice* ptDevice, const plShaderDesc* ptDescription)
14491452
ptShader->tDesc = *ptDescription;
14501453
uint32_t uStageCount = 1;
14511454

1455+
if(ptShader->tDesc.pcDebugName == NULL)
1456+
ptShader->tDesc.pcDebugName = "unnamed shader";
1457+
14521458
plVulkanShader* ptVulkanShader = &ptDevice->sbtShadersHot[tHandle.uIndex];
14531459

14541460
// TODO: handle these properly
@@ -1705,6 +1711,7 @@ pl_create_shader(plDevice* ptDevice, const plShaderDesc* ptDescription)
17051711
};
17061712

17071713
PL_VULKAN(vkCreateGraphicsPipelines(ptDevice->tLogicalDevice, VK_NULL_HANDLE, 1, &tPipelineInfo, gptGraphics->ptAllocationCallbacks, &tVulkanShader.tPipeline));
1714+
pl__set_vulkan_object_name(ptDevice, (uint64_t)tVulkanShader.tPipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, ptShader->tDesc.pcDebugName);
17081715
ptVulkanShader->tPipeline = tVulkanShader.tPipeline;
17091716
ptVulkanShader->tPipelineLayout = tVulkanShader.tPipelineLayout;
17101717
return tHandle;

0 commit comments

Comments
 (0)