1// Copyright 2020-2023 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5// Common Valid Usage 6// Common to binding any memory to a buffer 7 * [[VUID-{refpage}-buffer-07459]] 8 pname:buffer must: not have been bound to a memory object 9 * [[VUID-{refpage}-buffer-01030]] 10 pname:buffer must: not have been created with any sparse memory binding 11 flags 12 * [[VUID-{refpage}-memoryOffset-01031]] 13 pname:memoryOffset must: be less than the size of pname:memory 14 * [[VUID-{refpage}-memory-01035]] 15 pname:memory must: have been allocated using one of the memory types 16 allowed in the pname:memoryTypeBits member of the 17 sname:VkMemoryRequirements structure returned from a call to 18 fname:vkGetBufferMemoryRequirements with pname:buffer 19 * [[VUID-{refpage}-memoryOffset-01036]] 20 pname:memoryOffset must: be an integer multiple of the pname:alignment 21 member of the sname:VkMemoryRequirements structure returned from a call 22 to fname:vkGetBufferMemoryRequirements with pname:buffer 23 * [[VUID-{refpage}-size-01037]] 24 The pname:size member of the sname:VkMemoryRequirements structure 25 returned from a call to fname:vkGetBufferMemoryRequirements with 26 pname:buffer must: be less than or equal to the size of pname:memory 27 minus pname:memoryOffset 28ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] 29 * [[VUID-{refpage}-buffer-01444]] 30 If pname:buffer requires a dedicated allocation (as reported by 31 flink:vkGetBufferMemoryRequirements2 in 32 slink:VkMemoryDedicatedRequirements::pname:requiresDedicatedAllocation 33 for pname:buffer), pname:memory must: have been allocated with 34 slink:VkMemoryDedicatedAllocateInfo::pname:buffer equal to pname:buffer 35 * [[VUID-{refpage}-memory-01508]] 36 If the sname:VkMemoryAllocateInfo provided when pname:memory was 37 allocated included a slink:VkMemoryDedicatedAllocateInfo structure in 38 its pname:pNext chain, and 39 slink:VkMemoryDedicatedAllocateInfo::pname:buffer was not 40 dlink:VK_NULL_HANDLE, then pname:buffer must: equal 41 slink:VkMemoryDedicatedAllocateInfo::pname:buffer, and 42 pname:memoryOffset must: be zero 43endif::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] 44ifdef::VK_VERSION_1_1[] 45 * [[VUID-{refpage}-None-01898]] 46 If pname:buffer was created with the 47 ename:VK_BUFFER_CREATE_PROTECTED_BIT bit set, the buffer must: be bound 48 to a memory object allocated with a memory type that reports 49 ename:VK_MEMORY_PROPERTY_PROTECTED_BIT 50 * [[VUID-{refpage}-None-01899]] 51 If pname:buffer was created with the 52 ename:VK_BUFFER_CREATE_PROTECTED_BIT bit not set, the buffer must: not 53 be bound to a memory object allocated with a memory type that reports 54 ename:VK_MEMORY_PROPERTY_PROTECTED_BIT 55endif::VK_VERSION_1_1[] 56ifdef::VK_NV_dedicated_allocation[] 57 * [[VUID-{refpage}-buffer-01038]] 58 If pname:buffer was created with 59 slink:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation 60 equal to ename:VK_TRUE, pname:memory must: have been allocated with 61 slink:VkDedicatedAllocationMemoryAllocateInfoNV::pname:buffer equal to a 62 buffer handle created with identical creation parameters to pname:buffer 63 and pname:memoryOffset must: be zero 64ifndef::VKSC_VERSION_1_0[] 65 * [[VUID-{refpage}-apiVersion-07920]] 66 If 67ifdef::VK_KHR_dedicated_allocation[] 68 the apiext:VK_KHR_dedicated_allocation extension is not enabled, 69endif::VK_KHR_dedicated_allocation[] 70ifdef::VK_VERSION_1_1[] 71 slink:VkPhysicalDeviceProperties::pname:apiVersion is less than Vulkan 72 1.1, 73endif::VK_VERSION_1_1[] 74ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[and] 75 pname:buffer was not created with 76 slink:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation 77 equal to ename:VK_TRUE, pname:memory must: not have been allocated 78 dedicated for a specific buffer or image 79endif::VKSC_VERSION_1_0[] 80endif::VK_NV_dedicated_allocation[] 81ifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 82 * [[VUID-{refpage}-memory-02726]] 83 If the value of slink:VkExportMemoryAllocateInfo::pname:handleTypes used 84 to allocate pname:memory is not `0`, it must: include at least one of 85 the handles set in 86 slink:VkExternalMemoryBufferCreateInfo::pname:handleTypes when 87 pname:buffer was created 88 * [[VUID-{refpage}-memory-02985]] 89 If pname:memory was allocated by a memory import operation, 90ifdef::VK_ANDROID_external_memory_android_hardware_buffer[] 91 that is not slink:VkImportAndroidHardwareBufferInfoANDROID with a 92 non-`NULL` pname:buffer value, 93endif::VK_ANDROID_external_memory_android_hardware_buffer[] 94 the external handle type of the imported memory must: also have been set 95 in slink:VkExternalMemoryBufferCreateInfo::pname:handleTypes when 96 pname:buffer was created 97ifdef::VK_ANDROID_external_memory_android_hardware_buffer[] 98 * [[VUID-{refpage}-memory-02986]] 99 If pname:memory was allocated with the 100 slink:VkImportAndroidHardwareBufferInfoANDROID memory import operation 101 with a non-`NULL` pname:buffer value, 102 ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID 103 must: also have been set in 104 slink:VkExternalMemoryBufferCreateInfo::pname:handleTypes when 105 pname:buffer was created 106endif::VK_ANDROID_external_memory_android_hardware_buffer[] 107endif::VK_VERSION_1_1,VK_KHR_external_memory[] 108ifdef::VK_VERSION_1_2,VK_KHR_buffer_device_address[] 109 * [[VUID-{refpage}-bufferDeviceAddress-03339]] 110 If the 111 slink:VkPhysicalDeviceBufferDeviceAddressFeatures::pname:bufferDeviceAddress 112 feature is enabled and pname:buffer was created with the 113 ename:VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT bit set, pname:memory 114 must: have been allocated with the 115 ename:VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT bit set 116 * [[VUID-{refpage}-bufferDeviceAddressCaptureReplay-09200]] 117 If the 118 slink:VkPhysicalDeviceBufferDeviceAddressFeatures::pname:bufferDeviceAddressCaptureReplay 119 feature is enabled and pname:buffer was created with the 120 ename:VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT bit set, 121 pname:memory must: have been allocated with the 122 ename:VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT bit set 123endif::VK_VERSION_1_2,VK_KHR_buffer_device_address[] 124ifdef::VK_FUCHSIA_buffer_collection[] 125 * [[VUID-{refpage}-buffer-06408]] 126 If pname:buffer was created with 127 slink:VkBufferCollectionBufferCreateInfoFUCHSIA chained to 128 slink:VkBufferCreateInfo::pname:pNext, pname:memory must: be allocated 129 with a slink:VkImportMemoryBufferCollectionFUCHSIA chained to 130 slink:VkMemoryAllocateInfo::pname:pNext 131endif::VK_FUCHSIA_buffer_collection[] 132ifdef::VK_EXT_descriptor_buffer[] 133 * [[VUID-{refpage}-descriptorBufferCaptureReplay-08112]] 134 If the pname:buffer was created with the 135 ename:VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT bit set, 136 pname:memory must: have been allocated with the 137 ename:VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT bit set 138 * [[VUID-{refpage}-buffer-09201]] 139 If the pname:buffer was created with the 140 ename:VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT bit set, 141 pname:memory must: have been allocated with the 142 ename:VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT bit set 143endif::VK_EXT_descriptor_buffer[] 144// Common Valid Usage 145