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 27 elements of the pname:pRanges array must: each only include 28 ename:VK_IMAGE_ASPECT_COLOR_BIT 29 * [[VUID-vkCmdClearColorImage-baseMipLevel-01470]] 30 The slink:VkImageSubresourceRange::pname:baseMipLevel members of the 31 elements of the pname:pRanges array must: each be less than the 32 pname:mipLevels specified in slink:VkImageCreateInfo when pname:image 33 was created 34 * [[VUID-vkCmdClearColorImage-pRanges-02498]] 35 For each slink:VkImageSubresourceRange element of pname:pRanges, if the 36 pname:levelCount member is not ename:VK_REMAINING_MIP_LEVELS, then 37 [eq]#pname:baseMipLevel {plus} pname:levelCount# must: be less than or 38 equal to the pname:mipLevels specified in slink:VkImageCreateInfo when 39 pname:image was created 40 * [[VUID-vkCmdClearColorImage-baseArrayLayer-00007]] 41 The slink:VkImageSubresourceRange::pname:baseArrayLayer members of the 42 elements of the pname:pRanges array must: each be less than the 43 pname:arrayLayers specified in slink:VkImageCreateInfo when pname:image 44 was created 45 * [[VUID-vkCmdClearColorImage-pRanges-02498]] 46 For each slink:VkImageSubresourceRange element of pname:pRanges, if the 47 pname:layerCount member is not ename:VK_REMAINING_ARRAY_LAYERS, then 48 [eq]#pname:baseArrayLayer {plus} pname:layerCount# must: be less than or 49 equal to the pname:arrayLayers specified in slink:VkImageCreateInfo when 50 pname:image was created 51 * [[VUID-vkCmdClearColorImage-image-00007]] 52 pname:image must: not have a compressed or depth/stencil format 53 * [[VUID-vkCmdClearColorImage-pColor-02498]] 54 pname:pColor must: be a valid pointer to a slink:VkClearColorValue union 55**** 56 57include::{generated}/validity/protos/vkCmdClearColorImage.adoc[] 58-- 59