# VkBindBufferMemoryInfo(3) Manual Page

## Name

VkBindBufferMemoryInfo - Structure specifying how to bind a buffer to memory

## C Specification

`VkBindBufferMemoryInfo` contains members corresponding to the parameters of vkBindBufferMemory.

The `VkBindBufferMemoryInfo` structure is defined as:

    typedef struct VkBindBufferMemoryInfo {
        VkStructureType    sType;
        const void*        pNext;
        VkBuffer           buffer;
        VkDeviceMemory     memory;
        VkDeviceSize       memoryOffset;
    } VkBindBufferMemoryInfo;

or the equivalent

    typedef VkBindBufferMemoryInfo VkBindBufferMemoryInfoKHR;

## Members

- `sType` is the type of this structure.

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

- `buffer` is the buffer to be attached to memory.

- `memory` is a VkDeviceMemory object describing the device memory to attach.

- `memoryOffset` is the start offset of the region of `memory` which is to be bound to the buffer. The number of bytes returned in the `VkMemoryRequirements`::`size` member in `memory`, starting from `memoryOffset` bytes, will be bound to the specified buffer.

## Description

Valid Usage

- `buffer` must not already be backed by a memory object

- `buffer` must not have been created with any sparse memory binding flags

- `memoryOffset` must be less than the size of `memory`

- `memory` must have been allocated using one of the memory types allowed in the `memoryTypeBits` member of the `VkMemoryRequirements` structure returned from a call to `vkGetBufferMemoryRequirements` with `buffer`

- `memoryOffset` must be an integer multiple of the `alignment` member of the `VkMemoryRequirements` structure returned from a call to `vkGetBufferMemoryRequirements` with `buffer`

- The `size` member of the `VkMemoryRequirements` structure returned from a call to `vkGetBufferMemoryRequirements` with `buffer` must be less than or equal to the size of `memory` minus `memoryOffset`

- If `buffer` requires a dedicated allocation(as reported by vkGetBufferMemoryRequirements2 in VkMemoryDedicatedRequirements::requiresDedicatedAllocation for `buffer`), `memory` must have been created with VkMemoryDedicatedAllocateInfo::`buffer` equal to `buffer` and `memoryOffset` must be zero

- If the `VkMemoryAllocateInfo` provided when `memory` was allocated included a VkMemoryDedicatedAllocateInfo structure in its `pNext` chain, and VkMemoryDedicatedAllocateInfo::`buffer` was not VK_NULL_HANDLE, then `buffer` must equal VkMemoryDedicatedAllocateInfo::`buffer` and `memoryOffset` must be zero.

- If `buffer` was created with VkDedicatedAllocationBufferCreateInfoNV::`dedicatedAllocation` equal to `VK_TRUE`, `memory` must have been created with VkDedicatedAllocationMemoryAllocateInfoNV::`buffer` equal to `buffer` and `memoryOffset` must be zero

- If the `pNext` chain includes a VkBindBufferMemoryDeviceGroupInfo structure, all instances of `memory` specified by VkBindBufferMemoryDeviceGroupInfo::`pDeviceIndices` must have been allocated

- If the value of VkExportMemoryAllocateInfo::`handleTypes` used to allocate `memory` is not `0`, it must include at least one of the handles set in VkExternalMemoryBufferCreateInfo::`handleTypes` when `buffer` was created

- If `memory` was created by a memory import operation, the external handle type of the imported memory must also have been set in VkExternalMemoryBufferCreateInfo::`handleTypes` when `buffer` was created

- If the VkPhysicalDeviceBufferDeviceAddressFeaturesKHR::`bufferDeviceAddress` feature is enabled and `buffer` was created with the `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR` bit set, `memory` must have been allocated with the `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR` bit set

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO`

- `pNext` must be `NULL` or a pointer to a valid instance of VkBindBufferMemoryDeviceGroupInfo

- The `sType` value of each struct in the `pNext` chain must be unique

- `buffer` must be a valid VkBuffer handle

- `memory` must be a valid VkDeviceMemory handle

- Both of `buffer`, and `memory` must have been created, allocated, or retrieved from the same VkDevice

## See Also

VkBuffer, VkDeviceMemory, `VkDeviceSize`, VkStructureType, vkBindBufferMemory2, vkBindBufferMemory2KHR

## 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-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.