C Specification

To fill a memory range with a fixed 4-byte bit pattern, call:

// Provided by VK_KHR_device_address_commands
void vkCmdFillMemoryKHR(
    VkCommandBuffer                             commandBuffer,
    const VkDeviceAddressRangeKHR*              pDstRange,
    VkAddressCommandFlagsKHR                    dstFlags,
    uint32_t                                    data);

Parameters

  • commandBuffer is the command buffer into which the command will be recorded.

  • pDstRange is a pointer to the VkDeviceAddressRangeKHR selecting the memory range to be filled.

  • dstFlags is a VkAddressCommandFlagsKHR value defining the copy flags for the destination address range.

  • data is the 4-byte word written repeatedly to the destination range to fill size bytes of data.

Description

Note

The bit pattern of data is determined by the host endianness. For example, an unsigned integer value of 1 will result in a different bit pattern on a little endian machine compared to a big endian machine.

Valid Usage
Valid Usage (Implicit)
  • VUID-vkCmdFillMemoryKHR-commandBuffer-parameter
    commandBuffer must be a valid VkCommandBuffer handle

  • VUID-vkCmdFillMemoryKHR-pDstRange-parameter
    pDstRange must be a valid pointer to a valid VkDeviceAddressRangeKHR structure

  • VUID-vkCmdFillMemoryKHR-dstFlags-parameter
    dstFlags must be a valid combination of VkAddressCommandFlagBitsKHR values

  • VUID-vkCmdFillMemoryKHR-commandBuffer-recording
    commandBuffer must be in the recording state

  • VUID-vkCmdFillMemoryKHR-commandBuffer-cmdpool
    The VkCommandPool that commandBuffer was allocated from must support VK_QUEUE_TRANSFER_BIT operations

  • VUID-vkCmdFillMemoryKHR-renderpass
    This command must only be called outside of a render pass instance

  • VUID-vkCmdFillMemoryKHR-suspended
    This command must not be called between suspended render pass instances

  • VUID-vkCmdFillMemoryKHR-videocoding
    This command must only be called outside of a video coding scope

Host Synchronization
  • Host access to commandBuffer must be externally synchronized

  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Outside

Outside

VK_QUEUE_TRANSFER_BIT

Action

Conditional Rendering

vkCmdFillMemoryKHR is not affected by conditional rendering

See Also

Document Notes

For more information, see the Vulkan Specification.

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0