vulkan: implement VK_EXT_debug_marker
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32722>
This commit is contained in:
Sid Pranjale 2026-05-29 12:39:04 +02:00 committed by Marge Bot
parent d55418dae7
commit 020a6bc282
15 changed files with 95 additions and 3 deletions

View file

@ -615,7 +615,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_conservative_rasterization DONE (anv, nvk, panvk/v11+, radv, vn, tu/a7xx+)
VK_EXT_custom_border_color DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_EXT_custom_resolve DONE (radv, tu)
VK_EXT_debug_marker DONE (radv)
VK_EXT_debug_marker DONE (anv, dzn, hasvk, hk, kk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_EXT_debug_report DONE (anv, dzn, hasvk, hk, kk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_EXT_debug_utils DONE (anv, dzn, hasvk, hk, kk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_EXT_depth_bias_control DONE (anv, hk, lvp, nvk, panvk, radv, vn)

View file

@ -20,3 +20,4 @@ VK_KHR_shader_fma on nvk
Support for G1-Ultra, G1-Premium and G1-Pro GPUs on Panfrost and PanVK
VK_EXT_shader_atomic_float on nvk
VK_{KHR,EXT}_index_type_uint8 on pvr
VK_EXT_debug_marker in vulkan runtime

View file

@ -147,6 +147,7 @@ hk_get_device_extensions(const struct hk_instance *instance,
.EXT_conditional_rendering = false,
.EXT_color_write_enable = true,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_bias_control = true,
.EXT_depth_clip_control = false,
.EXT_depth_clip_enable = true,

View file

@ -219,6 +219,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
.EXT_border_color_swizzle = true,
.EXT_color_write_enable = true,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_clamp_zero_one = device->devinfo.ver >= 71,
.EXT_depth_clip_control = true,
.EXT_depth_clip_enable = device->devinfo.ver >= 71,

View file

@ -273,6 +273,7 @@ get_device_extensions(const struct tu_physical_device *device,
.EXT_conservative_rasterization = device->info->chip >= 7,
.EXT_custom_border_color = true,
.EXT_custom_resolve = true,
.EXT_debug_marker = true,
.EXT_depth_clamp_control = true,
.EXT_depth_clamp_zero_one = true,
.EXT_depth_clip_control = true,

View file

@ -233,6 +233,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported =
.EXT_calibrated_timestamps = true,
.EXT_color_write_enable = true,
.EXT_conditional_rendering = true,
.EXT_debug_marker = true,
.EXT_depth_bias_control = true,
.EXT_depth_clip_enable = true,
.EXT_depth_clip_control = true,

View file

@ -179,6 +179,7 @@ static void pvr_physical_device_get_supported_extensions(
.EXT_border_color_swizzle = true,
.EXT_color_write_enable = true,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_clamp_zero_one = true,
.EXT_depth_clip_enable = true,
.EXT_image_drm_format_modifier = true,

View file

@ -288,6 +288,7 @@ get_device_extensions(const struct anv_physical_device *device,
*/
.EXT_conservative_rasterization = device->info.platform != INTEL_PLATFORM_SKL,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_bias_control = true,
.EXT_depth_clamp_control = true,
.EXT_depth_clamp_zero_one = true,

View file

@ -280,6 +280,7 @@ get_device_extensions(const struct anv_physical_device *device,
.EXT_color_write_enable = true,
.EXT_conditional_rendering = device->info.verx10 >= 75,
.EXT_custom_border_color = device->info.ver >= 8,
.EXT_debug_marker = true,
.EXT_depth_clamp_zero_one = true,
.EXT_depth_clamp_control = true,
.EXT_depth_clip_control = true,

View file

@ -158,6 +158,7 @@ kk_get_device_extensions(const struct kk_instance *instance,
.EXT_attachment_feedback_loop_dynamic_state = true,
.EXT_calibrated_timestamps = true,
.EXT_conditional_rendering = true,
.EXT_debug_marker = true,
.EXT_depth_clip_control = true,
.EXT_extended_dynamic_state3 = true,
.EXT_external_memory_metal = true,

View file

@ -145,6 +145,7 @@ dzn_physical_device_get_extensions(struct dzn_physical_device *pdev)
.KHR_timeline_semaphore = true,
.KHR_uniform_buffer_standard_layout = true,
.EXT_buffer_device_address = pdev->shader_model >= D3D_SHADER_MODEL_6_6,
.EXT_debug_marker = true,
.EXT_descriptor_indexing = pdev->shader_model >= D3D_SHADER_MODEL_6_6,
#if defined(_WIN32)
.EXT_external_memory_host = pdev->dev13,

View file

@ -220,6 +220,7 @@ nvk_get_device_extensions(const struct nvk_instance *instance,
.EXT_conservative_rasterization = info->cls_eng3d >= MAXWELL_B,
.EXT_color_write_enable = true,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_bias_control = true,
.EXT_depth_clamp_control = true,
.EXT_depth_clamp_zero_one = true,

View file

@ -141,6 +141,7 @@ panvk_per_arch(get_physical_device_extensions)(
.EXT_color_write_enable = true,
.EXT_conservative_rasterization = PAN_ARCH >= 11,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_bias_control = true,
.EXT_depth_clamp_control = true,
.EXT_depth_clamp_zero_one = true,

View file

@ -1406,6 +1406,7 @@ vn_physical_device_get_passthrough_extensions(
.EXT_conditional_rendering = true,
.EXT_conservative_rasterization = true,
.EXT_custom_border_color = true,
.EXT_debug_marker = true,
.EXT_depth_bias_control = true,
.EXT_depth_clamp_control = true,
.EXT_depth_clamp_zero_one = true,

View file

@ -33,6 +33,7 @@
#include "stdarg.h"
#include "util/u_dynarray.h"
#include "util/u_printf.h"
#include "vulkan/vulkan_core.h"
void
vk_debug_message(struct vk_instance *instance,
@ -261,8 +262,6 @@ vk_common_DebugMarkerSetObjectNameEXT(
{
VK_FROM_HANDLE(vk_device, device, _device);
assert(pNameInfo->sType == VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT);
VkObjectType object_type;
switch (pNameInfo->objectType) {
case VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT:
@ -298,6 +297,50 @@ vk_common_DebugMarkerSetObjectNameEXT(
return device->dispatch_table.SetDebugUtilsObjectNameEXT(_device, &name_info);
}
VKAPI_ATTR VkResult VKAPI_CALL
vk_common_DebugMarkerSetObjectTagEXT(
VkDevice _device,
const VkDebugMarkerObjectTagInfoEXT *pTagInfo)
{
VK_FROM_HANDLE(vk_device, device, _device);
VkObjectType object_type;
switch (pTagInfo->objectType) {
case VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT:
object_type = VK_OBJECT_TYPE_SURFACE_KHR;
break;
case VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT:
object_type = VK_OBJECT_TYPE_SWAPCHAIN_KHR;
break;
case VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT:
object_type = VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT;
break;
case VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT:
object_type = VK_OBJECT_TYPE_DISPLAY_KHR;
break;
case VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT:
object_type = VK_OBJECT_TYPE_DISPLAY_MODE_KHR;
break;
case VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT:
object_type = VK_OBJECT_TYPE_VALIDATION_CACHE_EXT;
break;
default:
object_type = (VkObjectType)pTagInfo->objectType;
break;
}
VkDebugUtilsObjectTagInfoEXT tag_info = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.objectType = object_type,
.objectHandle = pTagInfo->object,
.tagName = pTagInfo->tagName,
.tagSize = pTagInfo->tagSize,
.pTag = pTagInfo->pTag
};
return device->dispatch_table.SetDebugUtilsObjectTagEXT(_device, &tag_info);
}
VKAPI_ATTR VkResult VKAPI_CALL
vk_common_SetDebugUtilsObjectNameEXT(
VkDevice _device,
@ -433,6 +476,42 @@ vk_common_CmdInsertDebugUtilsLabelEXT(
command_buffer->region_begin = false;
}
VKAPI_ATTR void VKAPI_CALL
vk_common_CmdDebugMarkerBeginEXT(
VkCommandBuffer _commandBuffer,
const VkDebugMarkerMarkerInfoEXT *pMarkerInfo)
{
VkDebugUtilsLabelEXT label_info = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pNext = pMarkerInfo->pNext,
.pLabelName = pMarkerInfo->pMarkerName,
};
memcpy(label_info.color, pMarkerInfo->color, sizeof(label_info.color));
vk_common_CmdBeginDebugUtilsLabelEXT(_commandBuffer, &label_info);
}
VKAPI_ATTR void VKAPI_CALL
vk_common_CmdDebugMarkerEndEXT(VkCommandBuffer _commandBuffer)
{
vk_common_CmdEndDebugUtilsLabelEXT(_commandBuffer);
}
VKAPI_ATTR void VKAPI_CALL
vk_common_CmdDebugMarkerInsertEXT(
VkCommandBuffer _commandBuffer,
const VkDebugMarkerMarkerInfoEXT *pMarkerInfo)
{
VkDebugUtilsLabelEXT label_info = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pNext = pMarkerInfo->pNext,
.pLabelName = pMarkerInfo->pMarkerName,
};
memcpy(label_info.color, pMarkerInfo->color, sizeof(label_info.color));
vk_common_CmdInsertDebugUtilsLabelEXT(_commandBuffer, &label_info);
}
void
vk_queue_begin_debug_utils_label(struct vk_queue *queue,
const VkDebugUtilsLabelEXT *pLabelInfo)