1// Copyright 2020-2021 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 an image 7 * [[VUID-{refpage}-image-01044]] 8 pname:image must: not already be backed by a memory object 9 * [[VUID-{refpage}-image-01045]] 10 pname:image must: not have been created with any sparse memory binding 11 flags 12 * [[VUID-{refpage}-memoryOffset-01046]] 13 pname:memoryOffset must: be less than the size of pname:memory 14ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] 15 * [[VUID-{refpage}-image-01445]] 16 If pname:image requires a dedicated allocation (as reported by 17 flink:vkGetImageMemoryRequirements2 in 18 slink:VkMemoryDedicatedRequirements::pname:requiresDedicatedAllocation 19 for pname:image), pname:memory must: have been created with 20 slink:VkMemoryDedicatedAllocateInfo::pname:image equal to pname:image 21ifndef::VK_NV_dedicated_allocation_image_aliasing[] 22 * [[VUID-{refpage}-memory-01509]] 23 If the sname:VkMemoryAllocateInfo provided when pname:memory was 24 allocated included a slink:VkMemoryDedicatedAllocateInfo structure in 25 its pname:pNext chain, and 26 slink:VkMemoryDedicatedAllocateInfo::pname:image was not 27 dlink:VK_NULL_HANDLE, then pname:image must: equal 28 slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset 29 must: be zero 30endif::VK_NV_dedicated_allocation_image_aliasing[] 31ifdef::VK_NV_dedicated_allocation_image_aliasing[] 32 * [[VUID-{refpage}-memory-02628]] 33 If the <<features-dedicatedAllocationImageAliasing,dedicated allocation 34 image aliasing>> feature is not enabled, and the 35 sname:VkMemoryAllocateInfo provided when pname:memory was allocated 36 included a slink:VkMemoryDedicatedAllocateInfo structure in its 37 pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image 38 was not dlink:VK_NULL_HANDLE, then pname:image must: equal 39 slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset 40 must: be zero 41 * [[VUID-{refpage}-memory-02629]] 42 If the <<features-dedicatedAllocationImageAliasing,dedicated allocation 43 image aliasing>> feature is enabled, and the sname:VkMemoryAllocateInfo 44 provided when pname:memory was allocated included a 45 slink:VkMemoryDedicatedAllocateInfo structure in its pname:pNext chain, 46 and slink:VkMemoryDedicatedAllocateInfo::pname:image was not 47 dlink:VK_NULL_HANDLE, then pname:memoryOffset must: be zero, and 48 pname:image must: be either equal to 49 slink:VkMemoryDedicatedAllocateInfo::pname:image or an image that was 50 created using the same parameters in slink:VkImageCreateInfo, with the 51 exception that pname:extent and pname:arrayLayers may: differ subject to 52 the following restrictions: every dimension in the pname:extent 53 parameter of the image being bound must: be equal to or smaller than the 54 original image for which the allocation was created; and the 55 pname:arrayLayers parameter of the image being bound must: be equal to 56 or smaller than the original image for which the allocation was created 57endif::VK_NV_dedicated_allocation_image_aliasing[] 58endif::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] 59ifdef::VK_VERSION_1_1[] 60 * [[VUID-{refpage}-None-01901]] 61 If image was created with the ename:VK_IMAGE_CREATE_PROTECTED_BIT bit 62 set, the image must: be bound to a memory object allocated with a memory 63 type that reports ename:VK_MEMORY_PROPERTY_PROTECTED_BIT 64 * [[VUID-{refpage}-None-01902]] 65 If image was created with the ename:VK_IMAGE_CREATE_PROTECTED_BIT bit 66 not set, the image must: not be bound to a memory object created with a 67 memory type that reports ename:VK_MEMORY_PROPERTY_PROTECTED_BIT 68endif::VK_VERSION_1_1[] 69ifdef::VK_NV_dedicated_allocation[] 70 * [[VUID-{refpage}-image-01050]] 71 If pname:image was created with 72 slink:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation 73 equal to ename:VK_TRUE, pname:memory must: have been created with 74 slink:VkDedicatedAllocationMemoryAllocateInfoNV::pname:image equal to an 75 image handle created with identical creation parameters to pname:image 76 and pname:memoryOffset must: be zero 77ifndef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] 78 * [[VUID-{refpage}-image-01051]] 79 If pname:image was not created with 80 slink:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation 81 equal to ename:VK_TRUE, pname:memory must: not have been allocated 82 dedicated for a specific buffer or image 83endif::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] 84endif::VK_NV_dedicated_allocation[] 85ifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 86 * [[VUID-{refpage}-memory-02728]] 87 If the value of slink:VkExportMemoryAllocateInfo::pname:handleTypes used 88 to allocate pname:memory is not `0`, it must: include at least one of 89 the handles set in 90 slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when 91 pname:image was created 92ifndef::VK_ANDROID_external_memory_android_hardware_buffer[] 93 * [[VUID-{refpage}-memory-02729]] 94 If pname:memory was created by a memory import operation, the external 95 handle type of the imported memory must: also have been set in 96 slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when 97 pname:image was created 98endif::VK_ANDROID_external_memory_android_hardware_buffer[] 99ifdef::VK_ANDROID_external_memory_android_hardware_buffer[] 100 * [[VUID-{refpage}-memory-02989]] 101 If pname:memory was created by a memory import operation, that is not 102 slink:VkImportAndroidHardwareBufferInfoANDROID with a non-`NULL` 103 pname:buffer value, the external handle type of the imported memory 104 must: also have been set in 105 slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when 106 pname:image was created 107 * [[VUID-{refpage}-memory-02990]] 108 If pname:memory was created with the 109 slink:VkImportAndroidHardwareBufferInfoANDROID memory import operation 110 with a non-`NULL` pname:buffer value, 111 ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID 112 must: also have been set in 113 slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when 114 pname:image was created 115endif::VK_ANDROID_external_memory_android_hardware_buffer[] 116endif::VK_VERSION_1_1,VK_KHR_external_memory[] 117// Common Valid Usage 118