// Copyright 2015-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[[clears]]
= Clear Commands


[[clears-outside]]
== Clearing Images Outside A Render Pass Instance

[open,refpage='vkCmdClearColorImage',desc='Clear regions of a color image',type='protos']
--
To clear one or more subranges of a color image, call:

include::{generated}/api/protos/vkCmdClearColorImage.adoc[]

.Valid Usage
****
  * [[VUID-vkCmdClearColorImage-image-00003]]
    If pname:image is non-sparse then it must: be bound completely and
    contiguously to a single sname:VkDeviceMemory object
  * [[VUID-vkCmdClearColorImage-imageLayout-00004]]
    pname:imageLayout must: specify the layout of the image subresource
    ranges of pname:image specified in pname:pRanges at the time this
    command is executed on a sname:VkDevice
  * [[VUID-vkCmdClearColorImage-imageLayout-00005]]
    pname:imageLayout must: be ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or
    ename:VK_IMAGE_LAYOUT_GENERAL
ifdef::VK_KHR_shared_presentable_image[]
    , or ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
endif::VK_KHR_shared_presentable_image[]
  * [[VUID-vkCmdClearColorImage-pColor-04961]]
    pname:pColor must: be a valid pointer to a slink:VkClearColorValue union
****
