Commit 76d52be3 by Jamie Madill Committed by Commit Bot

Vulkan: Add VulkanMemoryAllocator to DEPS.

Bug: angleproject:2162 Change-Id: If91ae40c1fe818a59d775bb2fa066227dd52859d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2139992Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarMohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 4609c4ac
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
/third_party/spirv-headers/src /third_party/spirv-headers/src
/third_party/spirv-tools/src /third_party/spirv-tools/src
/third_party/SwiftShader /third_party/SwiftShader
/third_party/VulkanMemoryAllocator
/third_party/VK-GL-CTS/src /third_party/VK-GL-CTS/src
/third_party/vulkan-headers/src /third_party/vulkan-headers/src
/third_party/vulkan-loader/src /third_party/vulkan-loader/src
......
...@@ -89,6 +89,10 @@ deps = { ...@@ -89,6 +89,10 @@ deps = {
'condition': 'not build_with_chromium', 'condition': 'not build_with_chromium',
}, },
'third_party/VulkanMemoryAllocator': {
'url': '{chromium_git}/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@ec44c3121c73ae243fe59acfcc0ce1ba19e43947',
},
'third_party/VK-GL-CTS/src': { 'third_party/VK-GL-CTS/src': {
'url': '{chromium_git}/external/github.com/KhronosGroup/VK-GL-CTS@{vk_gl_cts_revision}', 'url': '{chromium_git}/external/github.com/KhronosGroup/VK-GL-CTS@{vk_gl_cts_revision}',
}, },
......
[ [
"src/common/third_party/xxhash", "src/common/third_party/xxhash",
"src/third_party/compiler" "src/third_party/compiler",
"third_party/VulkanMemoryAllocator"
] ]
\ No newline at end of file
...@@ -163,10 +163,7 @@ config("angle_vulkan_lib_android") { ...@@ -163,10 +163,7 @@ config("angle_vulkan_lib_android") {
group("angle_vulkan_entry_points") { group("angle_vulkan_entry_points") {
public_configs = [ ":angle_vulkan_lib_android" ] public_configs = [ ":angle_vulkan_lib_android" ]
public_deps = [ public_deps = [ "$angle_root/src/third_party/volk" ]
"$angle_root/src/third_party/volk:volk",
"$angle_root/third_party/vulkan-headers/src:vulkan_headers",
]
if (is_fuchsia) { if (is_fuchsia) {
public_deps += [ public_deps += [
"$angle_root/src/common/fuchsia_egl", "$angle_root/src/common/fuchsia_egl",
...@@ -192,10 +189,27 @@ config("angle_vulkan_backend_config") { ...@@ -192,10 +189,27 @@ config("angle_vulkan_backend_config") {
} }
} }
angle_source_set("angle_vk_mem_alloc_wrapper") {
deps = [
"$angle_root/third_party/VulkanMemoryAllocator:vulkan_memory_allocator",
]
sources = [
"vk_mem_alloc_wrapper.cpp",
"vk_mem_alloc_wrapper.h",
]
if (is_clang) {
cflags_cc = [
"-Wno-extra-semi-stmt",
"-Wno-missing-field-initializers",
]
}
}
angle_source_set("angle_vulkan_backend") { angle_source_set("angle_vulkan_backend") {
sources = _vulkan_backend_sources sources = _vulkan_backend_sources
libs = [] libs = []
deps = [ deps = [
":angle_vk_mem_alloc_wrapper",
":angle_vulkan_entry_points", ":angle_vulkan_entry_points",
"$angle_root:angle_gpu_info_util", "$angle_root:angle_gpu_info_util",
"$angle_root:angle_image_util", "$angle_root:angle_image_util",
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "libANGLE/renderer/vulkan/VertexArrayVk.h" #include "libANGLE/renderer/vulkan/VertexArrayVk.h"
#include "libANGLE/renderer/vulkan/vk_caps_utils.h" #include "libANGLE/renderer/vulkan/vk_caps_utils.h"
#include "libANGLE/renderer/vulkan/vk_format_utils.h" #include "libANGLE/renderer/vulkan/vk_format_utils.h"
#include "libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h"
#include "libANGLE/trace.h" #include "libANGLE/trace.h"
#include "platform/Platform.h" #include "platform/Platform.h"
......
//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// vma_allocator_wrapper.cpp:
// Hides VMA functions so we can use separate warning sets.
//
#include "vk_mem_alloc_wrapper.h"
#define VMA_IMPLEMENTATION
#include <vk_mem_alloc.h>
namespace vma
{
VkResult CreateBuffer(VmaAllocator allocator,
const VkBufferCreateInfo *pBufferCreateInfo,
VkMemoryPropertyFlags requiredFlags,
VkMemoryPropertyFlags preferredFlags,
VkBuffer *pBuffer,
VmaAllocation *pAllocation)
{
VmaAllocationCreateInfo allocationCreateInfo = {};
allocationCreateInfo.requiredFlags = requiredFlags;
allocationCreateInfo.preferredFlags = preferredFlags;
VmaAllocationInfo allocationInfo = {};
return vmaCreateBuffer(allocator, pBufferCreateInfo, &allocationCreateInfo, pBuffer,
pAllocation, &allocationInfo);
}
void DestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)
{
vmaDestroyBuffer(allocator, buffer, allocation);
}
void GetMemoryProperties(VmaAllocator allocator,
const VkPhysicalDeviceMemoryProperties **ppPhysicalDeviceMemoryProperties)
{
return vmaGetMemoryProperties(allocator, ppPhysicalDeviceMemoryProperties);
}
void GetMemoryTypeProperties(VmaAllocator allocator,
uint32_t memoryTypeIndex,
VkMemoryPropertyFlags *pFlags)
{
vmaGetMemoryTypeProperties(allocator, memoryTypeIndex, pFlags);
}
VkResult MapMemory(VmaAllocator allocator, VmaAllocation allocation, void **ppData)
{
return vmaMapMemory(allocator, allocation, ppData);
}
void UnmapMemory(VmaAllocator allocator, VmaAllocation allocation)
{
return vmaUnmapMemory(allocator, allocation);
}
void FlushAllocation(VmaAllocator allocator,
VmaAllocation allocation,
VkDeviceSize offset,
VkDeviceSize size)
{
vmaFlushAllocation(allocator, allocation, offset, size);
}
void InvalidateAllocation(VmaAllocator allocator,
VmaAllocation allocation,
VkDeviceSize offset,
VkDeviceSize size)
{
vmaInvalidateAllocation(allocator, allocation, offset, size);
}
} // namespace vma
//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// vma_allocator_wrapper.h:
// Hides VMA functions so we can use separate warning sets.
//
#ifndef LIBANGLE_RENDERER_VULKAN_VK_MEM_ALLOC_WRAPPER_H_
#define LIBANGLE_RENDERER_VULKAN_VK_MEM_ALLOC_WRAPPER_H_
#include <volk.h>
VK_DEFINE_HANDLE(VmaAllocator)
VK_DEFINE_HANDLE(VmaPool)
VK_DEFINE_HANDLE(VmaAllocation)
VK_DEFINE_HANDLE(VmaDefragmentationContext)
namespace vma
{
// Please add additional functions or parameters here as needed.
VkResult CreateBuffer(VmaAllocator allocator,
const VkBufferCreateInfo *pBufferCreateInfo,
VkMemoryPropertyFlags requiredFlags,
VkMemoryPropertyFlags preferredFlags,
VkBuffer *pBuffer,
VmaAllocation *pAllocation);
void DestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation);
void GetMemoryProperties(VmaAllocator allocator,
const VkPhysicalDeviceMemoryProperties **ppPhysicalDeviceMemoryProperties);
void GetMemoryTypeProperties(VmaAllocator allocator,
uint32_t memoryTypeIndex,
VkMemoryPropertyFlags *pFlags);
VkResult MapMemory(VmaAllocator allocator, VmaAllocation allocation, void **ppData);
void UnmapMemory(VmaAllocator allocator, VmaAllocation allocation);
void FlushAllocation(VmaAllocator allocator,
VmaAllocation allocation,
VkDeviceSize offset,
VkDeviceSize size);
void InvalidateAllocation(VmaAllocator allocator,
VmaAllocation allocation,
VkDeviceSize offset,
VkDeviceSize size);
} // namespace vma
#endif // LIBANGLE_RENDERER_VULKAN_VK_MEM_ALLOC_WRAPPER_H_
\ No newline at end of file
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