You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/03_Drawing_a_triangle/00_Setup/02_Validation_layers.md
+14-16Lines changed: 14 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -332,21 +332,13 @@ The second to last parameter is again the optional allocator callback that we
332
332
set to `nullptr`, other than that the parameters are fairly straightforward.
333
333
Since the debug messenger is specific to our Vulkan instance and its layers, it
334
334
needs to be explicitly specified as first argument. You will also see this
335
-
pattern with other *child* objects later on. Let's see if it works... Run the
336
-
program and close the window once you're fed up with staring at the blank
337
-
window. You'll see that the following messages are printed to the command prompt:
335
+
pattern with other *child* objects later on.
338
336
339
-

340
-
341
-
>If you don't see any messages then [check your installation](https://vulkan.lunarg.com/doc/view/1.1.106.0/windows/getting_started.html#user-content-verify-the-installation).
342
-
343
-
Oops, it has already spotted a bug in our program! The
344
-
`VkDebugUtilsMessengerEXT` object needs to be cleaned up with a call to
337
+
The `VkDebugUtilsMessengerEXT` object also needs to be cleaned up with a call to
345
338
`vkDestroyDebugUtilsMessengerEXT`. Similarly to `vkCreateDebugUtilsMessengerEXT`
346
-
the function needs to be explicitly loaded. Note that it is normal for this message to be printed multiple times. This happens because multiple validation layers check for the deletion of the debug messenger.
339
+
the function needs to be explicitly loaded.
347
340
348
-
Create another proxy function right
349
-
below `CreateDebugUtilsMessengerEXT`:
341
+
Create another proxy function right below `CreateDebugUtilsMessengerEXT`:
When you run the program again you'll see that the error message has
378
-
disappeared. If you want to see which call triggered a message, you can add a
379
-
breakpoint to the message callback and look at the stack trace.
380
-
381
369
## Debugging instance creation and destruction
382
370
383
371
Although we've now added debugging with validation layers to the program we're not covering everything quite yet. The `vkCreateDebugUtilsMessengerEXT` call requires a valid instance to have been created and `vkDestroyDebugUtilsMessengerEXT` must be called before the instance is destroyed. This currently leaves us unable to debug any issues in the `vkCreateInstance` and `vkDestroyInstance` calls.
@@ -440,6 +428,16 @@ void createInstance() {
440
428
441
429
The `debugCreateInfo` variable is placed outside the if statement to ensure that it is not destroyed before the `vkCreateInstance` call. By creating an additional debug messenger this way it will automatically be used during `vkCreateInstance` and `vkDestroyInstance` and cleaned up after that.
442
430
431
+
## Testing
432
+
433
+
Now let's intentionally make a mistake to see the validation layers in action. Temporarily remove the call to `DestroyDebugUtilsMessengerEXT` in the `cleanup` function and run your program. Once it exits you should see something like this:
434
+
435
+

436
+
437
+
>If you don't see any messages then [check your installation](https://vulkan.lunarg.com/doc/view/1.2.131.1/windows/getting_started.html#user-content-verify-the-installation).
438
+
439
+
If you want to see which call triggered a message, you can add a breakpoint to the message callback and look at the stack trace.
440
+
443
441
## Configuration
444
442
445
443
There are a lot more settings for the behavior of validation layers than just
0 commit comments