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 an image
7  * [[VUID-{refpage}-image-07460]]
8    pname:image must: not have been bound to 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
21  * [[VUID-{refpage}-memory-02628]]
22    If
23ifdef::VK_NV_dedicated_allocation_image_aliasing[]
24    the <<features-dedicatedAllocationImageAliasing,
25    pname:dedicatedAllocationImageAliasing>> feature is not enabled, and
26endif::VK_NV_dedicated_allocation_image_aliasing[]
27    the sname:VkMemoryAllocateInfo provided when pname:memory was allocated
28    included a slink:VkMemoryDedicatedAllocateInfo structure in its
29    pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image
30    was not dlink:VK_NULL_HANDLE, then pname:image must: equal
31    slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset
32    must: be zero
33ifdef::VK_NV_dedicated_allocation_image_aliasing[]
34  * [[VUID-{refpage}-memory-02629]]
35    If the <<features-dedicatedAllocationImageAliasing,
36    pname:dedicatedAllocationImageAliasing>> feature is enabled, and the
37    sname:VkMemoryAllocateInfo provided when pname:memory was allocated
38    included a slink:VkMemoryDedicatedAllocateInfo structure in its
39    pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image
40    was not dlink:VK_NULL_HANDLE, then pname:memoryOffset must: be zero, and
41    pname:image must: be either equal to
42    slink:VkMemoryDedicatedAllocateInfo::pname:image or an image that was
43    created using the same parameters in slink:VkImageCreateInfo, with the
44    exception that pname:extent and pname:arrayLayers may: differ subject to
45    the following restrictions: every dimension in the pname:extent
46    parameter of the image being bound must: be equal to or smaller than the
47    original image for which the allocation was created; and the
48    pname:arrayLayers parameter of the image being bound must: be equal to
49    or smaller than the original image for which the allocation was created
50endif::VK_NV_dedicated_allocation_image_aliasing[]
51endif::VK_VERSION_1_1,VK_KHR_dedicated_allocation[]
52ifdef::VK_VERSION_1_1[]
53  * [[VUID-{refpage}-None-01901]]
54    If image was created with the ename:VK_IMAGE_CREATE_PROTECTED_BIT bit
55    set, the image must: be bound to a memory object allocated with a memory
56    type that reports ename:VK_MEMORY_PROPERTY_PROTECTED_BIT
57  * [[VUID-{refpage}-None-01902]]
58    If image was created with the ename:VK_IMAGE_CREATE_PROTECTED_BIT bit
59    not set, the image must: not be bound to a memory object created with a
60    memory type that reports ename:VK_MEMORY_PROPERTY_PROTECTED_BIT
61endif::VK_VERSION_1_1[]
62ifdef::VK_NV_dedicated_allocation[]
63  * [[VUID-{refpage}-image-01050]]
64    If pname:image was created with
65    slink:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation
66    equal to ename:VK_TRUE, pname:memory must: have been created with
67    slink:VkDedicatedAllocationMemoryAllocateInfoNV::pname:image equal to an
68    image handle created with identical creation parameters to pname:image
69    and pname:memoryOffset must: be zero
70ifndef::VKSC_VERSION_1_0[]
71  * [[VUID-{refpage}-apiVersion-07921]]
72    If
73ifdef::VK_KHR_dedicated_allocation[]
74    the apiext:VK_KHR_dedicated_allocation extension is not enabled,
75endif::VK_KHR_dedicated_allocation[]
76ifdef::VK_VERSION_1_1[]
77    slink:VkPhysicalDeviceProperties::pname:apiVersion is less than Vulkan
78    1.1,
79endif::VK_VERSION_1_1[]
80ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[and]
81    pname:image was not created with
82    slink:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation
83    equal to ename:VK_TRUE, pname:memory must: not have been allocated
84    dedicated for a specific buffer or image
85endif::VKSC_VERSION_1_0[]
86endif::VK_NV_dedicated_allocation[]
87ifdef::VK_VERSION_1_1,VK_KHR_external_memory[]
88  * [[VUID-{refpage}-memory-02728]]
89    If the value of slink:VkExportMemoryAllocateInfo::pname:handleTypes used
90    to allocate pname:memory is not `0`, it must: include at least one of
91    the handles set in
92    slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when
93    pname:image was created
94  * [[VUID-{refpage}-memory-02989]]
95    If pname:memory was created by a memory import operation,
96ifdef::VK_ANDROID_external_memory_android_hardware_buffer[]
97    that is not slink:VkImportAndroidHardwareBufferInfoANDROID with a
98    non-`NULL` pname:buffer value,
99endif::VK_ANDROID_external_memory_android_hardware_buffer[]
100    the external handle type of the imported memory must: also have been set
101    in slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when
102    pname:image was created
103ifdef::VK_ANDROID_external_memory_android_hardware_buffer[]
104  * [[VUID-{refpage}-memory-02990]]
105    If pname:memory was created with the
106    slink:VkImportAndroidHardwareBufferInfoANDROID memory import operation
107    with a non-`NULL` pname:buffer value,
108    ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID
109    must: also have been set in
110    slink:VkExternalMemoryImageCreateInfo::pname:handleTypes when
111    pname:image was created
112endif::VK_ANDROID_external_memory_android_hardware_buffer[]
113endif::VK_VERSION_1_1,VK_KHR_external_memory[]
114ifdef::VK_EXT_descriptor_buffer[]
115  * [[VUID-{refpage}-descriptorBufferCaptureReplay-08113]]
116    If the pname:image was created with the
117    ename:VK_IMAGE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT bit set,
118    pname:memory must: have been allocated with the
119    ename:VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT bit set
120  * [[VUID-{refpage}-image-09202]]
121    If the pname:image was created with the
122    ename:VK_IMAGE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT bit set,
123    pname:memory must: have been allocated with the
124    ename:VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT bit set
125endif::VK_EXT_descriptor_buffer[]
126// Common Valid Usage
127