aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/vulkan_common/vulkan_device.cpp
diff options
context:
space:
mode:
authorwildcard <wildcard@eden-emu.dev>2025-09-01 00:20:03 +0200
committercrueter <crueter@eden-emu.dev>2025-09-01 00:20:03 +0200
commite60fd4b68bc8d43d141bfba73086518861044678 (patch)
tree81c7e780a3deaf21618529724ed3bc02d887f889 /src/video_core/vulkan_common/vulkan_device.cpp
parent10c76568b89d1cf2b8bc950a6b633443bd2bb728 (diff)
[VMA] Phase 3:- Hand all allocation & binding to VMA (#362)
This patch completely removes the Custom Sub allocator with VMA and delegates everything to the VMA. Overall, the patch integrates VMA and simplifies memory management. Once these changes pass the testing, it will be used as a base for further improvement. Note to testers, test for stability and performance. Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/362 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@outlook.com> Co-authored-by: wildcard <wildcard@eden-emu.dev> Co-committed-by: wildcard <wildcard@eden-emu.dev>
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 95c0d974cc..4d74bf00a5 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -753,18 +753,24 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
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,
+ VmaAllocatorCreateFlags flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT;
+ if (extensions.memory_budget) {
+ flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT;
+ }
+ const VmaAllocatorCreateInfo allocator_info{
+ .flags = flags,
+ .physicalDevice = physical,
+ .device = *logical,
+ .preferredLargeHeapBlockSize = is_integrated
+ ? (64u * 1024u * 1024u)
+ : (256u * 1024u * 1024u),
+ .pAllocationCallbacks = nullptr,
+ .pDeviceMemoryCallbacks = nullptr,
+ .pHeapSizeLimit = nullptr,
+ .pVulkanFunctions = &functions,
+ .instance = instance,
+ .vulkanApiVersion = ApiVersion(),
+ .pTypeExternalMemoryHandleTypes = nullptr,
};
vk::Check(vmaCreateAllocator(&allocator_info, &allocator));