Skip to content

Lesson 3 Validation Layers Feedback #256

@ASchuberth

Description

@ASchuberth

I have been going through this tutorial and have some feedback for it.

  1. 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.

  1. 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
}
  1. 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.?

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions