1// Copyright 2015-2023 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[clears]] 6= Clear Commands 7 8 9[[clears-outside]] 10== Clearing Images Outside A Render Pass Instance 11 12Color and depth/stencil images can: be cleared outside a render pass 13instance using flink:vkCmdClearColorImage or 14flink:vkCmdClearDepthStencilImage, respectively. 15These commands are only allowed outside of a render pass instance. 16 17[open,refpage='vkCmdClearColorImage',desc='Clear regions of a color image',type='protos'] 18-- 19To clear one or more subranges of a color image, call: 20 21include::{generated}/api/protos/vkCmdClearColorImage.adoc[] 22 23.Valid Usage 24**** 25 * [[VUID-vkCmdClearColorImage-aspectMask-02498]] 26 The slink:VkImageSubresourceRange::pname:aspectMask members of the elements of the pname:pRanges array must: each only include ename:VK_IMAGE_ASPECT_COLOR_BIT 27 * [[VUID-vkCmdClearColorImage-baseMipLevel-01470]] 28 The slink:VkImageSubresourceRange::pname:baseMipLevel members of the elements of the pname:pRanges array must: each be less than the pname:mipLevels specified in slink:VkImageCreateInfo when pname:image was created 29 * [[VUID-vkCmdClearColorImage-pRanges-02498]] 30 For each slink:VkImageSubresourceRange element of pname:pRanges, if the 31 pname:levelCount member is not ename:VK_REMAINING_MIP_LEVELS, then 32 [eq]#pname:baseMipLevel {plus} pname:levelCount# must: be less than or equal to the pname:mipLevels specified in slink:VkImageCreateInfo when 33 pname:image was created 34 * [[VUID-vkCmdClearColorImage-baseArrayLayer-00007]] 35 The slink:VkImageSubresourceRange::pname:baseArrayLayer members of the elements of the pname:pRanges array must: each be less than the pname:arrayLayers specified in slink:VkImageCreateInfo when pname:image was created 36 * [[VUID-vkCmdClearColorImage-pRanges-02498]] 37 For each slink:VkImageSubresourceRange element of pname:pRanges, if the pname:layerCount member is not ename:VK_REMAINING_ARRAY_LAYERS, then 38 [eq]#pname:baseArrayLayer {plus} pname:layerCount# must: be less than or equal to the pname:arrayLayers specified in slink:VkImageCreateInfo when 39 pname:image was created 40 * [[VUID-vkCmdClearColorImage-image-00007]] 41 pname:image must: not have a compressed or depth/stencil format 42 * [[VUID-vkCmdClearColorImage-pColor-02498]] 43 pname:pColor must: be a valid pointer to a slink:VkClearColorValue union 44**** 45 46include::{generated}/validity/protos/vkCmdClearColorImage.adoc[] 47-- 48