461 {
462 vk::BufferCreateInfo buffer_info;
463 buffer_info.usage = vk::BufferUsageFlagBits::eVertexBuffer |
464 vk::BufferUsageFlagBits::eIndexBuffer |
465 vk::BufferUsageFlagBits::eUniformBuffer |
466 vk::BufferUsageFlagBits::eStorageBuffer |
467 vk::BufferUsageFlagBits::eTransferSrc |
468 vk::BufferUsageFlagBits::eTransferDst;
469 buffer_info.size =
desc.size;
470 buffer_info.sharingMode = vk::SharingMode::eExclusive;
471 auto buffer_info_native =
472 static_cast<vk::BufferCreateInfo::NativeType>(buffer_info);
473
474 VmaAllocationCreateInfo allocation_info = {};
478 allocation_info.flags =
482 allocation_info.pool = staging_buffer_pool_.
get().pool;
483 }
484
486 VmaAllocation buffer_allocation = {};
487 VmaAllocationInfo buffer_allocation_info = {};
488 auto result = vk::Result{::vmaCreateBuffer(allocator_.
get(),
489 &buffer_info_native,
490 &allocation_info,
492 &buffer_allocation,
493 &buffer_allocation_info
494 )};
495
496 if (
result != vk::Result::eSuccess) {
499 return {};
500 }
501
502 return std::make_shared<DeviceBufferVK>(
503 desc,
504 context_,
506 buffer_allocation,
508 buffer_allocation_info
509 );
510}
static const uint8_t buffer[]
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKBufferMemoryPropertyFlags(StorageMode mode)
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags(StorageMode mode, bool readback)
static constexpr VmaMemoryUsage ToVMAMemoryUsage()
fml::UniqueObject< BufferVMA, BufferVMATraits > UniqueBufferVMA
VkFlags VkMemoryPropertyFlags