I have been going through this tutorial and have some feedback for it.
- In the section "Using validation layers", there is this code snippet:
vk::InstanceCreateInfo createInfo{
.pApplicationInfo = &appInfo,
.enabledLayerCount = static_cast<uint32_t>(requiredLayers.size()),
.ppEnabledLayerNames = requiredLayers.data(),
.enabledExtensionCount = 0,
.ppEnabledExtensionNames = nullptr };
The enabledExtensionCount and ppEnabledExtensionNames have been changed to 0 and nullptr, respectively, from the previous lesson.
This caused some confusion, so I would suggest the following:
vk::InstanceCreateInfo createInfo{
.pApplicationInfo = &appInfo,
.enabledLayerCount = static_cast<uint32_t>(requiredLayers.size()),
.ppEnabledLayerNames = requiredLayers.data(),
+ .enabledExtensionCount = glfwExtensionCount,
+ .ppEnabledExtensionNames = glfwExtensions };
And/or add an explanation that enabledExtensionCount and ppEnabledExtensionNames will be updated later in the lesson.
- The debugCallback() parameter is named
severity, but in the snippet showing you can compare this enumeration, the parameter
is named messageSeverity. I suggest changing it to severity to match the function argument.
+if (severity >= vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning) {
// Message is important enough to show
}
- The final code at the end,
debugCallback() does a comparison on the severity parameter to only show warnings and error messages.
I suggest adding another snippet with this change with an explanation to make it more clear.
static VKAPI_ATTR vk::Bool32 VKAPI_CALL debugCallback(vk::DebugUtilsMessageSeverityFlagBitsEXT severity, vk::DebugUtilsMessageTypeFlagsEXT type, const vk::DebugUtilsMessengerCallbackDataEXT *pCallbackData, void *)
{
if (severity == vk::DebugUtilsMessageSeverityFlagBitsEXT::eError || severity == vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning)
{
std::cerr << "validation layer: type " << to_string(type) << " msg: " << pCallbackData->pMessage << std::endl;
}
return vk::False;
}
Also, is it possibly to just have the comparison be severity >= vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning like the snippet I show in 2.?
- Is it possible to add line highlighting in the code snippets for lines that have been added/changed? I see that asciidoc has this capability. It was hard for me to initially see what had changed in the last code snippet of
createInstance() in this lesson and some others.
This would make it easier to follow, I believe.
I have been going through this tutorial and have some feedback for it.
vk::InstanceCreateInfo createInfo{ .pApplicationInfo = &appInfo, .enabledLayerCount = static_cast<uint32_t>(requiredLayers.size()), .ppEnabledLayerNames = requiredLayers.data(), .enabledExtensionCount = 0, .ppEnabledExtensionNames = nullptr };The
enabledExtensionCountandppEnabledExtensionNameshave been changed to 0 and nullptr, respectively, from the previous lesson.This caused some confusion, so I would suggest the following:
vk::InstanceCreateInfo createInfo{ .pApplicationInfo = &appInfo, .enabledLayerCount = static_cast<uint32_t>(requiredLayers.size()), .ppEnabledLayerNames = requiredLayers.data(), + .enabledExtensionCount = glfwExtensionCount, + .ppEnabledExtensionNames = glfwExtensions };And/or add an explanation that
enabledExtensionCountandppEnabledExtensionNameswill be updated later in the lesson.severity, but in the snippet showing you can compare this enumeration, the parameteris named
messageSeverity. I suggest changing it toseverityto match the function argument.+if (severity >= vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning) { // Message is important enough to show }debugCallback()does a comparison on the severity parameter to only show warnings and error messages.I suggest adding another snippet with this change with an explanation to make it more clear.
Also, is it possibly to just have the comparison be
severity >= vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarninglike the snippet I show in 2.?createInstance()in this lesson and some others.This would make it easier to follow, I believe.