C Specification

To attach memory to buffer objects for one or more buffers at a time, call:

// Provided by VK_VERSION_1_1
VkResult vkBindBufferMemory2(
    VkDevice                                    device,
    uint32_t                                    bindInfoCount,
    const VkBindBufferMemoryInfo*               pBindInfos);

Parameters

  • device is the logical device that owns the buffers and memory.

  • bindInfoCount is the number of elements in pBindInfos.

  • pBindInfos is a pointer to an array of bindInfoCount VkBindBufferMemoryInfo structures describing buffers and memory to bind.

Description

On some implementations, it may be more efficient to batch memory bindings into a single command.

Note

If vkBindBufferMemory2 fails, and bindInfoCount was greater than one, then the buffers referenced by pBindInfos will be in an indeterminate state, and must not be used. Applications should destroy these buffers.

If VkPhysicalDeviceVulkanSC10Properties::deviceNoDynamicHostAllocations is VK_TRUE, vkBindBufferMemory2 must not return VK_ERROR_OUT_OF_HOST_MEMORY.

Valid Usage (Implicit)
  • VUID-vkBindBufferMemory2-device-parameter
    device must be a valid VkDevice handle

  • VUID-vkBindBufferMemory2-pBindInfos-parameter
    pBindInfos must be a valid pointer to an array of bindInfoCount valid VkBindBufferMemoryInfo structures

  • VUID-vkBindBufferMemory2-bindInfoCount-arraylength
    bindInfoCount must be greater than 0

Return Codes
On success, this command returns
  • VK_SUCCESS

On failure, this command returns
  • VK_ERROR_OUT_OF_HOST_MEMORY

  • VK_ERROR_OUT_OF_DEVICE_MEMORY

See Also

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 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0