diff options
author | Jamie Madill <jmadill@chromium.org> | 2020-05-26 17:02:48 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-05 17:34:40 +0000 |
commit | 17b4a877e7ffd1400b0d84f0f6d7339d1c27f2d4 (patch) | |
tree | d46da0c0ec3360ba09b9644aa6d8604fdb06010c | |
parent | a91dcb622e023b2d17c0d417b2d918d2ae8d9573 (diff) | |
download | angle-17b4a877e7ffd1400b0d84f0f6d7339d1c27f2d4.tar.gz |
Vulkan: Pass API version to VMA.
This apparently can save on memory usage in the allocator.
Reported by penghuang@chromium.org.
Bug: angleproject:4685
Change-Id: I6f29280e3fe16f3388c4f8412e0acb09d7f16e58
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2216714
Reviewed-by: Tobin Ehlis <tobine@google.com>
Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
-rw-r--r-- | src/libANGLE/renderer/vulkan/RendererVk.cpp | 3 | ||||
-rw-r--r-- | src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp | 2 | ||||
-rw-r--r-- | src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h | 1 | ||||
-rw-r--r-- | src/libANGLE/renderer/vulkan/vk_wrapper.h | 10 |
4 files changed, 12 insertions, 4 deletions
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp index d2de283cb2..bd756589b9 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.cpp +++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp @@ -813,7 +813,8 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, } // Create VMA allocator - ANGLE_VK_TRY(displayVk, mAllocator.init(mPhysicalDevice, mDevice, mInstance)); + ANGLE_VK_TRY(displayVk, + mAllocator.init(mPhysicalDevice, mDevice, mInstance, applicationInfo.apiVersion)); // Store the physical device memory properties so we can find the right memory pools. mMemoryProperties.init(mPhysicalDevice); diff --git a/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp b/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp index 71b55e4b24..1e866a2da8 100644 --- a/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp +++ b/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp @@ -16,6 +16,7 @@ namespace vma VkResult InitAllocator(VkPhysicalDevice physicalDevice, VkDevice device, VkInstance instance, + uint32_t apiVersion, VmaAllocator *pAllocator) { VmaVulkanFunctions funcs = {}; @@ -53,6 +54,7 @@ VkResult InitAllocator(VkPhysicalDevice physicalDevice, allocatorInfo.device = device; allocatorInfo.instance = instance; allocatorInfo.pVulkanFunctions = &funcs; + allocatorInfo.vulkanApiVersion = apiVersion; return vmaCreateAllocator(&allocatorInfo, pAllocator); } diff --git a/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h b/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h index 04ea43f430..973fc8270b 100644 --- a/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h +++ b/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h @@ -20,6 +20,7 @@ namespace vma VkResult InitAllocator(VkPhysicalDevice physicalDevice, VkDevice device, VkInstance instance, + uint32_t apiVersion, VmaAllocator *pAllocator); void DestroyAllocator(VmaAllocator allocator); diff --git a/src/libANGLE/renderer/vulkan/vk_wrapper.h b/src/libANGLE/renderer/vulkan/vk_wrapper.h index 346b754aa5..7c583e7bba 100644 --- a/src/libANGLE/renderer/vulkan/vk_wrapper.h +++ b/src/libANGLE/renderer/vulkan/vk_wrapper.h @@ -464,7 +464,10 @@ class Allocator : public WrappedObject<Allocator, VmaAllocator> Allocator() = default; void destroy(); - VkResult init(VkPhysicalDevice physicalDevice, VkDevice device, VkInstance instance); + VkResult init(VkPhysicalDevice physicalDevice, + VkDevice device, + VkInstance instance, + uint32_t apiVersion); // Initializes the buffer handle and memory allocation. VkResult createBuffer(const VkBufferCreateInfo &bufferCreateInfo, @@ -1377,10 +1380,11 @@ ANGLE_INLINE void Allocator::destroy() ANGLE_INLINE VkResult Allocator::init(VkPhysicalDevice physicalDevice, VkDevice device, - VkInstance instance) + VkInstance instance, + uint32_t apiVersion) { ASSERT(!valid()); - return vma::InitAllocator(physicalDevice, device, instance, &mHandle); + return vma::InitAllocator(physicalDevice, device, instance, apiVersion, &mHandle); } ANGLE_INLINE VkResult Allocator::createBuffer(const VkBufferCreateInfo &bufferCreateInfo, |