diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-06-27 17:21:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-27 17:21:36 +0200 |
commit | c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f (patch) | |
tree | 1ceac7222976e40bb12c3919cd3412d36b7ec93b /src/video_core/vulkan_common/vulkan_device.cpp | |
parent | Merge pull request #10495 from bm01/master (diff) | |
parent | externals: Use cmake subdirectory (diff) | |
download | yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.tar yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.tar.gz yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.tar.bz2 yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.tar.lz yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.tar.xz yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.tar.zst yuzu-c6959449d1e28f16d6eaf3a215f2bce5fab5ed0f.zip |
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
-rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index b11abe311..e4ca65b58 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -22,6 +22,8 @@ #include <adrenotools/bcenabler.h> #endif +#include <vk_mem_alloc.h> + namespace Vulkan { using namespace Common::Literals; namespace { @@ -596,9 +598,31 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR graphics_queue = logical.GetQueue(graphics_family); present_queue = logical.GetQueue(present_family); + + VmaVulkanFunctions functions{}; + functions.vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr; + functions.vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr; + + const VmaAllocatorCreateInfo allocator_info = { + .flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT, + .physicalDevice = physical, + .device = *logical, + .preferredLargeHeapBlockSize = 0, + .pAllocationCallbacks = nullptr, + .pDeviceMemoryCallbacks = nullptr, + .pHeapSizeLimit = nullptr, + .pVulkanFunctions = &functions, + .instance = instance, + .vulkanApiVersion = VK_API_VERSION_1_1, + .pTypeExternalMemoryHandleTypes = nullptr, + }; + + vk::Check(vmaCreateAllocator(&allocator_info, &allocator)); } -Device::~Device() = default; +Device::~Device() { + vmaDestroyAllocator(allocator); +} VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage, FormatType format_type) const { |