Home > Back-end >  vulkan error when creating a vulkan instance when pNext is initialized
vulkan error when creating a vulkan instance when pNext is initialized

Time:04-18

I'm following a vulkan tutorial and when I'm initializing the instance createInfo.pNext with

VkDebugutilsmessengerCreateInfo*

I'm getting an erorr.

populateDebugMessengerCreateInfo(debugCreateInfo);
    createInfo.pNext = & debugCreateInfo;
populateDebugMessengerCreateInfo:

    void app::populateDebugMessengerCreateInfo(VkDebugUtilsMessengerCreateInfoEXT& createInfo) {
    createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
    createInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
    createInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
        VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
    createInfo.pfnUserCallback = (PFN_vkDebugUtilsMessengerCallbackEXT)debugCallBack;
}

this is the error i get: Exception thrown at 0x00007FF8268D26F0 (vulkan-1.dll) in VulkanFirst.exe: 0xC0000005: Access violation reading location

CodePudding user response:

You need to set pNext to NULL or it leads to uninitialized pointer dereference.

  • Related