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