1// Copyright 2018-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[debugging-debug-utils]] 6== Debug Utilities 7 8Vulkan provides flexible debugging utilities for debugging an application. 9 10The <<debugging-object-debug-annotation,Object Debug Annotation>> section 11describes how to associate either a name or binary data with a specific 12Vulkan object. 13 14The <<debugging-queue-labels,Queue Labels>> section describes how to 15annotate and group the work submitted to a queue. 16 17The <<debugging-command-buffer-labels,Command Buffer Labels>> section 18describes how to associate logical elements of the scene with commands in a 19slink:VkCommandBuffer. 20 21The <<debugging-debug-messengers,Debug Messengers>> section describes how to 22create debug messenger objects associated with an application supplied 23callback to capture debug messages from a variety of Vulkan components. 24 25 26[[debugging-object-debug-annotation]] 27=== Object Debug Annotation 28 29It can be useful for an application to provide its own content relative to a 30specific Vulkan object. 31The following commands allow application developers to associate 32user-defined information with Vulkan objects. 33 34 35[[debugging-object-naming]] 36==== Object Naming 37 38An object can be provided a user-defined name by calling 39fname:vkSetDebugUtilsObjectNameEXT as defined below. 40 41[open,refpage='vkSetDebugUtilsObjectNameEXT',desc='Give a user-friendly name to an object',type='protos'] 42-- 43include::{generated}/api/protos/vkSetDebugUtilsObjectNameEXT.adoc[] 44 45 * pname:device is the device that created the object. 46 * pname:pNameInfo is a pointer to a slink:VkDebugUtilsObjectNameInfoEXT 47 structure specifying parameters of the name to set on the object. 48 49.Valid Usage 50**** 51 * [[VUID-vkSetDebugUtilsObjectNameEXT-pNameInfo-02587]] 52 pname:pNameInfo->objectType must: not be ename:VK_OBJECT_TYPE_UNKNOWN 53 * [[VUID-vkSetDebugUtilsObjectNameEXT-pNameInfo-02588]] 54 pname:pNameInfo->objectHandle must: not be dlink:VK_NULL_HANDLE 55**** 56 57include::{generated}/validity/protos/vkSetDebugUtilsObjectNameEXT.adoc[] 58-- 59 60[open,refpage='VkDebugUtilsObjectNameInfoEXT',desc='Specify parameters of a name to give to an object',type='structs'] 61-- 62The sname:VkDebugUtilsObjectNameInfoEXT structure is defined as: 63 64include::{generated}/api/structs/VkDebugUtilsObjectNameInfoEXT.adoc[] 65 66 * pname:sType is the type of this structure. 67 * pname:pNext is `NULL` or a pointer to a structure extending this 68 structure. 69 * pname:objectType is a elink:VkObjectType specifying the type of the 70 object to be named. 71 * pname:objectHandle is the object to be named. 72 * pname:pObjectName is either `NULL` or a null-terminated UTF-8 string 73 specifying the name to apply to pname:objectHandle. 74 75Applications may: change the name associated with an object simply by 76calling fname:vkSetDebugUtilsObjectNameEXT again with a new string. 77If pname:pObjectName is either `NULL` or an empty string, then any 78previously set name is removed. 79 80ifdef::VK_EXT_graphics_pipeline_library[] 81The <<features-graphicsPipelineLibrary, pname:graphicsPipelineLibrary>> 82feature allows the specification of pipelines without the creation of 83slink:VkShaderModule objects beforehand. 84In order to continue to allow naming these shaders independently, 85sname:VkDebugUtilsObjectNameInfoEXT can: be included in the pname:pNext 86chain of slink:VkPipelineShaderStageCreateInfo, which associates a static 87name with that particular shader. 88endif::VK_EXT_graphics_pipeline_library[] 89 90.Valid Usage 91**** 92 * [[VUID-VkDebugUtilsObjectNameInfoEXT-objectType-02589]] 93 If pname:objectType is ename:VK_OBJECT_TYPE_UNKNOWN, pname:objectHandle 94 must: not be dlink:VK_NULL_HANDLE 95 * [[VUID-VkDebugUtilsObjectNameInfoEXT-objectType-02590]] 96 If pname:objectType is not ename:VK_OBJECT_TYPE_UNKNOWN, 97 pname:objectHandle must: be dlink:VK_NULL_HANDLE or a valid Vulkan 98 handle of the type associated with pname:objectType as defined in the 99 <<debugging-object-types, `VkObjectType` and Vulkan Handle 100 Relationship>> table 101**** 102 103include::{generated}/validity/structs/VkDebugUtilsObjectNameInfoEXT.adoc[] 104-- 105 106 107[[debugging-object-data-association]] 108==== Object Data Association 109 110In addition to setting a name for an object, debugging and validation layers 111may: have uses for additional binary data on a per-object basis that have no 112other place in the Vulkan API. 113 114For example, a sname:VkShaderModule could have additional debugging data 115attached to it to aid in offline shader tracing. 116 117Additional data can be attached to an object by calling 118fname:vkSetDebugUtilsObjectTagEXT as defined below. 119 120[open,refpage='vkSetDebugUtilsObjectTagEXT',desc='Attach arbitrary data to an object',type='protos'] 121-- 122include::{generated}/api/protos/vkSetDebugUtilsObjectTagEXT.adoc[] 123 124 * pname:device is the device that created the object. 125 * pname:pTagInfo is a pointer to a slink:VkDebugUtilsObjectTagInfoEXT 126 structure specifying parameters of the tag to attach to the object. 127 128include::{generated}/validity/protos/vkSetDebugUtilsObjectTagEXT.adoc[] 129-- 130 131[open,refpage='VkDebugUtilsObjectTagInfoEXT',desc='Specify parameters of a tag to attach to an object',type='structs'] 132-- 133The sname:VkDebugUtilsObjectTagInfoEXT structure is defined as: 134 135include::{generated}/api/structs/VkDebugUtilsObjectTagInfoEXT.adoc[] 136 137 * pname:sType is the type of this structure. 138 * pname:pNext is `NULL` or a pointer to a structure extending this 139 structure. 140 * pname:objectType is a elink:VkObjectType specifying the type of the 141 object to be named. 142 * pname:objectHandle is the object to be tagged. 143 * pname:tagName is a numerical identifier of the tag. 144 * pname:tagSize is the number of bytes of data to attach to the object. 145 * pname:pTag is a pointer to an array of pname:tagSize bytes containing 146 the data to be associated with the object. 147 148The pname:tagName parameter gives a name or identifier to the type of data 149being tagged. 150This can be used by debugging layers to easily filter for only data that can 151be used by that implementation. 152 153.Valid Usage 154**** 155 * [[VUID-VkDebugUtilsObjectTagInfoEXT-objectType-01908]] 156 pname:objectType must: not be ename:VK_OBJECT_TYPE_UNKNOWN 157 * [[VUID-VkDebugUtilsObjectTagInfoEXT-objectHandle-01910]] 158 pname:objectHandle must: be a valid Vulkan handle of the type associated 159 with pname:objectType as defined in the <<debugging-object-types, 160 `VkObjectType` and Vulkan Handle Relationship>> table 161**** 162 163include::{generated}/validity/structs/VkDebugUtilsObjectTagInfoEXT.adoc[] 164-- 165 166 167[[debugging-queue-labels]] 168=== Queue Labels 169 170All Vulkan work must be submitted using queues. 171It is possible for an application to use multiple queues, each containing 172multiple command buffers, when performing work. 173It can be useful to identify which queue, or even where in a queue, 174something has occurred. 175 176To begin identifying a region using a debug label inside a queue, you may 177use the flink:vkQueueBeginDebugUtilsLabelEXT command. 178 179Then, when the region of interest has passed, you may end the label region 180using flink:vkQueueEndDebugUtilsLabelEXT. 181 182Additionally, a single debug label may be inserted at any time using 183flink:vkQueueInsertDebugUtilsLabelEXT. 184 185[open,refpage='vkQueueBeginDebugUtilsLabelEXT',desc='Open a queue debug label region',type='protos'] 186-- 187A queue debug label region is opened by calling: 188 189include::{generated}/api/protos/vkQueueBeginDebugUtilsLabelEXT.adoc[] 190 191 * pname:queue is the queue in which to start a debug label region. 192 * pname:pLabelInfo is a pointer to a slink:VkDebugUtilsLabelEXT structure 193 specifying parameters of the label region to open. 194 195include::{generated}/validity/protos/vkQueueBeginDebugUtilsLabelEXT.adoc[] 196-- 197 198[open,refpage='VkDebugUtilsLabelEXT',desc='Specify parameters of a label region',type='structs'] 199-- 200The sname:VkDebugUtilsLabelEXT structure is defined as: 201 202include::{generated}/api/structs/VkDebugUtilsLabelEXT.adoc[] 203 204 * pname:sType is the type of this structure. 205 * pname:pNext is `NULL` or a pointer to a structure extending this 206 structure. 207 * pname:pLabelName is a pointer to a null-terminated UTF-8 string 208 containing the name of the label. 209 * pname:color is an optional RGBA color value that can be associated with 210 the label. 211 A particular implementation may: choose to ignore this color value. 212 The values contain RGBA values in order, in the range 0.0 to 1.0. 213 If all elements in pname:color are set to 0.0 then it is ignored. 214 215include::{generated}/validity/structs/VkDebugUtilsLabelEXT.adoc[] 216-- 217 218[open,refpage='vkQueueEndDebugUtilsLabelEXT',desc='Close a queue debug label region',type='protos'] 219-- 220A queue debug label region is closed by calling: 221 222include::{generated}/api/protos/vkQueueEndDebugUtilsLabelEXT.adoc[] 223 224 * pname:queue is the queue in which a debug label region should be closed. 225 226The calls to flink:vkQueueBeginDebugUtilsLabelEXT and 227flink:vkQueueEndDebugUtilsLabelEXT must: be matched and balanced. 228 229.Valid Usage 230**** 231 * [[VUID-vkQueueEndDebugUtilsLabelEXT-None-01911]] 232 There must: be an outstanding fname:vkQueueBeginDebugUtilsLabelEXT 233 command prior to the fname:vkQueueEndDebugUtilsLabelEXT on the queue 234**** 235 236include::{generated}/validity/protos/vkQueueEndDebugUtilsLabelEXT.adoc[] 237-- 238 239[open,refpage='vkQueueInsertDebugUtilsLabelEXT',desc='Insert a label into a queue',type='protos'] 240-- 241A single label can be inserted into a queue by calling: 242 243include::{generated}/api/protos/vkQueueInsertDebugUtilsLabelEXT.adoc[] 244 245 * pname:queue is the queue into which a debug label will be inserted. 246 * pname:pLabelInfo is a pointer to a slink:VkDebugUtilsLabelEXT structure 247 specifying parameters of the label to insert. 248 249include::{generated}/validity/protos/vkQueueInsertDebugUtilsLabelEXT.adoc[] 250-- 251 252 253[[debugging-command-buffer-labels]] 254=== Command Buffer Labels 255 256Typical Vulkan applications will submit many command buffers in each frame, 257with each command buffer containing a large number of individual commands. 258Being able to logically annotate regions of command buffers that belong 259together as well as hierarchically subdivide the frame is important to a 260developer's ability to navigate the commands viewed holistically. 261 262To identify the beginning of a debug label region in a command buffer, 263flink:vkCmdBeginDebugUtilsLabelEXT can: be used as defined below. 264 265To indicate the end of a debug label region in a command buffer, 266flink:vkCmdEndDebugUtilsLabelEXT can: be used. 267 268To insert a single command buffer debug label inside of a command buffer, 269flink:vkCmdInsertDebugUtilsLabelEXT can: be used as defined below. 270 271[open,refpage='vkCmdBeginDebugUtilsLabelEXT',desc='Open a command buffer debug label region',type='protos'] 272-- 273A command buffer debug label region can be opened by calling: 274 275include::{generated}/api/protos/vkCmdBeginDebugUtilsLabelEXT.adoc[] 276 277 * pname:commandBuffer is the command buffer into which the command is 278 recorded. 279 * pname:pLabelInfo is a pointer to a slink:VkDebugUtilsLabelEXT structure 280 specifying parameters of the label region to open. 281 282include::{generated}/validity/protos/vkCmdBeginDebugUtilsLabelEXT.adoc[] 283-- 284 285[open,refpage='vkCmdEndDebugUtilsLabelEXT',desc='Close a command buffer label region',type='protos'] 286-- 287A command buffer label region can be closed by calling: 288 289include::{generated}/api/protos/vkCmdEndDebugUtilsLabelEXT.adoc[] 290 291 * pname:commandBuffer is the command buffer into which the command is 292 recorded. 293 294An application may: open a debug label region in one command buffer and 295close it in another, or otherwise split debug label regions across multiple 296command buffers or multiple queue submissions. 297When viewed from the linear series of submissions to a single queue, the 298calls to flink:vkCmdBeginDebugUtilsLabelEXT and 299flink:vkCmdEndDebugUtilsLabelEXT must: be matched and balanced. 300 301There can: be problems reporting command buffer debug labels during the 302recording process because command buffers may: be recorded out of sequence 303with the resulting execution order. 304Since the recording order may: be different, a solitary command buffer may: 305have an inconsistent view of the debug label regions by itself. 306Therefore, if an issue occurs during the recording of a command buffer, and 307the environment requires returning debug labels, the implementation may: 308return only those labels it is aware of. 309This is true even if the implementation is aware of only the debug labels 310within the command buffer being actively recorded. 311 312 313.Valid Usage 314**** 315 * [[VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912]] 316 There must: be an outstanding fname:vkCmdBeginDebugUtilsLabelEXT command 317 prior to the fname:vkCmdEndDebugUtilsLabelEXT on the queue that 318 pname:commandBuffer is submitted to 319 * [[VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01913]] 320 If pname:commandBuffer is a secondary command buffer, there must: be an 321 outstanding fname:vkCmdBeginDebugUtilsLabelEXT command recorded to 322 pname:commandBuffer that has not previously been ended by a call to 323 fname:vkCmdEndDebugUtilsLabelEXT 324**** 325 326include::{generated}/validity/protos/vkCmdEndDebugUtilsLabelEXT.adoc[] 327-- 328 329[open,refpage='vkCmdInsertDebugUtilsLabelEXT',desc='Insert a label into a command buffer',type='protos'] 330-- 331A single debug label can be inserted into a command buffer by calling: 332 333include::{generated}/api/protos/vkCmdInsertDebugUtilsLabelEXT.adoc[] 334 335 * pname:commandBuffer is the command buffer into which the command is 336 recorded. 337 * pname:pInfo is a pointer to a slink:VkDebugUtilsLabelEXT structure 338 specifying parameters of the label to insert. 339 340include::{generated}/validity/protos/vkCmdInsertDebugUtilsLabelEXT.adoc[] 341-- 342 343 344[[debugging-debug-messengers]] 345=== Debug Messengers 346 347Vulkan allows an application to register multiple callbacks with any Vulkan 348component wishing to report debug information. 349Some callbacks may log the information to a file, others may cause a debug 350break point or other application defined behavior. 351A primary producer of callback messages are the validation layers. 352An application can: register callbacks even when no validation layers are 353enabled, but they will only be called for the Vulkan loader and, if 354implemented, other layer and driver events. 355 356[open,refpage='VkDebugUtilsMessengerEXT',desc='Opaque handle to a debug messenger object',type='handles'] 357-- 358A sname:VkDebugUtilsMessengerEXT is a messenger object which handles passing 359along debug messages to a provided debug callback. 360 361include::{generated}/api/handles/VkDebugUtilsMessengerEXT.adoc[] 362 363The debug messenger will provide detailed feedback on the application's use 364of Vulkan when events of interest occur. 365When an event of interest does occur, the debug messenger will submit a 366debug message to the debug callback that was provided during its creation. 367Additionally, the debug messenger is responsible with filtering out debug 368messages that the callback is not interested in and will only provide 369desired debug messages. 370-- 371 372[open,refpage='vkCreateDebugUtilsMessengerEXT',desc='Create a debug messenger object',type='protos'] 373-- 374A debug messenger triggers a debug callback with a debug message when an 375event of interest occurs. 376To create a debug messenger which will trigger a debug callback, call: 377 378include::{generated}/api/protos/vkCreateDebugUtilsMessengerEXT.adoc[] 379 380 * pname:instance is the instance the messenger will be used with. 381 * pname:pCreateInfo is a pointer to a 382 slink:VkDebugUtilsMessengerCreateInfoEXT structure containing the 383 callback pointer, as well as defining conditions under which this 384 messenger will trigger the callback. 385 * pname:pAllocator controls host memory allocation as described in the 386 <<memory-allocation, Memory Allocation>> chapter. 387 * pname:pMessenger is a pointer to a slink:VkDebugUtilsMessengerEXT handle 388 in which the created object is returned. 389 390include::{generated}/validity/protos/vkCreateDebugUtilsMessengerEXT.adoc[] 391 392The application must: ensure that flink:vkCreateDebugUtilsMessengerEXT is 393not executed in parallel with any Vulkan command that is also called with 394pname:instance or child of pname:instance as the dispatchable argument. 395-- 396 397[open,refpage='VkDebugUtilsMessengerCreateInfoEXT',desc='Structure specifying parameters of a newly created debug messenger',type='structs'] 398-- 399The definition of sname:VkDebugUtilsMessengerCreateInfoEXT is: 400 401include::{generated}/api/structs/VkDebugUtilsMessengerCreateInfoEXT.adoc[] 402 403 * pname:sType is the type of this structure. 404 * pname:pNext is `NULL` or a pointer to a structure extending this 405 structure. 406 * pname:flags is `0` and is reserved for future use. 407 * pname:messageSeverity is a bitmask of 408 elink:VkDebugUtilsMessageSeverityFlagBitsEXT specifying which severity 409 of event(s) will cause this callback to be called. 410 * pname:messageType is a bitmask of 411 elink:VkDebugUtilsMessageTypeFlagBitsEXT specifying which type of 412 event(s) will cause this callback to be called. 413 * pname:pfnUserCallback is the application callback function to call. 414 * pname:pUserData is user data to be passed to the callback. 415 416For each sname:VkDebugUtilsMessengerEXT that is created the 417sname:VkDebugUtilsMessengerCreateInfoEXT::pname:messageSeverity and 418sname:VkDebugUtilsMessengerCreateInfoEXT::pname:messageType determine when 419that sname:VkDebugUtilsMessengerCreateInfoEXT::pname:pfnUserCallback is 420called. 421The process to determine if the user's pname:pfnUserCallback is triggered 422when an event occurs is as follows: 423 424 . The implementation will perform a bitwise AND of the event's 425 elink:VkDebugUtilsMessageSeverityFlagBitsEXT with the 426 pname:messageSeverity provided during creation of the 427 slink:VkDebugUtilsMessengerEXT object. 428 .. If the value is 0, the message is skipped. 429 . The implementation will perform bitwise AND of the event's 430 elink:VkDebugUtilsMessageTypeFlagBitsEXT with the pname:messageType 431 provided during the creation of the slink:VkDebugUtilsMessengerEXT 432 object. 433 .. If the value is 0, the message is skipped. 434 . The callback will trigger a debug message for the current event 435 436The callback will come directly from the component that detected the event, 437unless some other layer intercepts the calls for its own purposes (filter 438them in a different way, log to a system error log, etc.). 439 440An application can: receive multiple callbacks if multiple 441sname:VkDebugUtilsMessengerEXT objects are created. 442A callback will always be executed in the same thread as the originating 443Vulkan call. 444 445A callback can: be called from multiple threads simultaneously (if the 446application is making Vulkan calls from multiple threads). 447 448.Valid Usage 449**** 450 * [[VUID-VkDebugUtilsMessengerCreateInfoEXT-pfnUserCallback-01914]] 451 pname:pfnUserCallback must: be a valid 452 tlink:PFN_vkDebugUtilsMessengerCallbackEXT 453**** 454 455include::{generated}/validity/structs/VkDebugUtilsMessengerCreateInfoEXT.adoc[] 456-- 457 458[open,refpage='VkDebugUtilsMessengerCreateFlagsEXT',desc='Reserved for future use',type='flags'] 459-- 460include::{generated}/api/flags/VkDebugUtilsMessengerCreateFlagsEXT.adoc[] 461 462tname:VkDebugUtilsMessengerCreateFlagsEXT is a bitmask type for setting a 463mask, but is currently reserved for future use. 464-- 465 466[open,refpage='VkDebugUtilsMessageSeverityFlagBitsEXT',desc='Bitmask specifying which severities of events cause a debug messenger callback',type='enums'] 467-- 468Bits which can: be set in 469slink:VkDebugUtilsMessengerCreateInfoEXT::pname:messageSeverity, specifying 470event severities which cause a debug messenger to call the callback, are: 471 472include::{generated}/api/enums/VkDebugUtilsMessageSeverityFlagBitsEXT.adoc[] 473 474 * ename:VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT specifies the most 475 verbose output indicating all diagnostic messages from the Vulkan 476 loader, layers, and drivers should be captured. 477 * ename:VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT specifies an 478 informational message such as resource details that may be handy when 479 debugging an application. 480 * ename:VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT specifies use of 481 Vulkan that may: expose an app bug. 482 Such cases may not be immediately harmful, such as a fragment shader 483 outputting to a location with no attachment. 484 Other cases may: point to behavior that is almost certainly bad when 485 unintended such as using an image whose memory has not been filled. 486 In general if you see a warning but you know that the behavior is 487 intended/desired, then simply ignore the warning. 488 * ename:VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT specifies that the 489 application has violated a valid usage condition of the specification. 490 491[NOTE] 492.Note 493==== 494The values of elink:VkDebugUtilsMessageSeverityFlagBitsEXT are sorted based 495on severity. 496The higher the flag value, the more severe the message. 497This allows for simple boolean operation comparisons when looking at 498elink:VkDebugUtilsMessageSeverityFlagBitsEXT values. 499 500For example: 501 502[source,c++] 503~~~~ 504 if (messageSeverity >= VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { 505 // Do something for warnings and errors 506 } 507~~~~ 508 509In addition, space has been left between the enums to allow for later 510addition of new severities in between the existing values. 511==== 512-- 513 514[open,refpage='VkDebugUtilsMessageSeverityFlagsEXT',desc='Bitmask of VkDebugUtilsMessageSeverityFlagBitsEXT',type='flags'] 515-- 516include::{generated}/api/flags/VkDebugUtilsMessageSeverityFlagsEXT.adoc[] 517 518tname:VkDebugUtilsMessageSeverityFlagsEXT is a bitmask type for setting a 519mask of zero or more elink:VkDebugUtilsMessageSeverityFlagBitsEXT. 520-- 521 522[open,refpage='VkDebugUtilsMessageTypeFlagBitsEXT',desc='Bitmask specifying which types of events cause a debug messenger callback',type='enums'] 523-- 524Bits which can: be set in 525slink:VkDebugUtilsMessengerCreateInfoEXT::pname:messageType, specifying 526event types which cause a debug messenger to call the callback, are: 527 528include::{generated}/api/enums/VkDebugUtilsMessageTypeFlagBitsEXT.adoc[] 529 530 * ename:VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT specifies that some 531 general event has occurred. 532 This is typically a non-specification, non-performance event. 533 * ename:VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT specifies that 534 something has occurred during validation against the Vulkan 535 specification that may indicate invalid behavior. 536 * ename:VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT specifies a 537 potentially non-optimal use of Vulkan, e.g. using 538 flink:vkCmdClearColorImage when setting 539 slink:VkAttachmentDescription::pname:loadOp to 540 ename:VK_ATTACHMENT_LOAD_OP_CLEAR would have worked. 541ifdef::VK_EXT_device_address_binding_report[] 542 * ename:VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT 543 specifies that the implementation has modified the set of GPU-visible 544 virtual addresses associated with a Vulkan object. 545endif::VK_EXT_device_address_binding_report[] 546-- 547 548[open,refpage='VkDebugUtilsMessageTypeFlagsEXT',desc='Bitmask of VkDebugUtilsMessageTypeFlagBitsEXT',type='flags'] 549-- 550include::{generated}/api/flags/VkDebugUtilsMessageTypeFlagsEXT.adoc[] 551 552tname:VkDebugUtilsMessageTypeFlagsEXT is a bitmask type for setting a mask 553of zero or more elink:VkDebugUtilsMessageTypeFlagBitsEXT. 554-- 555 556[open,refpage='PFN_vkDebugUtilsMessengerCallbackEXT',desc='Application-defined debug messenger callback function',type='funcpointers'] 557-- 558The prototype for the 559slink:VkDebugUtilsMessengerCreateInfoEXT::pname:pfnUserCallback function 560implemented by the application is: 561 562include::{generated}/api/funcpointers/PFN_vkDebugUtilsMessengerCallbackEXT.adoc[] 563 564 * pname:messageSeverity specifies the 565 elink:VkDebugUtilsMessageSeverityFlagBitsEXT that triggered this 566 callback. 567 * pname:messageTypes is a bitmask of 568 elink:VkDebugUtilsMessageTypeFlagBitsEXT specifying which type of 569 event(s) triggered this callback. 570 * pname:pCallbackData contains all the callback related data in the 571 slink:VkDebugUtilsMessengerCallbackDataEXT structure. 572 * pname:pUserData is the user data provided when the 573 slink:VkDebugUtilsMessengerEXT was created. 574 575The callback returns a basetype:VkBool32, which is interpreted in a 576layer-specified manner. 577The application should: always return ename:VK_FALSE. 578The ename:VK_TRUE value is reserved for use in layer development. 579 580.Valid Usage 581**** 582 * [[VUID-PFN_vkDebugUtilsMessengerCallbackEXT-None-04769]] 583 The callback must: not make calls to any Vulkan commands 584**** 585-- 586 587[open,refpage='VkDebugUtilsMessengerCallbackDataEXT',desc='Structure specifying parameters returned to the callback',type='structs'] 588-- 589The definition of sname:VkDebugUtilsMessengerCallbackDataEXT is: 590 591include::{generated}/api/structs/VkDebugUtilsMessengerCallbackDataEXT.adoc[] 592 593 * pname:sType is the type of this structure. 594 * pname:pNext is `NULL` or a pointer to a structure extending this 595 structure. 596 * pname:flags is `0` and is reserved for future use. 597 * pname:pMessageIdName is a null-terminated string that identifies the 598 particular message ID that is associated with the provided message. 599 If the message corresponds to a validation layer message, then this 600 string may contain the portion of the Vulkan specification that is 601 believed to have been violated. 602 * pname:messageIdNumber is the ID number of the triggering message. 603 If the message corresponds to a validation layer message, then this 604 number is related to the internal number associated with the message 605 being triggered. 606 * pname:pMessage is a null-terminated string detailing the trigger 607 conditions. 608 * pname:queueLabelCount is a count of items contained in the 609 pname:pQueueLabels array. 610 * pname:pQueueLabels is `NULL` or a pointer to an array of 611 slink:VkDebugUtilsLabelEXT active in the current sname:VkQueue at the 612 time the callback was triggered. 613 Refer to <<debugging-queue-labels,Queue Labels>> for more information. 614 * pname:cmdBufLabelCount is a count of items contained in the 615 pname:pCmdBufLabels array. 616 * pname:pCmdBufLabels is `NULL` or a pointer to an array of 617 slink:VkDebugUtilsLabelEXT active in the current sname:VkCommandBuffer 618 at the time the callback was triggered. 619 Refer to <<debugging-command-buffer-labels, Command Buffer Labels>> for 620 more information. 621 * pname:objectCount is a count of items contained in the pname:pObjects 622 array. 623 * pname:pObjects is a pointer to an array of 624 slink:VkDebugUtilsObjectNameInfoEXT objects related to the detected 625 issue. 626 The array is roughly in order or importance, but the 0th element is 627 always guaranteed to be the most important object for this message. 628 629[NOTE] 630.Note 631==== 632This structure should only be considered valid during the lifetime of the 633triggered callback. 634==== 635 636Since adding queue and command buffer labels behaves like pushing and 637popping onto a stack, the order of both pname:pQueueLabels and 638pname:pCmdBufLabels is based on the order the labels were defined. 639The result is that the first label in either pname:pQueueLabels or 640pname:pCmdBufLabels will be the first defined (and therefore the oldest) 641while the last label in each list will be the most recent. 642 643[NOTE] 644.Note 645==== 646pname:pQueueLabels will only be non-`NULL` if one of the objects in 647pname:pObjects can be related directly to a defined sname:VkQueue which has 648had one or more labels associated with it. 649 650Likewise, pname:pCmdBufLabels will only be non-`NULL` if one of the objects 651in pname:pObjects can be related directly to a defined sname:VkCommandBuffer 652which has had one or more labels associated with it. 653Additionally, while command buffer labels allow for beginning and ending 654across different command buffers, the debug messaging framework cannot: 655guarantee that labels in pname:pCmdBufLables will contain those defined 656outside of the associated command buffer. 657This is partially due to the fact that the association of one command buffer 658with another may not have been defined at the time the debug message is 659triggered. 660==== 661 662include::{generated}/validity/structs/VkDebugUtilsMessengerCallbackDataEXT.adoc[] 663-- 664 665[open,refpage='VkDebugUtilsMessengerCallbackDataFlagsEXT',desc='Reserved for future use',type='flags'] 666-- 667include::{generated}/api/flags/VkDebugUtilsMessengerCallbackDataFlagsEXT.adoc[] 668 669tname:VkDebugUtilsMessengerCallbackDataFlagsEXT is a bitmask type for 670setting a mask, but is currently reserved for future use. 671-- 672 673ifdef::VK_EXT_device_address_binding_report[] 674[open,refpage='VkDeviceAddressBindingCallbackDataEXT',desc='Structure specifying parameters returned to the callback',type='structs'] 675-- 676The definition of sname:VkDeviceAddressBindingCallbackDataEXT is: 677 678include::{generated}/api/structs/VkDeviceAddressBindingCallbackDataEXT.adoc[] 679 680 * pname:sType is the type of this structure. 681 * pname:pNext is `NULL` or a pointer to a structure extending this 682 structure. 683 * pname:flags is a bitmask of elink:VkDeviceAddressBindingFlagBitsEXT 684 specifying additional information about the binding event that caused 685 the callback to be called. 686 * pname:baseAddress is a GPU-accessible virtual address identifying the 687 start of a region of the virtual address space associated with a Vulkan 688 object, as identified by the pname:pObjects member of 689 slink:VkDebugUtilsMessengerCallbackDataEXT. 690 * pname:size is the size in bytes of a region of GPU-accessible virtual 691 address space. 692 * pname:bindingType is a elink:VkDeviceAddressBindingTypeEXT specifying 693 the type of binding event that caused the callback to be called. 694 695If the <<features-reportAddressBinding, pname:reportAddressBinding>> feature 696is enabled and the implementation binds or unbinds a region of virtual 697address space associated with a Vulkan object, the implementation must: 698submit a debug message with the following properties: 699 700 * pname:messageSeverity equal to 701 ename:VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT 702 * pname:messageType equal to 703 ename:VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT 704 * sname:VkDebugUtilsMessengerCallbackDataEXT::pname:pObjects must: 705 identify the associated Vulkan object 706 * sname:VkDeviceAddressBindingCallbackDataEXT must: be included in the 707 pname:pNext chain of sname:VkDebugUtilsMessengerCallbackDataEXT 708 709These debug messages must: be emitted both for GPU virtual address space 710regions that are explicitly bound to a Vulkan object via the 711sname:vkBind*Memory/sname:vkBind*Memory2 functions, and for those that are 712implicitly generated via memory allocation or importing external memory. 713 714An implementation may: report binding events associated with a Vulkan object 715via sname:VkDebugUtilsMessengerEXT prior to the object becoming visible to 716an application via other Vulkan commands. 717For example, object creation functions may: report binding events that occur 718during an objects creation. 719In such cases, sname:VkDeviceAddressBindingCallbackDataEXT::pname:flags 720must: include ename:VK_DEVICE_ADDRESS_BINDING_INTERNAL_OBJECT_BIT_EXT. 721 722Object handles reported in this manner are not 723<<fundamentals-validusage-handles, valid object handles>>, and must: not be 724used as an input parameter to any Vulkan command. 725 726Any valid object handle returned by an object creation function must: match 727the handle specified via any previously reported binding events associated 728with the object's creation. 729 730include::{generated}/validity/structs/VkDeviceAddressBindingCallbackDataEXT.adoc[] 731-- 732 733[open,refpage='VkDeviceAddressBindingFlagBitsEXT',desc='Bitmask specifying the additional information about a binding event',type='enums'] 734-- 735Bits which can: be set in 736slink:VkDeviceAddressBindingCallbackDataEXT::pname:flags specifying 737additional information about a binding event are: 738 739include::{generated}/api/enums/VkDeviceAddressBindingFlagBitsEXT.adoc[] 740 741 * ename:VK_DEVICE_ADDRESS_BINDING_INTERNAL_OBJECT_BIT_EXT specifies that 742 slink:VkDeviceAddressBindingCallbackDataEXT describes a Vulkan object 743 that has not been made visible to the application via a Vulkan command. 744-- 745 746[open,refpage='VkDeviceAddressBindingFlagsEXT',desc='Bitmask of VkDeviceAddressBindingFlagBitsEXT',type='flags'] 747-- 748include::{generated}/api/flags/VkDeviceAddressBindingFlagsEXT.adoc[] 749 750tlink:VkDeviceAddressBindingFlagsEXT is a bitmask type for setting a mask of 751zero or more elink:VkDeviceAddressBindingFlagBitsEXT. 752-- 753 754[open,refpage='VkDeviceAddressBindingTypeEXT',desc='Enum describing a change in device address bindings',type='enums'] 755-- 756The ename:VkDeviceAddressBindingTypeEXT enum is defined as: 757 758include::{generated}/api/enums/VkDeviceAddressBindingTypeEXT.adoc[] 759 760 * ename:VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT specifies that a new 761 GPU-accessible virtual address range has been bound. 762 * ename:VK_DEVICE_ADDRESS_BINDING_TYPE_UNBIND_EXT specifies that a 763 GPU-accessible virtual address range has been unbound. 764 765-- 766endif::VK_EXT_device_address_binding_report[] 767 768[open,refpage='vkSubmitDebugUtilsMessageEXT',desc='Inject a message into a debug stream',type='protos'] 769-- 770There may be times that a user wishes to intentionally submit a debug 771message. 772To do this, call: 773 774include::{generated}/api/protos/vkSubmitDebugUtilsMessageEXT.adoc[] 775 776 * pname:instance is the debug stream's slink:VkInstance. 777 * pname:messageSeverity is a elink:VkDebugUtilsMessageSeverityFlagBitsEXT 778 value specifying the severity of this event/message. 779 * pname:messageTypes is a bitmask of 780 elink:VkDebugUtilsMessageTypeFlagBitsEXT specifying which type of 781 event(s) to identify with this message. 782 * pname:pCallbackData contains all the callback related data in the 783 slink:VkDebugUtilsMessengerCallbackDataEXT structure. 784 785The call will propagate through the layers and generate callback(s) as 786indicated by the message's flags. 787The parameters are passed on to the callback in addition to the 788pname:pUserData value that was defined at the time the messenger was 789registered. 790 791.Valid Usage 792**** 793 * [[VUID-vkSubmitDebugUtilsMessageEXT-objectType-02591]] 794 The pname:objectType member of each element of 795 pname:pCallbackData->pObjects must: not be ename:VK_OBJECT_TYPE_UNKNOWN 796**** 797 798include::{generated}/validity/protos/vkSubmitDebugUtilsMessageEXT.adoc[] 799-- 800 801[open,refpage='vkDestroyDebugUtilsMessengerEXT',desc='Destroy a debug messenger object',type='protos'] 802-- 803To destroy a sname:VkDebugUtilsMessengerEXT object, call: 804 805include::{generated}/api/protos/vkDestroyDebugUtilsMessengerEXT.adoc[] 806 807 * pname:instance is the instance where the callback was created. 808 * pname:messenger is the slink:VkDebugUtilsMessengerEXT object to destroy. 809 pname:messenger is an externally synchronized object and must: not be 810 used on more than one thread at a time. 811 This means that fname:vkDestroyDebugUtilsMessengerEXT must: not be 812 called when a callback is active. 813 * pname:pAllocator controls host memory allocation as described in the 814 <<memory-allocation, Memory Allocation>> chapter. 815 816.Valid Usage 817**** 818 * [[VUID-vkDestroyDebugUtilsMessengerEXT-messenger-01915]] 819 If sname:VkAllocationCallbacks were provided when pname:messenger was 820 created, a compatible set of callbacks must: be provided here 821 * [[VUID-vkDestroyDebugUtilsMessengerEXT-messenger-01916]] 822 If no sname:VkAllocationCallbacks were provided when pname:messenger was 823 created, pname:pAllocator must: be `NULL` 824**** 825 826include::{generated}/validity/protos/vkDestroyDebugUtilsMessengerEXT.adoc[] 827 828The application must: ensure that flink:vkDestroyDebugUtilsMessengerEXT is 829not executed in parallel with any Vulkan command that is also called with 830pname:instance or child of pname:instance as the dispatchable argument. 831-- 832 833