Vulkan: Use Vulkan Memory Allocator

This commit is contained in:
Connor McLaughlin
2022-09-26 20:44:23 +10:00
parent 56293e4d8f
commit 9d27f7095f
30 changed files with 603 additions and 1349 deletions

View File

@ -1,12 +1,8 @@
// Copyright 2016 Dolphin Emulator Project
// Copyright 2020 DuckStation Emulator Project
// Licensed under GPLv2+
// Refer to the LICENSE file included.
#pragma once
#include "../string.h"
#include "../types.h"
#include "context.h"
#include "loader.h"
#include <algorithm>
#include <array>
@ -163,6 +159,20 @@ inline void SetObjectName(VkDevice device, T object_handle, const char* format,
#endif
}
template<>
inline void SetObjectName(VkDevice device, VmaAllocation object_handle, const char* format, ...)
{
#ifdef ENABLE_VULKAN_DEBUG_OBJECTS
std::va_list ap;
SmallString str;
va_start(ap, format);
str.FormatVA(format, ap);
va_end(ap);
vmaSetAllocationName(g_vulkan_context->GetAllocator(), object_handle, str);
#endif
}
// Command buffer debug utils
inline void BeginDebugScope(VkCommandBuffer command_buffer, const char* scope_name,
const std::array<float, 4>& scope_color = {0.5, 0.5, 0.5, 1.0})