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,
}
// 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);
......
......@@ -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);
}
......
......@@ -20,6 +20,7 @@ namespace vma
VkResult InitAllocator(VkPhysicalDevice physicalDevice,
VkDevice device,
VkInstance instance,
uint32_t apiVersion,
VmaAllocator *pAllocator);
void DestroyAllocator(VmaAllocator allocator);
......
......@@ -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,
......
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