18 VkSharingMode sharingMode = VK_SHARING_MODE_EXCLUSIVE;
20 if (queueFamilyIndices.size() > 1 && !
_exclusive) {
21 sharingMode = VK_SHARING_MODE_CONCURRENT;
25 const VkBufferCreateInfo createInfo{
26 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
32 static_cast<uint32_t
>(queueFamilyIndices.size()),
33 queueFamilyIndices.data(),
37 VkBuffer vkBuffer{VK_NULL_HANDLE};
38 VkResult result = vkCreateBuffer(static_cast<VkDevice>(
_device), &createInfo,
nullptr, &vkBuffer);
41 *returnResult = result;
44 if (result != VK_SUCCESS) {
54 std::unique_ptr<API::Buffer> buffer = std::make_unique<API::Buffer>();
55 return build(*buffer, returnResult) ? std::move(buffer) :
nullptr;
Buffer(const API::Device &device)
bool build(API::Buffer &instance, VkResult *returnResult=nullptr)
VkBufferUsageFlags _usage
std::set< uint32_t > _queueFamilyIndices
VkBufferCreateFlags _flags
const API::Device & _device