1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[clears]]
6e5c31af7Sopenharmony_ci= Clear Commands
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ci
9e5c31af7Sopenharmony_ci[[clears-outside]]
10e5c31af7Sopenharmony_ci== Clearing Images Outside A Render Pass Instance
11e5c31af7Sopenharmony_ci
12e5c31af7Sopenharmony_ciColor and depth/stencil images can: be cleared outside a render pass
13e5c31af7Sopenharmony_ciinstance using flink:vkCmdClearColorImage or
14e5c31af7Sopenharmony_ciflink:vkCmdClearDepthStencilImage, respectively.
15e5c31af7Sopenharmony_ciThese commands are only allowed outside of a render pass instance.
16e5c31af7Sopenharmony_ci
17e5c31af7Sopenharmony_ci[open,refpage='vkCmdClearColorImage',desc='Clear regions of a color image',type='protos']
18e5c31af7Sopenharmony_ci--
19e5c31af7Sopenharmony_ciTo clear one or more subranges of a color image, call:
20e5c31af7Sopenharmony_ci
21e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdClearColorImage.txt[]
22e5c31af7Sopenharmony_ci
23e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
24e5c31af7Sopenharmony_ci    recorded.
25e5c31af7Sopenharmony_ci  * pname:image is the image to be cleared.
26e5c31af7Sopenharmony_ci  * pname:imageLayout specifies the current layout of the image subresource
27e5c31af7Sopenharmony_ci    ranges to be cleared, and must: be
28e5c31af7Sopenharmony_ciifdef::VK_KHR_shared_presentable_image[]
29e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR,
30e5c31af7Sopenharmony_ciendif::VK_KHR_shared_presentable_image[]
31e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_GENERAL or
32e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL.
33e5c31af7Sopenharmony_ci  * pname:pColor is a pointer to a slink:VkClearColorValue structure
34e5c31af7Sopenharmony_ci    containing the values that the image subresource ranges will be cleared
35e5c31af7Sopenharmony_ci    to (see <<clears-values>> below).
36e5c31af7Sopenharmony_ci  * pname:rangeCount is the number of image subresource range structures in
37e5c31af7Sopenharmony_ci    pname:pRanges.
38e5c31af7Sopenharmony_ci  * pname:pRanges is a pointer to an array of slink:VkImageSubresourceRange
39e5c31af7Sopenharmony_ci    structures describing a range of mipmap levels, array layers, and
40e5c31af7Sopenharmony_ci    aspects to be cleared, as described in <<resources-image-views,Image
41e5c31af7Sopenharmony_ci    Views>>.
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_ciEach specified range in pname:pRanges is cleared to the value specified by
44e5c31af7Sopenharmony_cipname:pColor.
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ci.Valid Usage
47e5c31af7Sopenharmony_ci****
48e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
49e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-image-01993]]
50e5c31af7Sopenharmony_ci    The <<resources-image-format-features,format features>> of pname:image
51e5c31af7Sopenharmony_ci    must: contain ename:VK_FORMAT_FEATURE_TRANSFER_DST_BIT
52e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
53e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-image-00002]]
54e5c31af7Sopenharmony_ci    pname:image must: have been created with
55e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag
56e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
57e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-image-01545]]
58e5c31af7Sopenharmony_ci    pname:image must: not use any of the
59e5c31af7Sopenharmony_ci    <<formats-requiring-sampler-ycbcr-conversion, formats that require a
60e5c31af7Sopenharmony_ci    sampler Y'C~B~C~R~ conversion>>
61e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
62e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-image-00003]]
63e5c31af7Sopenharmony_ci    If pname:image is non-sparse then it must: be bound completely and
64e5c31af7Sopenharmony_ci    contiguously to a single sname:VkDeviceMemory object
65e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-imageLayout-00004]]
66e5c31af7Sopenharmony_ci    pname:imageLayout must: specify the layout of the image subresource
67e5c31af7Sopenharmony_ci    ranges of pname:image specified in pname:pRanges at the time this
68e5c31af7Sopenharmony_ci    command is executed on a sname:VkDevice
69e5c31af7Sopenharmony_ciifndef::VK_KHR_shared_presentable_image[]
70e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-imageLayout-00005]]
71e5c31af7Sopenharmony_ci    pname:imageLayout must: be ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or
72e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_GENERAL
73e5c31af7Sopenharmony_ciendif::VK_KHR_shared_presentable_image[]
74e5c31af7Sopenharmony_ciifdef::VK_KHR_shared_presentable_image[]
75e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-imageLayout-01394]]
76e5c31af7Sopenharmony_ci    pname:imageLayout must: be ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
77e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_GENERAL, or
78e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
79e5c31af7Sopenharmony_ciendif::VK_KHR_shared_presentable_image[]
80e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-aspectMask-02498]]
81e5c31af7Sopenharmony_ci    The slink:VkImageSubresourceRange::pname:aspectMask members of the
82e5c31af7Sopenharmony_ci    elements of the pname:pRanges array must: each only include
83e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_COLOR_BIT
84e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-baseMipLevel-01470]]
85e5c31af7Sopenharmony_ci    The slink:VkImageSubresourceRange::pname:baseMipLevel members of the
86e5c31af7Sopenharmony_ci    elements of the pname:pRanges array must: each be less than the
87e5c31af7Sopenharmony_ci    pname:mipLevels specified in slink:VkImageCreateInfo when pname:image
88e5c31af7Sopenharmony_ci    was created
89e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-pRanges-01692]]
90e5c31af7Sopenharmony_ci    For each slink:VkImageSubresourceRange element of pname:pRanges, if the
91e5c31af7Sopenharmony_ci    pname:levelCount member is not ename:VK_REMAINING_MIP_LEVELS, then
92e5c31af7Sopenharmony_ci    [eq]#pname:baseMipLevel {plus} pname:levelCount# must: be less than the
93e5c31af7Sopenharmony_ci    pname:mipLevels specified in slink:VkImageCreateInfo when pname:image
94e5c31af7Sopenharmony_ci    was created
95e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-baseArrayLayer-01472]]
96e5c31af7Sopenharmony_ci    The slink:VkImageSubresourceRange::pname:baseArrayLayer members of the
97e5c31af7Sopenharmony_ci    elements of the pname:pRanges array must: each be less than the
98e5c31af7Sopenharmony_ci    pname:arrayLayers specified in slink:VkImageCreateInfo when pname:image
99e5c31af7Sopenharmony_ci    was created
100e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-pRanges-01693]]
101e5c31af7Sopenharmony_ci    For each slink:VkImageSubresourceRange element of pname:pRanges, if the
102e5c31af7Sopenharmony_ci    pname:layerCount member is not ename:VK_REMAINING_ARRAY_LAYERS, then
103e5c31af7Sopenharmony_ci    [eq]#pname:baseArrayLayer {plus} pname:layerCount# must: be less than
104e5c31af7Sopenharmony_ci    the pname:arrayLayers specified in slink:VkImageCreateInfo when
105e5c31af7Sopenharmony_ci    pname:image was created
106e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-image-00007]]
107e5c31af7Sopenharmony_ci    pname:image must: not have a compressed or depth/stencil format
108e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-pColor-04961]]
109e5c31af7Sopenharmony_ci    pname:pColor must: be a valid pointer to a slink:VkClearColorValue union
110e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[]
111e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-commandBuffer-01805]]
112e5c31af7Sopenharmony_ci    If pname:commandBuffer is an unprotected command buffer and
113e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
114e5c31af7Sopenharmony_ci    pname:image must: not be a protected image
115e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearColorImage-commandBuffer-01806]]
116e5c31af7Sopenharmony_ci    If pname:commandBuffer is a protected command buffer and
117e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
118e5c31af7Sopenharmony_ci    must: not be an unprotected image
119e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[]
120e5c31af7Sopenharmony_ci****
121e5c31af7Sopenharmony_ci
122e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdClearColorImage.txt[]
123e5c31af7Sopenharmony_ci--
124e5c31af7Sopenharmony_ci
125e5c31af7Sopenharmony_ci[open,refpage='vkCmdClearDepthStencilImage',desc='Fill regions of a combined depth/stencil image',type='protos']
126e5c31af7Sopenharmony_ci--
127e5c31af7Sopenharmony_ciTo clear one or more subranges of a depth/stencil image, call:
128e5c31af7Sopenharmony_ci
129e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdClearDepthStencilImage.txt[]
130e5c31af7Sopenharmony_ci
131e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
132e5c31af7Sopenharmony_ci    recorded.
133e5c31af7Sopenharmony_ci  * pname:image is the image to be cleared.
134e5c31af7Sopenharmony_ci  * pname:imageLayout specifies the current layout of the image subresource
135e5c31af7Sopenharmony_ci    ranges to be cleared, and must: be ename:VK_IMAGE_LAYOUT_GENERAL or
136e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL.
137e5c31af7Sopenharmony_ci  * pname:pDepthStencil is a pointer to a slink:VkClearDepthStencilValue
138e5c31af7Sopenharmony_ci    structure containing the values that the depth and stencil image
139e5c31af7Sopenharmony_ci    subresource ranges will be cleared to (see <<clears-values>> below).
140e5c31af7Sopenharmony_ci  * pname:rangeCount is the number of image subresource range structures in
141e5c31af7Sopenharmony_ci    pname:pRanges.
142e5c31af7Sopenharmony_ci  * pname:pRanges is a pointer to an array of slink:VkImageSubresourceRange
143e5c31af7Sopenharmony_ci    structures describing a range of mipmap levels, array layers, and
144e5c31af7Sopenharmony_ci    aspects to be cleared, as described in <<resources-image-views,Image
145e5c31af7Sopenharmony_ci    Views>>.
146e5c31af7Sopenharmony_ci
147e5c31af7Sopenharmony_ci.Valid Usage
148e5c31af7Sopenharmony_ci****
149e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
150e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-image-01994]]
151e5c31af7Sopenharmony_ci    The <<resources-image-format-features,format features>> of pname:image
152e5c31af7Sopenharmony_ci    must: contain ename:VK_FORMAT_FEATURE_TRANSFER_DST_BIT
153e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
154e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
155e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-image-00009]]
156e5c31af7Sopenharmony_ci    pname:image must: have been created with
157e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag
158e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
159e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
160e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-pRanges-02658]]
161e5c31af7Sopenharmony_ci    If the pname:aspect member of any element of pname:pRanges includes
162e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_STENCIL_BIT, and pname:image was created with
163e5c31af7Sopenharmony_ci    <<VkImageStencilUsageCreateInfo,separate stencil usage>>,
164e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT must: have been included in the
165e5c31af7Sopenharmony_ci    slink:VkImageStencilUsageCreateInfo::pname:stencilUsage used to create
166e5c31af7Sopenharmony_ci    pname:image
167e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-pRanges-02659]]
168e5c31af7Sopenharmony_ci    If the pname:aspect member of any element of pname:pRanges includes
169e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_STENCIL_BIT, and pname:image was not created with
170e5c31af7Sopenharmony_ci    <<VkImageStencilUsageCreateInfo,separate stencil usage>>,
171e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT must: have been included in the
172e5c31af7Sopenharmony_ci    slink:VkImageCreateInfo::pname:usage used to create pname:image
173e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-pRanges-02660]]
174e5c31af7Sopenharmony_ci    If the pname:aspect member of any element of pname:pRanges includes
175e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_DEPTH_BIT, ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT
176e5c31af7Sopenharmony_ci    must: have been included in the slink:VkImageCreateInfo::pname:usage
177e5c31af7Sopenharmony_ci    used to create pname:image
178e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
179e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-image-00010]]
180e5c31af7Sopenharmony_ci    If pname:image is non-sparse then it must: be bound completely and
181e5c31af7Sopenharmony_ci    contiguously to a single sname:VkDeviceMemory object
182e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-imageLayout-00011]]
183e5c31af7Sopenharmony_ci    pname:imageLayout must: specify the layout of the image subresource
184e5c31af7Sopenharmony_ci    ranges of pname:image specified in pname:pRanges at the time this
185e5c31af7Sopenharmony_ci    command is executed on a sname:VkDevice
186e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-imageLayout-00012]]
187e5c31af7Sopenharmony_ci    pname:imageLayout must: be either of
188e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or
189e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_GENERAL
190e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-aspectMask-02824]]
191e5c31af7Sopenharmony_ci    The slink:VkImageSubresourceRange::pname:aspectMask member of each
192e5c31af7Sopenharmony_ci    element of the pname:pRanges array must: not include bits other than
193e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_DEPTH_BIT or ename:VK_IMAGE_ASPECT_STENCIL_BIT
194e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-image-02825]]
195e5c31af7Sopenharmony_ci    If the pname:image's format does not have a stencil component, then the
196e5c31af7Sopenharmony_ci    slink:VkImageSubresourceRange::pname:aspectMask member of each element
197e5c31af7Sopenharmony_ci    of the pname:pRanges array must: not include the
198e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_STENCIL_BIT bit
199e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-image-02826]]
200e5c31af7Sopenharmony_ci    If the pname:image's format does not have a depth component, then the
201e5c31af7Sopenharmony_ci    slink:VkImageSubresourceRange::pname:aspectMask member of each element
202e5c31af7Sopenharmony_ci    of the pname:pRanges array must: not include the
203e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_DEPTH_BIT bit
204e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-baseMipLevel-01474]]
205e5c31af7Sopenharmony_ci    The slink:VkImageSubresourceRange::pname:baseMipLevel members of the
206e5c31af7Sopenharmony_ci    elements of the pname:pRanges array must: each be less than the
207e5c31af7Sopenharmony_ci    pname:mipLevels specified in slink:VkImageCreateInfo when pname:image
208e5c31af7Sopenharmony_ci    was created
209e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-pRanges-01694]]
210e5c31af7Sopenharmony_ci    For each slink:VkImageSubresourceRange element of pname:pRanges, if the
211e5c31af7Sopenharmony_ci    pname:levelCount member is not ename:VK_REMAINING_MIP_LEVELS, then
212e5c31af7Sopenharmony_ci    [eq]#pname:baseMipLevel {plus} pname:levelCount# must: be less than the
213e5c31af7Sopenharmony_ci    pname:mipLevels specified in slink:VkImageCreateInfo when pname:image
214e5c31af7Sopenharmony_ci    was created
215e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-baseArrayLayer-01476]]
216e5c31af7Sopenharmony_ci    The slink:VkImageSubresourceRange::pname:baseArrayLayer members of the
217e5c31af7Sopenharmony_ci    elements of the pname:pRanges array must: each be less than the
218e5c31af7Sopenharmony_ci    pname:arrayLayers specified in slink:VkImageCreateInfo when pname:image
219e5c31af7Sopenharmony_ci    was created
220e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-pRanges-01695]]
221e5c31af7Sopenharmony_ci    For each slink:VkImageSubresourceRange element of pname:pRanges, if the
222e5c31af7Sopenharmony_ci    pname:layerCount member is not ename:VK_REMAINING_ARRAY_LAYERS, then
223e5c31af7Sopenharmony_ci    [eq]#pname:baseArrayLayer {plus} pname:layerCount# must: be less than
224e5c31af7Sopenharmony_ci    the pname:arrayLayers specified in slink:VkImageCreateInfo when
225e5c31af7Sopenharmony_ci    pname:image was created
226e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-image-00014]]
227e5c31af7Sopenharmony_ci    pname:image must: have a depth/stencil format
228e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[]
229e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-commandBuffer-01807]]
230e5c31af7Sopenharmony_ci    If pname:commandBuffer is an unprotected command buffer and
231e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
232e5c31af7Sopenharmony_ci    pname:image must: not be a protected image
233e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearDepthStencilImage-commandBuffer-01808]]
234e5c31af7Sopenharmony_ci    If pname:commandBuffer is a protected command buffer and
235e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
236e5c31af7Sopenharmony_ci    pname:image must: not be an unprotected image
237e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[]
238e5c31af7Sopenharmony_ci****
239e5c31af7Sopenharmony_ci
240e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdClearDepthStencilImage.txt[]
241e5c31af7Sopenharmony_ci--
242e5c31af7Sopenharmony_ci
243e5c31af7Sopenharmony_ciClears outside render pass instances are treated as transfer operations for
244e5c31af7Sopenharmony_cithe purposes of memory barriers.
245e5c31af7Sopenharmony_ci
246e5c31af7Sopenharmony_ci
247e5c31af7Sopenharmony_ci[[clears-inside]]
248e5c31af7Sopenharmony_ci== Clearing Images Inside A Render Pass Instance
249e5c31af7Sopenharmony_ci
250e5c31af7Sopenharmony_ci[open,refpage='vkCmdClearAttachments',desc='Clear regions within bound framebuffer attachments',type='protos']
251e5c31af7Sopenharmony_ci--
252e5c31af7Sopenharmony_ciTo clear one or more regions of color and depth/stencil attachments inside a
253e5c31af7Sopenharmony_cirender pass instance, call:
254e5c31af7Sopenharmony_ci
255e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdClearAttachments.txt[]
256e5c31af7Sopenharmony_ci
257e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
258e5c31af7Sopenharmony_ci    recorded.
259e5c31af7Sopenharmony_ci  * pname:attachmentCount is the number of entries in the pname:pAttachments
260e5c31af7Sopenharmony_ci    array.
261e5c31af7Sopenharmony_ci  * pname:pAttachments is a pointer to an array of slink:VkClearAttachment
262e5c31af7Sopenharmony_ci    structures defining the attachments to clear and the clear values to
263e5c31af7Sopenharmony_ci    use.
264e5c31af7Sopenharmony_ci    If any attachment index to be cleared is not backed by an image view,
265e5c31af7Sopenharmony_ci    then the clear has no effect.
266e5c31af7Sopenharmony_ci  * pname:rectCount is the number of entries in the pname:pRects array.
267e5c31af7Sopenharmony_ci  * pname:pRects is a pointer to an array of slink:VkClearRect structures
268e5c31af7Sopenharmony_ci    defining regions within each selected attachment to clear.
269e5c31af7Sopenharmony_ci
270e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[]
271e5c31af7Sopenharmony_ciIf the render pass has a <<renderpass-fragmentdensitymapattachment,fragment
272e5c31af7Sopenharmony_cidensity map attachment>>, clears follow the
273e5c31af7Sopenharmony_ci<<fragmentdensitymapops,operations of fragment density maps>> as if each
274e5c31af7Sopenharmony_ciclear region was a primitive which generates fragments.
275e5c31af7Sopenharmony_ciThe clear color is applied to all pixels inside each fragment's area
276e5c31af7Sopenharmony_ciregardless if the pixels lie outside of the clear region.
277e5c31af7Sopenharmony_ciClears may: have a different set of supported fragment areas than draws.
278e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[]
279e5c31af7Sopenharmony_ci
280e5c31af7Sopenharmony_ciUnlike other <<clears,clear commands>>, flink:vkCmdClearAttachments executes
281e5c31af7Sopenharmony_cias a drawing command, rather than a transfer command, with writes performed
282e5c31af7Sopenharmony_ciby it executing in <<primsrast-order, rasterization order>>.
283e5c31af7Sopenharmony_ciClears to color attachments are executed as color attachment writes, by the
284e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT stage.
285e5c31af7Sopenharmony_ciClears to depth/stencil attachments are executed as <<fragops-depth, depth
286e5c31af7Sopenharmony_ciwrites>> and <<fragops-stencil, writes>> by the
287e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT and
288e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT stages.
289e5c31af7Sopenharmony_ci
290e5c31af7Sopenharmony_cifname:vkCmdClearAttachments is not affected by the bound pipeline state.
291e5c31af7Sopenharmony_ci
292e5c31af7Sopenharmony_ci[NOTE]
293e5c31af7Sopenharmony_ci.Note
294e5c31af7Sopenharmony_ci====
295e5c31af7Sopenharmony_ciIt is generally preferable to clear attachments by using the
296e5c31af7Sopenharmony_ciename:VK_ATTACHMENT_LOAD_OP_CLEAR load operation at the start of rendering,
297e5c31af7Sopenharmony_cias it is more efficient on some implementations.
298e5c31af7Sopenharmony_ci====
299e5c31af7Sopenharmony_ci
300e5c31af7Sopenharmony_ci.Valid Usage
301e5c31af7Sopenharmony_ci****
302e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-aspectMask-02501]]
303e5c31af7Sopenharmony_ci    If the pname:aspectMask member of any element of pname:pAttachments
304e5c31af7Sopenharmony_ci    contains ename:VK_IMAGE_ASPECT_COLOR_BIT, then the pname:colorAttachment
305e5c31af7Sopenharmony_ci    member of that element must: either refer to a color attachment which is
306e5c31af7Sopenharmony_ci    ename:VK_ATTACHMENT_UNUSED, or must: be a valid color attachment
307e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-aspectMask-02502]]
308e5c31af7Sopenharmony_ci    If the pname:aspectMask member of any element of pname:pAttachments
309e5c31af7Sopenharmony_ci    contains ename:VK_IMAGE_ASPECT_DEPTH_BIT, then the current subpass'
310e5c31af7Sopenharmony_ci    depth/stencil attachment must: either be ename:VK_ATTACHMENT_UNUSED, or
311e5c31af7Sopenharmony_ci    must: have a depth component
312e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-aspectMask-02503]]
313e5c31af7Sopenharmony_ci    If the pname:aspectMask member of any element of pname:pAttachments
314e5c31af7Sopenharmony_ci    contains ename:VK_IMAGE_ASPECT_STENCIL_BIT, then the current subpass'
315e5c31af7Sopenharmony_ci    depth/stencil attachment must: either be ename:VK_ATTACHMENT_UNUSED, or
316e5c31af7Sopenharmony_ci    must: have a stencil component
317e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-rect-02682]]
318e5c31af7Sopenharmony_ci    The pname:rect member of each element of pname:pRects must: have an
319e5c31af7Sopenharmony_ci    pname:extent.width greater than `0`
320e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-rect-02683]]
321e5c31af7Sopenharmony_ci    The pname:rect member of each element of pname:pRects must: have an
322e5c31af7Sopenharmony_ci    pname:extent.height greater than `0`
323e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-pRects-00016]]
324e5c31af7Sopenharmony_ci    The rectangular region specified by each element of pname:pRects must:
325e5c31af7Sopenharmony_ci    be contained within the render area of the current render pass instance
326e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-pRects-00017]]
327e5c31af7Sopenharmony_ci    The layers specified by each element of pname:pRects must: be contained
328e5c31af7Sopenharmony_ci    within every attachment that pname:pAttachments refers to
329e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-layerCount-01934]]
330e5c31af7Sopenharmony_ci    The pname:layerCount member of each element of pname:pRects must: not be
331e5c31af7Sopenharmony_ci    `0`
332e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[]
333e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-commandBuffer-02504]]
334e5c31af7Sopenharmony_ci    If pname:commandBuffer is an unprotected command buffer and
335e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
336e5c31af7Sopenharmony_ci    each attachment to be cleared must: not be a protected image
337e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-commandBuffer-02505]]
338e5c31af7Sopenharmony_ci    If pname:commandBuffer is a protected command buffer and
339e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
340e5c31af7Sopenharmony_ci    each attachment to be cleared must: not be an unprotected image
341e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[]
342e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[]
343e5c31af7Sopenharmony_ci  * [[VUID-vkCmdClearAttachments-baseArrayLayer-00018]]
344e5c31af7Sopenharmony_ci    If the render pass instance this is recorded in uses multiview, then
345e5c31af7Sopenharmony_ci    pname:baseArrayLayer must: be zero and pname:layerCount must: be one
346e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[]
347e5c31af7Sopenharmony_ci****
348e5c31af7Sopenharmony_ci
349e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdClearAttachments.txt[]
350e5c31af7Sopenharmony_ci--
351e5c31af7Sopenharmony_ci
352e5c31af7Sopenharmony_ci[open,refpage='VkClearRect',desc='Structure specifying a clear rectangle',type='structs']
353e5c31af7Sopenharmony_ci--
354e5c31af7Sopenharmony_ciThe sname:VkClearRect structure is defined as:
355e5c31af7Sopenharmony_ci
356e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkClearRect.txt[]
357e5c31af7Sopenharmony_ci
358e5c31af7Sopenharmony_ci  * pname:rect is the two-dimensional region to be cleared.
359e5c31af7Sopenharmony_ci  * pname:baseArrayLayer is the first layer to be cleared.
360e5c31af7Sopenharmony_ci  * pname:layerCount is the number of layers to clear.
361e5c31af7Sopenharmony_ci
362e5c31af7Sopenharmony_ciThe layers [eq]#[pname:baseArrayLayer, pname:baseArrayLayer {plus}
363e5c31af7Sopenharmony_cipname:layerCount)# counting from the base layer of the attachment image view
364e5c31af7Sopenharmony_ciare cleared.
365e5c31af7Sopenharmony_ci
366e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkClearRect.txt[]
367e5c31af7Sopenharmony_ci--
368e5c31af7Sopenharmony_ci
369e5c31af7Sopenharmony_ci[open,refpage='VkClearAttachment',desc='Structure specifying a clear attachment',type='structs']
370e5c31af7Sopenharmony_ci--
371e5c31af7Sopenharmony_ciThe sname:VkClearAttachment structure is defined as:
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkClearAttachment.txt[]
374e5c31af7Sopenharmony_ci
375e5c31af7Sopenharmony_ci  * pname:aspectMask is a mask selecting the color, depth and/or stencil
376e5c31af7Sopenharmony_ci    aspects of the attachment to be cleared.
377e5c31af7Sopenharmony_ci  * pname:colorAttachment is only meaningful if
378e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_COLOR_BIT is set in pname:aspectMask, in which
379e5c31af7Sopenharmony_ci    case it is an index into the currently bound color attachments.
380e5c31af7Sopenharmony_ci  * pname:clearValue is the color or depth/stencil value to clear the
381e5c31af7Sopenharmony_ci    attachment to, as described in <<clears-values,Clear Values>> below.
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ci.Valid Usage
384e5c31af7Sopenharmony_ci****
385e5c31af7Sopenharmony_ci  * [[VUID-VkClearAttachment-aspectMask-00019]]
386e5c31af7Sopenharmony_ci    If pname:aspectMask includes ename:VK_IMAGE_ASPECT_COLOR_BIT, it must:
387e5c31af7Sopenharmony_ci    not include ename:VK_IMAGE_ASPECT_DEPTH_BIT or
388e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_STENCIL_BIT
389e5c31af7Sopenharmony_ci  * [[VUID-VkClearAttachment-aspectMask-00020]]
390e5c31af7Sopenharmony_ci    pname:aspectMask must: not include ename:VK_IMAGE_ASPECT_METADATA_BIT
391e5c31af7Sopenharmony_ciifdef::VK_EXT_image_drm_format_modifier[]
392e5c31af7Sopenharmony_ci  * [[VUID-VkClearAttachment-aspectMask-02246]]
393e5c31af7Sopenharmony_ci    pname:aspectMask must: not include
394e5c31af7Sopenharmony_ci    `VK_IMAGE_ASPECT_MEMORY_PLANE__{ibit}__BIT_EXT` for any index _i_
395e5c31af7Sopenharmony_ciendif::VK_EXT_image_drm_format_modifier[]
396e5c31af7Sopenharmony_ci  * [[VUID-VkClearAttachment-clearValue-00021]]
397e5c31af7Sopenharmony_ci    pname:clearValue must: be a valid sname:VkClearValue union
398e5c31af7Sopenharmony_ci****
399e5c31af7Sopenharmony_ci
400e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkClearAttachment.txt[]
401e5c31af7Sopenharmony_ci--
402e5c31af7Sopenharmony_ci
403e5c31af7Sopenharmony_ci
404e5c31af7Sopenharmony_ci[[clears-values]]
405e5c31af7Sopenharmony_ci== Clear Values
406e5c31af7Sopenharmony_ci
407e5c31af7Sopenharmony_ci[open,refpage='VkClearColorValue',desc='Structure specifying a clear color value',type='structs']
408e5c31af7Sopenharmony_ci--
409e5c31af7Sopenharmony_ciThe sname:VkClearColorValue structure is defined as:
410e5c31af7Sopenharmony_ci
411e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkClearColorValue.txt[]
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_ci  * pname:float32 are the color clear values when the format of the image or
414e5c31af7Sopenharmony_ci    attachment is one of the formats in the <<formats-numericformat>> table
415e5c31af7Sopenharmony_ci    other than signed integer (etext:SINT) or unsigned integer (etext:UINT).
416e5c31af7Sopenharmony_ci    Floating point values are automatically converted to the format of the
417e5c31af7Sopenharmony_ci    image, with the clear value being treated as linear if the image is
418e5c31af7Sopenharmony_ci    sRGB.
419e5c31af7Sopenharmony_ci  * pname:int32 are the color clear values when the format of the image or
420e5c31af7Sopenharmony_ci    attachment is signed integer (etext:SINT).
421e5c31af7Sopenharmony_ci    Signed integer values are converted to the format of the image by
422e5c31af7Sopenharmony_ci    casting to the smaller type (with negative 32-bit values mapping to
423e5c31af7Sopenharmony_ci    negative values in the smaller type).
424e5c31af7Sopenharmony_ci    If the integer clear value is not representable in the target type (e.g.
425e5c31af7Sopenharmony_ci    would overflow in conversion to that type), the clear value is
426e5c31af7Sopenharmony_ci    undefined:.
427e5c31af7Sopenharmony_ci  * pname:uint32 are the color clear values when the format of the image or
428e5c31af7Sopenharmony_ci    attachment is unsigned integer (etext:UINT).
429e5c31af7Sopenharmony_ci    Unsigned integer values are converted to the format of the image by
430e5c31af7Sopenharmony_ci    casting to the integer type with fewer bits.
431e5c31af7Sopenharmony_ci
432e5c31af7Sopenharmony_ciThe four array elements of the clear color map to R, G, B, and A components
433e5c31af7Sopenharmony_ciof image formats, in order.
434e5c31af7Sopenharmony_ci
435e5c31af7Sopenharmony_ciIf the image has more than one sample, the same value is written to all
436e5c31af7Sopenharmony_cisamples for any pixels being cleared.
437e5c31af7Sopenharmony_ci
438e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkClearColorValue.txt[]
439e5c31af7Sopenharmony_ci--
440e5c31af7Sopenharmony_ci
441e5c31af7Sopenharmony_ci[open,refpage='VkClearDepthStencilValue',desc='Structure specifying a clear depth stencil value',type='structs']
442e5c31af7Sopenharmony_ci--
443e5c31af7Sopenharmony_ciThe sname:VkClearDepthStencilValue structure is defined as:
444e5c31af7Sopenharmony_ci
445e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkClearDepthStencilValue.txt[]
446e5c31af7Sopenharmony_ci
447e5c31af7Sopenharmony_ci  * pname:depth is the clear value for the depth aspect of the depth/stencil
448e5c31af7Sopenharmony_ci    attachment.
449e5c31af7Sopenharmony_ci    It is a floating-point value which is automatically converted to the
450e5c31af7Sopenharmony_ci    attachment's format.
451e5c31af7Sopenharmony_ci  * pname:stencil is the clear value for the stencil aspect of the
452e5c31af7Sopenharmony_ci    depth/stencil attachment.
453e5c31af7Sopenharmony_ci    It is a 32-bit integer value which is converted to the attachment's
454e5c31af7Sopenharmony_ci    format by taking the appropriate number of LSBs.
455e5c31af7Sopenharmony_ci
456e5c31af7Sopenharmony_ci.Valid Usage
457e5c31af7Sopenharmony_ci****
458e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[]
459e5c31af7Sopenharmony_ci  * [[VUID-VkClearDepthStencilValue-depth-00022]]
460e5c31af7Sopenharmony_ci    Unless the `apiext:VK_EXT_depth_range_unrestricted` extension is enabled
461e5c31af7Sopenharmony_ci    pname:depth must: be between `0.0` and `1.0`, inclusive
462e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
463e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_range_unrestricted[]
464e5c31af7Sopenharmony_ci  * [[VUID-VkClearDepthStencilValue-depth-02506]]
465e5c31af7Sopenharmony_ci    pname:depth must: be between `0.0` and `1.0`, inclusive
466e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
467e5c31af7Sopenharmony_ci****
468e5c31af7Sopenharmony_ci
469e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkClearDepthStencilValue.txt[]
470e5c31af7Sopenharmony_ci--
471e5c31af7Sopenharmony_ci
472e5c31af7Sopenharmony_ci[open,refpage='VkClearValue',desc='Structure specifying a clear value',type='structs']
473e5c31af7Sopenharmony_ci--
474e5c31af7Sopenharmony_ciThe sname:VkClearValue union is defined as:
475e5c31af7Sopenharmony_ci
476e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkClearValue.txt[]
477e5c31af7Sopenharmony_ci
478e5c31af7Sopenharmony_ci  * pname:color specifies the color image clear values to use when clearing
479e5c31af7Sopenharmony_ci    a color image or attachment.
480e5c31af7Sopenharmony_ci  * pname:depthStencil specifies the depth and stencil clear values to use
481e5c31af7Sopenharmony_ci    when clearing a depth/stencil image or attachment.
482e5c31af7Sopenharmony_ci
483e5c31af7Sopenharmony_ciThis union is used where part of the API requires either color or
484e5c31af7Sopenharmony_cidepth/stencil clear values, depending on the attachment, and defines the
485e5c31af7Sopenharmony_ciinitial clear values in the slink:VkRenderPassBeginInfo structure.
486e5c31af7Sopenharmony_ci
487e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkClearValue.txt[]
488e5c31af7Sopenharmony_ci--
489e5c31af7Sopenharmony_ci
490e5c31af7Sopenharmony_ci
491e5c31af7Sopenharmony_ci[[clears-filling-buffers]]
492e5c31af7Sopenharmony_ci== Filling Buffers
493e5c31af7Sopenharmony_ci
494e5c31af7Sopenharmony_ci[open,refpage='vkCmdFillBuffer',desc='Fill a region of a buffer with a fixed value',type='protos']
495e5c31af7Sopenharmony_ci--
496e5c31af7Sopenharmony_ciTo clear buffer data, call:
497e5c31af7Sopenharmony_ci
498e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdFillBuffer.txt[]
499e5c31af7Sopenharmony_ci
500e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
501e5c31af7Sopenharmony_ci    recorded.
502e5c31af7Sopenharmony_ci  * pname:dstBuffer is the buffer to be filled.
503e5c31af7Sopenharmony_ci  * pname:dstOffset is the byte offset into the buffer at which to start
504e5c31af7Sopenharmony_ci    filling, and must: be a multiple of 4.
505e5c31af7Sopenharmony_ci  * pname:size is the number of bytes to fill, and must: be either a
506e5c31af7Sopenharmony_ci    multiple of 4, or ename:VK_WHOLE_SIZE to fill the range from
507e5c31af7Sopenharmony_ci    pname:offset to the end of the buffer.
508e5c31af7Sopenharmony_ci    If ename:VK_WHOLE_SIZE is used and the remaining size of the buffer is
509e5c31af7Sopenharmony_ci    not a multiple of 4, then the nearest smaller multiple is used.
510e5c31af7Sopenharmony_ci  * pname:data is the 4-byte word written repeatedly to the buffer to fill
511e5c31af7Sopenharmony_ci    pname:size bytes of data.
512e5c31af7Sopenharmony_ci    The data word is written to memory according to the host endianness.
513e5c31af7Sopenharmony_ci
514e5c31af7Sopenharmony_cifname:vkCmdFillBuffer is treated as "`transfer`" operation for the purposes
515e5c31af7Sopenharmony_ciof synchronization barriers.
516e5c31af7Sopenharmony_ciThe ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT must: be specified in pname:usage
517e5c31af7Sopenharmony_ciof slink:VkBufferCreateInfo in order for the buffer to be compatible with
518e5c31af7Sopenharmony_cifname:vkCmdFillBuffer.
519e5c31af7Sopenharmony_ci
520e5c31af7Sopenharmony_ci.Valid Usage
521e5c31af7Sopenharmony_ci****
522e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-dstOffset-00024]]
523e5c31af7Sopenharmony_ci    pname:dstOffset must: be less than the size of pname:dstBuffer
524e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-dstOffset-00025]]
525e5c31af7Sopenharmony_ci    pname:dstOffset must: be a multiple of `4`
526e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-size-00026]]
527e5c31af7Sopenharmony_ci    If pname:size is not equal to ename:VK_WHOLE_SIZE, pname:size must: be
528e5c31af7Sopenharmony_ci    greater than `0`
529e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-size-00027]]
530e5c31af7Sopenharmony_ci    If pname:size is not equal to ename:VK_WHOLE_SIZE, pname:size must: be
531e5c31af7Sopenharmony_ci    less than or equal to the size of pname:dstBuffer minus pname:dstOffset
532e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-size-00028]]
533e5c31af7Sopenharmony_ci    If pname:size is not equal to ename:VK_WHOLE_SIZE, pname:size must: be a
534e5c31af7Sopenharmony_ci    multiple of `4`
535e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-dstBuffer-00029]]
536e5c31af7Sopenharmony_ci    pname:dstBuffer must: have been created with
537e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag
538e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_maintenance1[]
539e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-commandBuffer-00030]]
540e5c31af7Sopenharmony_ci    The sname:VkCommandPool that pname:commandBuffer was allocated from
541e5c31af7Sopenharmony_ci    must: support graphics or compute operations
542e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
543e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-dstBuffer-00031]]
544e5c31af7Sopenharmony_ci    If pname:dstBuffer is non-sparse then it must: be bound completely and
545e5c31af7Sopenharmony_ci    contiguously to a single sname:VkDeviceMemory object
546e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[]
547e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-commandBuffer-01811]]
548e5c31af7Sopenharmony_ci    If pname:commandBuffer is an unprotected command buffer and
549e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
550e5c31af7Sopenharmony_ci    pname:dstBuffer must: not be a protected buffer
551e5c31af7Sopenharmony_ci  * [[VUID-vkCmdFillBuffer-commandBuffer-01812]]
552e5c31af7Sopenharmony_ci    If pname:commandBuffer is a protected command buffer and
553e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
554e5c31af7Sopenharmony_ci    pname:dstBuffer must: not be an unprotected buffer
555e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[]
556e5c31af7Sopenharmony_ci****
557e5c31af7Sopenharmony_ci
558e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdFillBuffer.txt[]
559e5c31af7Sopenharmony_ci--
560e5c31af7Sopenharmony_ci
561e5c31af7Sopenharmony_ci
562e5c31af7Sopenharmony_ci[[clears-updating-buffers]]
563e5c31af7Sopenharmony_ci== Updating Buffers
564e5c31af7Sopenharmony_ci
565e5c31af7Sopenharmony_ci[open,refpage='vkCmdUpdateBuffer',desc='Update a buffer\'s contents from host memory',type='protos']
566e5c31af7Sopenharmony_ci--
567e5c31af7Sopenharmony_ciTo update buffer data inline in a command buffer, call:
568e5c31af7Sopenharmony_ci
569e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdUpdateBuffer.txt[]
570e5c31af7Sopenharmony_ci
571e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
572e5c31af7Sopenharmony_ci    recorded.
573e5c31af7Sopenharmony_ci  * pname:dstBuffer is a handle to the buffer to be updated.
574e5c31af7Sopenharmony_ci  * pname:dstOffset is the byte offset into the buffer to start updating,
575e5c31af7Sopenharmony_ci    and must: be a multiple of 4.
576e5c31af7Sopenharmony_ci  * pname:dataSize is the number of bytes to update, and must: be a multiple
577e5c31af7Sopenharmony_ci    of 4.
578e5c31af7Sopenharmony_ci  * pname:pData is a pointer to the source data for the buffer update, and
579e5c31af7Sopenharmony_ci    must: be at least pname:dataSize bytes in size.
580e5c31af7Sopenharmony_ci
581e5c31af7Sopenharmony_cipname:dataSize must: be less than or equal to 65536 bytes.
582e5c31af7Sopenharmony_ciFor larger updates, applications can: use buffer to buffer
583e5c31af7Sopenharmony_ci<<copies-buffers,copies>>.
584e5c31af7Sopenharmony_ci
585e5c31af7Sopenharmony_ci[NOTE]
586e5c31af7Sopenharmony_ci.Note
587e5c31af7Sopenharmony_ci====
588e5c31af7Sopenharmony_ciBuffer updates performed with fname:vkCmdUpdateBuffer first copy the data
589e5c31af7Sopenharmony_ciinto command buffer memory when the command is recorded (which requires
590e5c31af7Sopenharmony_ciadditional storage and may incur an additional allocation), and then copy
591e5c31af7Sopenharmony_cithe data from the command buffer into pname:dstBuffer when the command is
592e5c31af7Sopenharmony_ciexecuted on a device.
593e5c31af7Sopenharmony_ci
594e5c31af7Sopenharmony_ciThe additional cost of this functionality compared to <<copies-buffers,
595e5c31af7Sopenharmony_cibuffer to buffer copies>> means it is only recommended for very small
596e5c31af7Sopenharmony_ciamounts of data, and is why it is limited to only 65536 bytes.
597e5c31af7Sopenharmony_ci
598e5c31af7Sopenharmony_ciApplications can: work around this by issuing multiple
599e5c31af7Sopenharmony_cifname:vkCmdUpdateBuffer commands to different ranges of the same buffer, but
600e5c31af7Sopenharmony_ciit is strongly recommended that they should: not.
601e5c31af7Sopenharmony_ci====
602e5c31af7Sopenharmony_ci
603e5c31af7Sopenharmony_ciThe source data is copied from the user pointer to the command buffer when
604e5c31af7Sopenharmony_cithe command is called.
605e5c31af7Sopenharmony_ci
606e5c31af7Sopenharmony_cifname:vkCmdUpdateBuffer is only allowed outside of a render pass.
607e5c31af7Sopenharmony_ciThis command is treated as "`transfer`" operation, for the purposes of
608e5c31af7Sopenharmony_cisynchronization barriers.
609e5c31af7Sopenharmony_ciThe ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT must: be specified in pname:usage
610e5c31af7Sopenharmony_ciof slink:VkBufferCreateInfo in order for the buffer to be compatible with
611e5c31af7Sopenharmony_cifname:vkCmdUpdateBuffer.
612e5c31af7Sopenharmony_ci
613e5c31af7Sopenharmony_ci.Valid Usage
614e5c31af7Sopenharmony_ci****
615e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dstOffset-00032]]
616e5c31af7Sopenharmony_ci    pname:dstOffset must: be less than the size of pname:dstBuffer
617e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dataSize-00033]]
618e5c31af7Sopenharmony_ci    pname:dataSize must: be less than or equal to the size of
619e5c31af7Sopenharmony_ci    pname:dstBuffer minus pname:dstOffset
620e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dstBuffer-00034]]
621e5c31af7Sopenharmony_ci    pname:dstBuffer must: have been created with
622e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag
623e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dstBuffer-00035]]
624e5c31af7Sopenharmony_ci    If pname:dstBuffer is non-sparse then it must: be bound completely and
625e5c31af7Sopenharmony_ci    contiguously to a single sname:VkDeviceMemory object
626e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dstOffset-00036]]
627e5c31af7Sopenharmony_ci    pname:dstOffset must: be a multiple of `4`
628e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dataSize-00037]]
629e5c31af7Sopenharmony_ci    pname:dataSize must: be less than or equal to `65536`
630e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-dataSize-00038]]
631e5c31af7Sopenharmony_ci    pname:dataSize must: be a multiple of `4`
632e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[]
633e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-commandBuffer-01813]]
634e5c31af7Sopenharmony_ci    If pname:commandBuffer is an unprotected command buffer and
635e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
636e5c31af7Sopenharmony_ci    pname:dstBuffer must: not be a protected buffer
637e5c31af7Sopenharmony_ci  * [[VUID-vkCmdUpdateBuffer-commandBuffer-01814]]
638e5c31af7Sopenharmony_ci    If pname:commandBuffer is a protected command buffer and
639e5c31af7Sopenharmony_ci    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
640e5c31af7Sopenharmony_ci    pname:dstBuffer must: not be an unprotected buffer
641e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[]
642e5c31af7Sopenharmony_ci****
643e5c31af7Sopenharmony_ci
644e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdUpdateBuffer.txt[]
645e5c31af7Sopenharmony_ci--
646e5c31af7Sopenharmony_ci
647e5c31af7Sopenharmony_ci[NOTE]
648e5c31af7Sopenharmony_ci.Note
649e5c31af7Sopenharmony_ci====
650e5c31af7Sopenharmony_ciThe pname:pData parameter was of type code:uint32_t* instead of code:void*
651e5c31af7Sopenharmony_ciprior to version 1.0.19 of the Specification and dlink:VK_HEADER_VERSION 19
652e5c31af7Sopenharmony_ciof the <<boilerplate-headers,Vulkan Header Files>>.
653e5c31af7Sopenharmony_ciThis was a historical anomaly, as the source data may be of other types.
654e5c31af7Sopenharmony_ci====
655