From 0750574a03a94981f922d5a649e75ea14c100d1d Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 12 May 2025 20:03:35 +0200 Subject: [PATCH] Update VulkanMemoryAllocator to 3.3.0 --- .gitmodules | 2 +- 3rdparty/GPUOpen/VulkanMemoryAllocator | 2 +- rpcs3/Emu/RSX/VK/VKMemAlloc.cpp | 2 +- rpcs3/Emu/RSX/VK/vkutils/device.cpp | 2 +- rpcs3/Emu/RSX/VK/vkutils/memory.cpp | 7 ++++--- rpcs3/Emu/RSX/VK/vkutils/memory.h | 6 +++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 305705b06a..427c61ffbd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -106,5 +106,5 @@ ignore = dirty [submodule "3rdparty/GPUOpen/VulkanMemoryAllocator"] path = 3rdparty/GPUOpen/VulkanMemoryAllocator - url = ../../Megamouse/VulkanMemoryAllocator.git + url = ../../GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git ignore = dirty diff --git a/3rdparty/GPUOpen/VulkanMemoryAllocator b/3rdparty/GPUOpen/VulkanMemoryAllocator index 3706484339..1d8f600fd4 160000 --- a/3rdparty/GPUOpen/VulkanMemoryAllocator +++ b/3rdparty/GPUOpen/VulkanMemoryAllocator @@ -1 +1 @@ -Subproject commit 37064843398c69cc0ca7f8cf5b33128c03a2bd74 +Subproject commit 1d8f600fd424278486eade7ed3e877c99f0846b1 diff --git a/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp b/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp index e6cf921dc7..1ac2799ac4 100644 --- a/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp +++ b/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp @@ -53,7 +53,7 @@ private: #pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" #endif #endif -#include "3rdparty/GPUOpen/VulkanMemoryAllocator/src/vk_mem_alloc.h" +#include "3rdparty/GPUOpen/VulkanMemoryAllocator/include/vk_mem_alloc.h" #ifdef _MSC_VER #pragma warning(pop) #else diff --git a/rpcs3/Emu/RSX/VK/vkutils/device.cpp b/rpcs3/Emu/RSX/VK/vkutils/device.cpp index 8aa6a6fed8..22c9e55eab 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/device.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/device.cpp @@ -880,7 +880,7 @@ namespace vk } else { - m_allocator = std::make_unique(*this, pdev); + m_allocator = std::make_unique(*this, pdev, pdev); } // Useful for debugging different VRAM configurations diff --git a/rpcs3/Emu/RSX/VK/vkutils/memory.cpp b/rpcs3/Emu/RSX/VK/vkutils/memory.cpp index 45237853be..3bce6c3550 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/memory.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/memory.cpp @@ -153,11 +153,11 @@ namespace vk rsx_log.warning("Rebalanced memory types successfully"); } - mem_allocator_base::mem_allocator_base(const vk::render_device& dev, VkPhysicalDevice) + mem_allocator_base::mem_allocator_base(const vk::render_device& dev, VkPhysicalDevice /*pdev*/) : m_device(dev), m_allocation_flags(0) {} - mem_allocator_vma::mem_allocator_vma(const vk::render_device& dev, VkPhysicalDevice pdev) + mem_allocator_vma::mem_allocator_vma(const vk::render_device& dev, VkPhysicalDevice pdev, VkInstance inst) : mem_allocator_base(dev, pdev) { // Initialize stats pool @@ -166,6 +166,7 @@ namespace vk VmaAllocatorCreateInfo allocatorInfo = {}; allocatorInfo.physicalDevice = pdev; allocatorInfo.device = dev; + allocatorInfo.instance = inst; std::vector heap_limits; const auto vram_allocation_limit = g_cfg.video.vk.vram_allocation_limit * 0x100000ull; @@ -299,7 +300,7 @@ namespace vk f32 mem_allocator_vma::get_memory_usage() { - vmaGetBudget(m_allocator, stats.data()); + vmaGetHeapBudgets(m_allocator, stats.data()); float max_usage = 0.f; for (const auto& info : stats) diff --git a/rpcs3/Emu/RSX/VK/vkutils/memory.h b/rpcs3/Emu/RSX/VK/vkutils/memory.h index 9ab7d44f88..209b9a49f6 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/memory.h +++ b/rpcs3/Emu/RSX/VK/vkutils/memory.h @@ -4,7 +4,7 @@ #include "../../rsx_utils.h" #include "shared.h" -#include "3rdparty/GPUOpen/VulkanMemoryAllocator/src/vk_mem_alloc.h" +#include "3rdparty/GPUOpen/VulkanMemoryAllocator/include/vk_mem_alloc.h" namespace vk { @@ -55,7 +55,7 @@ namespace vk public: using mem_handle_t = void*; - mem_allocator_base(const vk::render_device& dev, VkPhysicalDevice /*pdev*/); + mem_allocator_base(const vk::render_device& dev, VkPhysicalDevice pdev); virtual ~mem_allocator_base() = default; virtual void destroy() = 0; @@ -83,7 +83,7 @@ namespace vk class mem_allocator_vma : public mem_allocator_base { public: - mem_allocator_vma(const vk::render_device& dev, VkPhysicalDevice pdev); + mem_allocator_vma(const vk::render_device& dev, VkPhysicalDevice pdev, VkInstance inst); ~mem_allocator_vma() override = default; void destroy() override;