Add Android Vulkan backend (#2711)

Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
This commit is contained in:
Adrian Cojocaru
2024-09-06 17:40:57 +03:00
committed by GitHub
parent 4b5d06d908
commit ea09bdf2b6
79 changed files with 2580 additions and 1400 deletions

View File

@@ -10,19 +10,27 @@ namespace mbgl {
namespace vulkan {
bool BufferAllocation::create(const VmaAllocationCreateInfo& allocInfo, const vk::BufferCreateInfo& bufferInfo) {
VkResult result = vmaCreateBuffer(
allocator, reinterpret_cast<const VkBufferCreateInfo*>(&bufferInfo), &allocInfo, &buffer, &allocation, nullptr);
VkBuffer buffer_;
VkResult result = vmaCreateBuffer(allocator,
reinterpret_cast<const VkBufferCreateInfo*>(&bufferInfo),
&allocInfo,
&buffer_,
&allocation,
nullptr);
if (result != VK_SUCCESS) {
return false;
}
buffer = vk::Buffer(buffer_);
return true;
}
void BufferAllocation::destroy() {
if (mappedBuffer) vmaUnmapMemory(allocator, allocation);
vmaDestroyBuffer(allocator, buffer, allocation);
vmaDestroyBuffer(allocator, VkBuffer(buffer), allocation);
buffer = nullptr;
mappedBuffer = nullptr;
}