Move Vulkan debug callback to module

This commit is contained in:
Lynix 2020-04-13 15:12:58 +02:00
parent 7447875753
commit e905c3a004
11 changed files with 366 additions and 95 deletions

View File

@ -6,32 +6,8 @@
#include <array>
#include <iostream>
VKAPI_ATTR VkBool32 VKAPI_CALL MyDebugReportCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
void* pUserData)
{
if (pCallbackData->messageIdNumber != 0)
std::cerr << "#" << pCallbackData->messageIdNumber << " " << pCallbackData->messageIdNumber << ": ";
std::cerr << pCallbackData->pMessage << std::endl;
return VK_FALSE;
}
int main()
{
Nz::ParameterList params;
params.SetParameter("VkInstanceInfo_EnabledExtensionCount", 1LL);
params.SetParameter("VkInstanceInfo_EnabledExtension0", "VK_EXT_debug_report");
params.SetParameter("VkDeviceInfo_EnabledLayerCount", 1LL);
params.SetParameter("VkDeviceInfo_EnabledLayer0", "VK_LAYER_LUNARG_standard_validation");
params.SetParameter("VkInstanceInfo_EnabledLayerCount", 1LL);
params.SetParameter("VkInstanceInfo_EnabledLayer0", "VK_LAYER_LUNARG_standard_validation");
Nz::Renderer::SetParameters(params);
Nz::Initializer<Nz::Renderer> loader;
if (!loader)
{
@ -39,31 +15,6 @@ int main()
return __LINE__;
}
Nz::Vk::Instance& instance = Nz::Vulkan::GetInstance();
VkDebugUtilsMessengerCreateInfoEXT callbackCreateInfo = { VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT };
callbackCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
callbackCreateInfo.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;
callbackCreateInfo.pfnUserCallback = &MyDebugReportCallback;
/* Register the callback */
VkDebugUtilsMessengerEXT callback;
instance.vkCreateDebugUtilsMessengerEXT(instance, &callbackCreateInfo, nullptr, &callback);
std::vector<VkLayerProperties> layerProperties;
if (!Nz::Vk::Loader::EnumerateInstanceLayerProperties(&layerProperties))
{
NazaraError("Failed to enumerate instance layer properties");
return __LINE__;
}
for (const VkLayerProperties& properties : layerProperties)
{
std::cout << properties.layerName << ": \t" << properties.description << std::endl;
}
Nz::RenderWindow window;
Nz::MeshParams meshParams;
@ -370,7 +321,5 @@ int main()
}
}
instance.vkDestroyDebugUtilsMessengerEXT(instance, callback, nullptr);
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,41 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_VULKANRENDERER_VKDEBUGUTILSMESSENGEREXT_HPP
#define NAZARA_VULKANRENDERER_VKDEBUGUTILSMESSENGEREXT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/VulkanRenderer/Wrapper/InstanceObject.hpp>
namespace Nz
{
namespace Vk
{
class DebugUtilsMessengerEXT : public InstanceObject<DebugUtilsMessengerEXT, VkDebugUtilsMessengerEXT, VkDebugUtilsMessengerCreateInfoEXT, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT>
{
friend InstanceObject;
public:
DebugUtilsMessengerEXT() = default;
DebugUtilsMessengerEXT(const DebugUtilsMessengerEXT&) = delete;
DebugUtilsMessengerEXT(DebugUtilsMessengerEXT&&) = default;
~DebugUtilsMessengerEXT() = default;
DebugUtilsMessengerEXT& operator=(const DebugUtilsMessengerEXT&) = delete;
DebugUtilsMessengerEXT& operator=(DebugUtilsMessengerEXT&&) = delete;
static inline bool IsSupported(Instance& instance);
private:
static inline VkResult CreateHelper(Instance& instance, const VkDebugUtilsMessengerCreateInfoEXT* createInfo, const VkAllocationCallbacks* allocator, VkDebugUtilsMessengerEXT* handle);
static inline void DestroyHelper(Instance& instance, VkDebugUtilsMessengerEXT handle, const VkAllocationCallbacks* allocator);
};
}
}
#include <Nazara/VulkanRenderer/Wrapper/DebugUtilsMessengerEXT.inl>
#endif // NAZARA_VULKANRENDERER_VKDEBUGUTILSMESSENGEREXT_HPP

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/VulkanRenderer/Wrapper/DebugUtilsMessengerEXT.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
{
inline bool DebugUtilsMessengerEXT::IsSupported(Instance& instance)
{
return instance.vkCreateDebugUtilsMessengerEXT != nullptr;
}
inline VkResult DebugUtilsMessengerEXT::CreateHelper(Instance& instance, const VkDebugUtilsMessengerCreateInfoEXT* createInfo, const VkAllocationCallbacks* allocator, VkDebugUtilsMessengerEXT* handle)
{
return instance.vkCreateDebugUtilsMessengerEXT(instance, createInfo, allocator, handle);
}
inline void DebugUtilsMessengerEXT::DestroyHelper(Instance& instance, VkDebugUtilsMessengerEXT handle, const VkAllocationCallbacks* allocator)
{
return instance.vkDestroyDebugUtilsMessengerEXT(instance, handle, allocator);
}
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@ -115,17 +115,17 @@ namespace Nz
static constexpr std::size_t QueueCount = static_cast<std::size_t>(QueueType::Max) + 1;
std::unique_ptr<InternalData> m_internalData;
std::array<UInt32, QueueCount> m_defaultQueues;
std::unordered_set<std::string> m_loadedExtensions;
std::unordered_set<std::string> m_loadedLayers;
std::vector<QueueFamilyInfo> m_enabledQueuesInfos;
std::vector<const QueueList*> m_queuesByFamily;
Instance& m_instance;
const Vk::PhysicalDevice* m_physicalDevice;
VkAllocationCallbacks m_allocator;
VkDevice m_device;
VkResult m_lastErrorCode;
VmaAllocator m_memAllocator;
std::array<UInt32, QueueCount> m_defaultQueues;
std::unordered_set<std::string> m_loadedExtensions;
std::unordered_set<std::string> m_loadedLayers;
std::vector<QueueFamilyInfo> m_enabledQueuesInfos;
std::vector<const QueueList*> m_queuesByFamily;
};
}
}

