Skip to content

Commit

Permalink
Add note explaining double debug info usage (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleMayes committed Aug 23, 2024
1 parent 318f719 commit 0957546
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tutorial/book/src/setup/validation_layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ if VALIDATION_ENABLED {
}
```

> **Note:** It might seem redundant to use the same debug info with the same severity, type, and callback to both call `create_debug_utils_messenger_ext` *and* add as an extension to the `vk::InstanceCreateInfo` instance. However, these two usages serve different purposes. The usage here (adding the debug info to `vk::InstanceCreateInfo`) sets up debugging _during the creation and destruction of the instance_. Calling `create_debug_utils_messenger_ext` sets up persistent debugging for _everything else_. See the paragraph starting "To capture events that occur while creating or destroying an instance" in the [relevant chapter of the Vulkan specification](https://registry.khronos.org/vulkan/specs/1.3-extensions/html/chap4.html#VkInstanceCreateInfo).
`debug_info` needs to be defined outside of the conditional since it needs to live until we are done calling `create_instance`. Fortunately we can rely on the Rust compiler to protect us from pushing a struct that doesn't live long enough onto a pointer chain due to the lifetimes defined for the `vulkanalia` builders.

Now we should be able to run our program and see logs from our debug callback, but first we'll need to set the `RUST_LOG` environment variable so that `pretty_env_logger` will enable the log levels we are interested in. Initially set the log level to `debug` so we can be sure it is working, here is an example on Windows (PowerShell):
Expand Down

0 comments on commit 0957546

Please sign in to comment.