Commit 17b4a877 by Jamie Madill Committed by Commit Bot

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/+/2216714Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Reviewed-by: 's avatarMohan Maiya <m.maiya@samsung.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent a91dcb62
...@@ -813,7 +813,8 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -813,7 +813,8 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
} }
// Create VMA allocator // 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. // Store the physical device memory properties so we can find the right memory pools.
mMemoryProperties.init(mPhysicalDevice); mMemoryProperties.init(mPhysicalDevice);
......
...@@ -16,6 +16,7 @@ namespace vma ...@@ -16,6 +16,7 @@ namespace vma
VkResult InitAllocator(VkPhysicalDevice physicalDevice, VkResult InitAllocator(VkPhysicalDevice physicalDevice,
VkDevice device, VkDevice device,
VkInstance instance, VkInstance instance,
uint32_t apiVersion,
VmaAllocator *pAllocator) VmaAllocator *pAllocator)
{ {
VmaVulkanFunctions funcs = {}; VmaVulkanFunctions funcs = {};
...@@ -53,6 +54,7 @@ VkResult InitAllocator(VkPhysicalDevice physicalDevice, ...@@ -53,6 +54,7 @@ VkResult InitAllocator(VkPhysicalDevice physicalDevice,
allocatorInfo.device = device; allocatorInfo.device = device;
allocatorInfo.instance = instance; allocatorInfo.instance = instance;
allocatorInfo.pVulkanFunctions = &funcs; allocatorInfo.pVulkanFunctions = &funcs;
allocatorInfo.vulkanApiVersion = apiVersion;
return vmaCreateAllocator(&allocatorInfo, pAllocator); return vmaCreateAllocator(&allocatorInfo, pAllocator);
} }
......
...@@ -20,6 +20,7 @@ namespace vma ...@@ -20,6 +20,7 @@ namespace vma
VkResult InitAllocator(VkPhysicalDevice physicalDevice, VkResult InitAllocator(VkPhysicalDevice physicalDevice,
VkDevice device, VkDevice device,
VkInstance instance, VkInstance instance,
uint32_t apiVersion,
VmaAllocator *pAllocator); VmaAllocator *pAllocator);
void DestroyAllocator(VmaAllocator allocator); void DestroyAllocator(VmaAllocator allocator);
......
...@@ -464,7 +464,10 @@ class Allocator : public WrappedObject<Allocator, VmaAllocator> ...@@ -464,7 +464,10 @@ class Allocator : public WrappedObject<Allocator, VmaAllocator>
Allocator() = default; Allocator() = default;
void destroy(); 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. // Initializes the buffer handle and memory allocation.
VkResult createBuffer(const VkBufferCreateInfo &bufferCreateInfo, VkResult createBuffer(const VkBufferCreateInfo &bufferCreateInfo,
...@@ -1377,10 +1380,11 @@ ANGLE_INLINE void Allocator::destroy() ...@@ -1377,10 +1380,11 @@ ANGLE_INLINE void Allocator::destroy()
ANGLE_INLINE VkResult Allocator::init(VkPhysicalDevice physicalDevice, ANGLE_INLINE VkResult Allocator::init(VkPhysicalDevice physicalDevice,
VkDevice device, VkDevice device,
VkInstance instance) VkInstance instance,
uint32_t apiVersion)
{ {
ASSERT(!valid()); 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, ANGLE_INLINE VkResult Allocator::createBuffer(const VkBufferCreateInfo &bufferCreateInfo,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment