Use StructureChainBuilder to create the debug callbacks.#1526
Use StructureChainBuilder to create the debug callbacks.#1526asuessenbach wants to merge 2 commits intoKhronosGroup:mainfrom
Conversation
| void request_layer_settings_impl(std::vector<vk::LayerSettingEXT> &requested_layer_settings, vkb::StructureChainBuilderCpp<vk::InstanceCreateInfo> &scb) const; | ||
| static void set_viewport_and_scissor_impl(vkb::core::CommandBufferCpp const &command_buffer, vk::Extent2D const &extent); | ||
|
|
||
| #if defined(VKB_DEBUG) || defined(VKB_VALIDATION_LAYERS) |
There was a problem hiding this comment.
Not sure if it's a good idea to hide these behind those defines. What about samples like debugprintf that are supposed to work without validation layers (to be used with e.g. RenderDoc)?
There was a problem hiding this comment.
Those two functions hidden by those defines are private helper functions of the VulkanSample class. They are not virtual, and nobody out of this class actually need to know about them.
In contrast to that, extend_instance_create_info and extend_debug_utils_messenger_create_info are protected virtual functions in VulkanSample, not hidden by any defines. The shader_debugprintf sample, for example, overrides them and calls it own local helper function get_debug_utils_messenger_create_info, which is not hidden behind any defines.
| .messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT, | ||
| .pfnUserCallback = debug_utils_message_callback}; | ||
| scb.add_struct(debug_utils_messenger_create_info); | ||
| scb.add_struct(get_debug_utils_messenger_create_info()); |
There was a problem hiding this comment.
Not a fan of this. Samples like this are supposed to explicitly show how to set up things. Moving them to the framework and making things implicit makes it harder to follow and/or adopt such samples.
There was a problem hiding this comment.
Not a fan of this.
What exactly don't you like here?
The usage of the StructureChainBuilder to ease structure chaining? Or the use of a local helper function to get the very same VkDebugUtilsMessengerCreateInfoEXT in two separate functions?
6244d3b to
4b45ae1
Compare
Description
Next step in cleaning up the setup process: use the
StructureChainBuilderto create the debug callback handles.Note: For some (to me) unknown reason, in the extensions sample
shader_debugprintf, you need theVkDebugUtilsMessengerCreateInfoEXTfrom that sample as the anchor, not the one fromvulkan_sample. That's why you need to do some more work there. The previous implementation happened to make it as needed, but it was actually wrong in the general case.Build tested on Win11 with VS2022. Run tested on Win11 with NVidia GPU.
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batchcommand line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: