VkBufferCreateInfo(3)

# VkBufferCreateInfo(3) Manual Page

## Name

VkBufferCreateInfo - Structure specifying the parameters of a newly created buffer object

## C Specification

The `VkBufferCreateInfo` structure is defined as:

    typedef struct VkBufferCreateInfo {
        VkStructureType        sType;
        const void*            pNext;
        VkBufferCreateFlags    flags;
        VkDeviceSize           size;
        VkBufferUsageFlags     usage;
        VkSharingMode          sharingMode;
        uint32_t               queueFamilyIndexCount;
        const uint32_t*        pQueueFamilyIndices;
    } VkBufferCreateInfo;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `flags` is a bitmask of VkBufferCreateFlagBits specifying additional parameters of the buffer.

- `size` is the size in bytes of the buffer to be created.

- `usage` is a bitmask of VkBufferUsageFlagBits specifying allowed usages of the buffer.

- `sharingMode` is a VkSharingMode value specifying the sharing mode of the buffer when it will be accessed by multiple queue families.

- `queueFamilyIndexCount` is the number of entries in the `pQueueFamilyIndices` array.

- `pQueueFamilyIndices` is a list of queue families that will access this buffer (ignored if `sharingMode` is not `VK_SHARING_MODE_CONCURRENT`).

## Description

| editing-note (Jon) Should the constraint on usage != 0 be converted to a Valid Usage statement? See gitlab #854.

Valid Usage

- `size` must be greater than `0`

- If `sharingMode` is `VK_SHARING_MODE_CONCURRENT`, `pQueueFamilyIndices` must be a valid pointer to an array of `queueFamilyIndexCount` `uint32_t` values

- If `sharingMode` is `VK_SHARING_MODE_CONCURRENT`, `queueFamilyIndexCount` must be greater than `1`

- If `sharingMode` is `VK_SHARING_MODE_CONCURRENT`, each element of `pQueueFamilyIndices` must be unique and must be less than `pQueueFamilyPropertyCount` returned by either vkGetPhysicalDeviceQueueFamilyProperties or vkGetPhysicalDeviceQueueFamilyProperties2 for the `physicalDevice` that was used to create `device`

- If the sparse bindings feature is not enabled, `flags` must not contain `VK_BUFFER_CREATE_SPARSE_BINDING_BIT`

- If the sparse buffer residency feature is not enabled, `flags` must not contain `VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT`

- If the sparse aliased residency feature is not enabled, `flags` must not contain `VK_BUFFER_CREATE_SPARSE_ALIASED_BIT`

- If `flags` contains `VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT` or `VK_BUFFER_CREATE_SPARSE_ALIASED_BIT`, it must also contain `VK_BUFFER_CREATE_SPARSE_BINDING_BIT`

- If the `pNext` chain includes a VkExternalMemoryBufferCreateInfo structure, its `handleTypes` member must only contain bits that are also in VkExternalBufferProperties::`externalMemoryProperties.compatibleHandleTypes`, as returned by vkGetPhysicalDeviceExternalBufferProperties with `pExternalBufferInfo`->handleType equal to any one of the handle types specified in VkExternalMemoryBufferCreateInfo::`handleTypes`

- If the protected memory feature is not enabled, `flags` must not contain `VK_BUFFER_CREATE_PROTECTED_BIT`

- If any of the bits `VK_BUFFER_CREATE_SPARSE_BINDING_BIT`, `VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT`, or `VK_BUFFER_CREATE_SPARSE_ALIASED_BIT` are set, `VK_BUFFER_CREATE_PROTECTED_BIT` must not also be set

- If the `pNext` chain includes a VkDedicatedAllocationBufferCreateInfoNV structure, and the `dedicatedAllocation` member of the chained structure is `VK_TRUE`, then `flags` must not include `VK_BUFFER_CREATE_SPARSE_BINDING_BIT`, `VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT`, or `VK_BUFFER_CREATE_SPARSE_ALIASED_BIT`

- If VkBufferDeviceAddressCreateInfoEXT::`deviceAddress` is not zero, `flags` must include `VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR`

- If VkBufferOpaqueCaptureAddressCreateInfoKHR::`opaqueCaptureAddress` is not zero, `flags` must include `VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR`

- If `flags` includes `VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR`, the bufferDeviceAddressCaptureReplay or `VkPhysicalDeviceBufferDeviceAddressFeaturesEXT`::`bufferDeviceAddressCaptureReplay` feature must be enabled

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO`

- Each `pNext` member of any structure (including this one) in the `pNext` chain must be either `NULL` or a pointer to a valid instance of VkBufferDeviceAddressCreateInfoEXT, VkBufferOpaqueCaptureAddressCreateInfoKHR, VkDedicatedAllocationBufferCreateInfoNV, or VkExternalMemoryBufferCreateInfo

- Each `sType` member in the `pNext` chain must be unique

- `flags` must be a valid combination of VkBufferCreateFlagBits values

- `usage` must be a valid combination of VkBufferUsageFlagBits values

- `usage` must not be `0`

- `sharingMode` must be a valid VkSharingMode value

## See Also

VkBufferCreateFlags, VkBufferUsageFlags, `VkDeviceSize`, VkSharingMode, VkStructureType, vkCreateBuffer

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.