I have started with Vulkan and just did the Validation Layers.
In here, they add a static function static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(...)
to the .cpp file, then simply assign
createInfo.pfnUserCallback = debugCallback;
How (/why) does this work? I know of callbacks of course, but I tried to add this function to my renderer class instead of just "locally"(?) in the .cpp file, first in the header file:
static VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* callbackData,
void* pUserData);
And then in the .cpp file:
VKAPI_ATTR VkBool32 VKAPI_CALL VulkanRenderer::DebugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* callbackData,
void* pUserData)
{
//...
}
And finally using assigning it like this:
createInfo.pfnUserCallback = &VulkanRenderer::DebugCallback;
My version does in fact not work, so I probably am thinking about the wrong thing here. But I don't know what they did in the tutorial or even what to search for to understand this.
I do know what code to write to make it work like they have it, I just don't know why.