Renderer: Implement and use debug names
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Utils/StackArray.hpp>
|
||||
#include <Nazara/VulkanRenderer/Utils.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
@@ -87,6 +88,40 @@ namespace Nz::Vk
|
||||
return m_loadedLayers.count(layerName) > 0;
|
||||
}
|
||||
|
||||
inline void Device::SetDebugName(VkObjectType objectType, UInt64 objectHandle, const char* name)
|
||||
{
|
||||
if (vkSetDebugUtilsObjectNameEXT)
|
||||
{
|
||||
VkDebugUtilsObjectNameInfoEXT debugName = {
|
||||
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
nullptr,
|
||||
objectType,
|
||||
objectHandle,
|
||||
name
|
||||
};
|
||||
|
||||
vkSetDebugUtilsObjectNameEXT(m_device, &debugName);
|
||||
}
|
||||
}
|
||||
|
||||
inline void Device::SetDebugName(VkObjectType objectType, UInt64 objectHandle, std::string_view name)
|
||||
{
|
||||
if (vkSetDebugUtilsObjectNameEXT)
|
||||
{
|
||||
// Ensure \0 at the end of string
|
||||
StackArray<char> nullTerminatedName = NazaraStackArrayNoInit(char, name.size() + 1);
|
||||
std::memcpy(nullTerminatedName.data(), name.data(), name.size());
|
||||
nullTerminatedName[name.size()] = '\0';
|
||||
|
||||
return SetDebugName(objectType, objectHandle, nullTerminatedName.data());
|
||||
}
|
||||
}
|
||||
|
||||
inline void Device::SetDebugName(VkObjectType objectType, UInt64 objectHandle, const std::string& name)
|
||||
{
|
||||
return SetDebugName(objectType, objectHandle, name.data());
|
||||
}
|
||||
|
||||
inline bool Device::WaitForIdle()
|
||||
{
|
||||
m_lastErrorCode = vkDeviceWaitIdle(m_device);
|
||||
|
||||
Reference in New Issue
Block a user