View File

@ -5,8 +5,6 @@
#include <Nazara/VulkanRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/VulkanRenderer/Utils.hpp>
#include <Nazara/VulkanRenderer/Wrapper/CommandPool.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz

View File

@ -21,10 +21,10 @@ namespace Nz
class NAZARA_VULKANRENDERER_API Instance
{
public:
inline Instance();
Instance();
Instance(const Instance&) = delete;
Instance(Instance&&) = delete;
inline ~Instance();
~Instance();
bool Create(const VkInstanceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
inline bool Create(const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator = nullptr);
@ -45,6 +45,8 @@ namespace Nz
inline VkPhysicalDeviceProperties GetPhysicalDeviceProperties(VkPhysicalDevice device);
bool GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice device, std::vector<VkQueueFamilyProperties>* queueFamilyProperties);
void InstallDebugMessageCallback();
inline bool IsExtensionLoaded(const std::string& extensionName) const;
inline bool IsLayerLoaded(const std::string& layerName) const;
inline bool IsValid() const;
@ -68,17 +70,20 @@ namespace Nz
#undef NAZARA_VULKANRENDERER_INSTANCE_FUNCTION
private:
inline void DestroyInstance();
void DestroyInstance();
void ResetPointers();
inline PFN_vkVoidFunction GetProcAddr(const char* name);
struct InternalData;
std::unique_ptr<InternalData> m_internalData;
std::unordered_set<std::string> m_loadedExtensions;
std::unordered_set<std::string> m_loadedLayers;
VkAllocationCallbacks m_allocator;
VkInstance m_instance;
VkResult m_lastErrorCode;
UInt32 m_apiVersion;
std::unordered_set<std::string> m_loadedExtensions;
std::unordered_set<std::string> m_loadedLayers;
};
}
}

View File

