VulkanRenderer: Add support for VK_EXT_debug_report
Some older drivers (Android) don't support VK_EXT_debug_utils
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// 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_WRAPPER_DEBUGREPORTCALLBACKEXT_HPP
|
||||
#define NAZARA_VULKANRENDERER_WRAPPER_DEBUGREPORTCALLBACKEXT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/InstanceObject.hpp>
|
||||
|
||||
namespace Nz::Vk
|
||||
{
|
||||
class DebugReportCallbackEXT : public InstanceObject<DebugReportCallbackEXT, VkDebugReportCallbackEXT, VkDebugReportCallbackCreateInfoEXT, VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT>
|
||||
{
|
||||
friend InstanceObject;
|
||||
|
||||
public:
|
||||
DebugReportCallbackEXT() = default;
|
||||
DebugReportCallbackEXT(const DebugReportCallbackEXT&) = delete;
|
||||
DebugReportCallbackEXT(DebugReportCallbackEXT&&) = default;
|
||||
~DebugReportCallbackEXT() = default;
|
||||
|
||||
DebugReportCallbackEXT& operator=(const DebugReportCallbackEXT&) = delete;
|
||||
DebugReportCallbackEXT& operator=(DebugReportCallbackEXT&&) = delete;
|
||||
|
||||
static inline bool IsSupported(Instance& instance);
|
||||
|
||||
private:
|
||||
static inline VkResult CreateHelper(Instance& instance, const VkDebugReportCallbackCreateInfoEXT* createInfo, const VkAllocationCallbacks* allocator, VkDebugReportCallbackEXT* handle);
|
||||
static inline void DestroyHelper(Instance& instance, VkDebugReportCallbackEXT handle, const VkAllocationCallbacks* allocator);
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DebugReportCallbackEXT.inl>
|
||||
|
||||
#endif // NAZARA_VULKANRENDERER_WRAPPER_DEBUGREPORTCALLBACKEXT_HPP
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// 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/DebugReportCallbackEXT.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz::Vk
|
||||
{
|
||||
inline bool DebugReportCallbackEXT::IsSupported(Instance& instance)
|
||||
{
|
||||
return instance.vkCreateDebugReportCallbackEXT != nullptr;
|
||||
}
|
||||
|
||||
inline VkResult DebugReportCallbackEXT::CreateHelper(Instance& instance, const VkDebugReportCallbackCreateInfoEXT* createInfo, const VkAllocationCallbacks* allocator, VkDebugReportCallbackEXT* handle)
|
||||
{
|
||||
return instance.vkCreateDebugReportCallbackEXT(instance, createInfo, allocator, handle);
|
||||
}
|
||||
|
||||
inline void DebugReportCallbackEXT::DestroyHelper(Instance& instance, VkDebugReportCallbackEXT handle, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
return instance.vkDestroyDebugReportCallbackEXT(instance, handle, allocator);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
@@ -10,30 +10,27 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/InstanceObject.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace Nz::Vk
|
||||
{
|
||||
namespace Vk
|
||||
class DebugUtilsMessengerEXT : public InstanceObject<DebugUtilsMessengerEXT, VkDebugUtilsMessengerEXT, VkDebugUtilsMessengerCreateInfoEXT, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT>
|
||||
{
|
||||
class DebugUtilsMessengerEXT : public InstanceObject<DebugUtilsMessengerEXT, VkDebugUtilsMessengerEXT, VkDebugUtilsMessengerCreateInfoEXT, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT>
|
||||
{
|
||||
friend InstanceObject;
|
||||
friend InstanceObject;
|
||||
|
||||
public:
|
||||
DebugUtilsMessengerEXT() = default;
|
||||
DebugUtilsMessengerEXT(const DebugUtilsMessengerEXT&) = delete;
|
||||
DebugUtilsMessengerEXT(DebugUtilsMessengerEXT&&) = default;
|
||||
~DebugUtilsMessengerEXT() = default;
|
||||
public:
|
||||
DebugUtilsMessengerEXT() = default;
|
||||
DebugUtilsMessengerEXT(const DebugUtilsMessengerEXT&) = delete;
|
||||
DebugUtilsMessengerEXT(DebugUtilsMessengerEXT&&) = default;
|
||||
~DebugUtilsMessengerEXT() = default;
|
||||
|
||||
DebugUtilsMessengerEXT& operator=(const DebugUtilsMessengerEXT&) = delete;
|
||||
DebugUtilsMessengerEXT& operator=(DebugUtilsMessengerEXT&&) = delete;
|
||||
DebugUtilsMessengerEXT& operator=(const DebugUtilsMessengerEXT&) = delete;
|
||||
DebugUtilsMessengerEXT& operator=(DebugUtilsMessengerEXT&&) = delete;
|
||||
|
||||
static inline bool IsSupported(Instance& instance);
|
||||
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);
|
||||
};
|
||||
}
|
||||
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>
|
||||
|
||||
@@ -5,24 +5,21 @@
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DebugUtilsMessengerEXT.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace Nz::Vk
|
||||
{
|
||||
namespace Vk
|
||||
inline bool DebugUtilsMessengerEXT::IsSupported(Instance& instance)
|
||||
{
|
||||
inline bool DebugUtilsMessengerEXT::IsSupported(Instance& instance)
|
||||
{
|
||||
return instance.vkCreateDebugUtilsMessengerEXT != nullptr;
|
||||
}
|
||||
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 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);
|
||||
}
|
||||
inline void DebugUtilsMessengerEXT::DestroyHelper(Instance& instance, VkDebugUtilsMessengerEXT handle, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
return instance.vkDestroyDebugUtilsMessengerEXT(instance, handle, allocator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Nz::Vk
|
||||
m_lastErrorCode = C::CreateHelper(*m_device, &createInfo, allocator, &m_handle);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan object: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("Failed to create Vulkan device object: " + TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,12 @@ NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_KHR_surface)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_EXT_END()
|
||||
|
||||
NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_EXT_debug_report)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkCreateDebugReportCallbackEXT)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkDestroyDebugReportCallbackEXT)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkDebugReportMessageEXT)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_EXT_END()
|
||||
|
||||
NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_EXT_debug_utils)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkCreateDebugUtilsMessengerEXT)
|
||||
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkDestroyDebugUtilsMessengerEXT)
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Nz
|
||||
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));
|
||||
NazaraError("Failed to create Vulkan instance object: " + TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Nz
|
||||
m_lastErrorCode = result;
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan object: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("Failed to create Vulkan pipeline: " + TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user