Creating VmaAllocator object for each Vulkan device.

This commit is contained in:
2022-01-15 03:34:41 -08:00
parent 2df55cf31c
commit 739111ed2d
3 changed files with 50 additions and 17 deletions

View File

@@ -31,6 +31,12 @@
#include "KRDeviceManager.h"
// VMA_IMPLEMENTATION must only be defined in a single CPP file
#define VMA_IMPLEMENTATION
#define VMA_STATIC_VULKAN_FUNCTIONS 0
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
#include "vk_mem_alloc.h"
KRDeviceManager::KRDeviceManager(KRContext& context)
: KRContextObject(context)
, m_vulkanInstance(VK_NULL_HANDLE)
@@ -142,7 +148,7 @@ void KRDeviceManager::createDevices()
std::vector<std::unique_ptr<KRDevice>> candidateDevices;
for (const VkPhysicalDevice& physicalDevice : physicalDevices) {
std::unique_ptr<KRDevice> device = std::make_unique<KRDevice>(physicalDevice);
std::unique_ptr<KRDevice> device = std::make_unique<KRDevice>(*m_pContext, physicalDevice);
if (!device->initialize(deviceExtensions)) {
continue;
}