@ -12,17 +12,6 @@ namespace Nz
{
namespace Vk
{
inline Instance::Instance() :
m_instance(nullptr)
{
}
inline Instance::~Instance()
{
if (m_instance)
DestroyInstance();
}
inline bool Instance::Create(const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator)
{
VkApplicationInfo appInfo =
@ -142,14 +131,6 @@ namespace Nz
return properties;
}
inline void Instance::DestroyInstance()
{
assert(m_instance != VK_NULL_HANDLE);
if (vkDestroyInstance)
vkDestroyInstance(m_instance, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
}
inline PFN_vkVoidFunction Instance::GetProcAddr(const char* name)
{
PFN_vkVoidFunction func = Loader::GetInstanceProcAddr(m_instance, name);

View File

@ -0,0 +1,53 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_VULKANRENDERER_VKINSTANCEOBJECT_HPP
#define NAZARA_VULKANRENDERER_VKINSTANCEOBJECT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
#include <vulkan/vulkan.h>
#include <string>
namespace Nz
{
namespace Vk
{
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
class InstanceObject
{
public:
InstanceObject();
InstanceObject(const InstanceObject&) = delete;
InstanceObject(InstanceObject&& object) noexcept;
~InstanceObject();
bool Create(Instance& instance, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
void Destroy();
bool IsValid() const;
Instance* GetInstance() const;
VkResult GetLastErrorCode() const;
InstanceObject& operator=(const InstanceObject&) = delete;
InstanceObject& operator=(InstanceObject&& object) noexcept;
operator VkType() const;
protected:
MovablePtr<Instance> m_instance;
VkAllocationCallbacks m_allocator;
VkType m_handle;
mutable VkResult m_lastErrorCode;
};
}
}
#include <Nazara/VulkanRenderer/Wrapper/InstanceObject.inl>
#endif // NAZARA_VULKANRENDERER_VKINSTANCEOBJECT_HPP

View File

@ -0,0 +1,103 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/VulkanRenderer/Wrapper/InstanceObject.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/VulkanRenderer/Utils.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
{
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
InstanceObject<C, VkType, CreateInfo, ObjectType>::InstanceObject() :
m_handle(VK_NULL_HANDLE)
{
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
InstanceObject<C, VkType, CreateInfo, ObjectType>::InstanceObject(InstanceObject&& object) noexcept :
m_instance(std::move(object.m_instance)),
m_allocator(object.m_allocator),
m_handle(object.m_handle),
m_lastErrorCode(object.m_lastErrorCode)
{
object.m_handle = VK_NULL_HANDLE;
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
InstanceObject<C, VkType, CreateInfo, ObjectType>::~InstanceObject()
{
Destroy();
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
bool InstanceObject<C, VkType, CreateInfo, ObjectType>::Create(Instance& instance, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator)
{
m_instance = &instance;
m_lastErrorCode = C::CreateHelper(*m_instance, &createInfo, allocator, &m_handle);
if (m_lastErrorCode != VkResult::VK_SUCCESS)
{
NazaraError("Failed to create Vulkan object: " + TranslateVulkanError(m_lastErrorCode));
return false;
}
// Store the allocator to access them when needed
if (allocator)
m_allocator = *allocator;
else
m_allocator.pfnAllocation = nullptr;
return true;
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
void InstanceObject<C, VkType, CreateInfo, ObjectType>::Destroy()
{
if (IsValid())
{
C::DestroyHelper(*m_instance, m_handle, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
m_handle = VK_NULL_HANDLE;
}
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
bool InstanceObject<C, VkType, CreateInfo, ObjectType>::IsValid() const
{
return m_handle != VK_NULL_HANDLE;
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
Instance* InstanceObject<C, VkType, CreateInfo, ObjectType>::GetInstance() const
{
return m_instance;
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
VkResult InstanceObject<C, VkType, CreateInfo, ObjectType>::GetLastErrorCode() const
{
return m_lastErrorCode;
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
auto InstanceObject<C, VkType, CreateInfo, ObjectType>::operator=(InstanceObject&& object) noexcept -> InstanceObject&
{
std::swap(m_allocator, object.m_allocator);
std::swap(m_instance, object.m_instance);
std::swap(m_handle, object.m_handle);
std::swap(m_lastErrorCode, object.m_lastErrorCode);
return *this;
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
InstanceObject<C, VkType, CreateInfo, ObjectType>::operator VkType() const
{
return m_handle;
}
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@ -102,13 +102,28 @@ namespace Nz
createFlags = static_cast<VkInstanceCreateFlags>(iParam);
std::vector<const char*> enabledLayers;
std::vector<const char*> enabledExtensions;
// Get supported layer list
std::unordered_set<std::string> availableLayers;
std::vector<VkLayerProperties> layerList;
if (Vk::Loader::EnumerateInstanceLayerProperties(&layerList))
{
for (VkLayerProperties& extProperty : layerList)
availableLayers.insert(extProperty.layerName);
}
if (!parameters.GetBooleanParameter("VkInstanceInfo_OverrideEnabledLayers", &bParam) || !bParam)
{
//< Nazara default layers goes here
#ifdef NAZARA_DEBUG
// Enable Vulkan validation if available in debug mode
if (availableLayers.count("VK_LAYER_LUNARG_standard_validation"))
enabledLayers.push_back("VK_LAYER_LUNARG_standard_validation");
#endif
}
std::vector<const char*> enabledExtensions;
std::vector<String> additionalLayers; // Just to keep the String alive
if (parameters.GetIntegerParameter("VkInstanceInfo_EnabledLayerCount", &iParam))
{
@ -127,7 +142,7 @@ namespace Nz
}
}
// Get extension list
// Get supported extension list
std::unordered_set<std::string> availableExtensions;
std::vector<VkExtensionProperties> extensionList;
if (Vk::Loader::EnumerateInstanceExtensionProperties(&extensionList))
@ -138,30 +153,26 @@ namespace Nz
if (!parameters.GetBooleanParameter("VkInstanceInfo_OverrideEnabledExtensions", &bParam) || !bParam)
{
enabledExtensions.push_back("VK_KHR_surface");
enabledExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
#ifdef VK_USE_PLATFORM_ANDROID_KHR
enabledExtensions.push_back("VK_KHR_android_surface");
#endif
#ifdef VK_USE_PLATFORM_MIR_KHR
enabledExtensions.push_back("VK_KHR_mir_surface");
enabledExtensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
enabledExtensions.push_back("VK_KHR_xcb_surface");
enabledExtensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
enabledExtensions.push_back("VK_KHR_xlib_surface");
enabledExtensions.push_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
enabledExtensions.push_back("VK_KHR_wayland_surface");
enabledExtensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
enabledExtensions.push_back("VK_KHR_win32_surface");
enabledExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#endif
if (availableExtensions.count(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))

View File

@ -5,19 +5,85 @@
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/VulkanRenderer/Wrapper/DebugUtilsMessengerEXT.hpp>
#include <Nazara/VulkanRenderer/Utils.hpp>
#include <sstream>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
{
namespace
{
VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
void* /*pUserData*/)
{
std::stringstream ss;
ss << "Vulkan log: ";
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT)
ss << "[Verbose]";
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT)
ss << "[Info]";
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
ss << "[Warning]";
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
ss << "[Error]";
if (messageTypes & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT)
ss << "[General]";
if (messageTypes & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)
ss << "[Performance]";
if (messageTypes & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)
ss << "[Validation]";
ss << "[" << pCallbackData->messageIdNumber << ":" << pCallbackData->pMessageIdName << "]: " << pCallbackData->pMessage;
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
NazaraError(ss.str());
else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
NazaraWarning(ss.str());
else
NazaraNotice(ss.str());
return VK_FALSE; //< Should the Vulkan call be aborted
}
}
struct Instance::InternalData
{
DebugUtilsMessengerEXT debugMessenger;
};
Instance::Instance() :
m_instance(nullptr)
{
}
Instance::~Instance()
{
if (m_instance)
DestroyInstance();
}
bool Instance::Create(const VkInstanceCreateInfo& createInfo, const VkAllocationCallbacks* allocator)
{
m_lastErrorCode = Loader::vkCreateInstance(&createInfo, allocator, &m_instance);
if (m_lastErrorCode != VkResult::VK_SUCCESS)
{
NazaraError("Failed to create Vulkan instance");
NazaraError("Failed to create Vulkan instance: " + TranslateVulkanError(m_lastErrorCode));
return false;
}
@ -64,6 +130,9 @@ namespace Nz
return false;
}
m_internalData = std::make_unique<InternalData>();
InstallDebugMessageCallback();
return true;
}
@ -140,6 +209,38 @@ namespace Nz
return true;
}
void Instance::InstallDebugMessageCallback()
{
NazaraAssert(m_internalData, "Instance must be created before callbacks are installed");
if (!Vk::DebugUtilsMessengerEXT::IsSupported(*this))
{
NazaraWarning(VK_EXT_DEBUG_UTILS_EXTENSION_NAME " is not supported, cannot install debug message callback");
return;
}
VkDebugUtilsMessengerCreateInfoEXT callbackCreateInfo = { VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT };
callbackCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
callbackCreateInfo.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;
callbackCreateInfo.pfnUserCallback = &DebugCallback;
if (!m_internalData->debugMessenger.Create(*this, callbackCreateInfo))
{
NazaraWarning("failed to install debug message callback");
return;
}
}
void Instance::DestroyInstance()
{
assert(m_instance != VK_NULL_HANDLE);
m_internalData.reset();
if (vkDestroyInstance)
vkDestroyInstance(m_instance, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
}
void Instance::ResetPointers()
{
assert(m_instance != VK_NULL_HANDLE);