VKCMDFILLBUFFER(3)

NAME
vkCmdFillBuffer - Fill a region of a buffer with a fixed value.

C SPECIFICATION

To clear buffer data, call:

    void vkCmdFillBuffer(
        VkCommandBuffer                             commandBuffer,
        VkBuffer                                    dstBuffer,
        VkDeviceSize                                dstOffset,
        VkDeviceSize                                size,
        uint32_t                                    data);

PARAMETERS

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

    • dstBuffer is the buffer to be filled.

    • dstOffset is the byte offset into the buffer at which to start filling, and must be a multiple of 4.

    • size is the number of bytes to fill, and must be either a multiple of 4, or VK_WHOLE_SIZE to fill the range from offset to the end of the buffer. If VK_WHOLE_SIZE is used and the remaining size of the buffer is not a multiple of 4, then the nearest smaller multiple is used.

    • data is the 4-byte word written repeatedly to the buffer to fill size bytes of data. The data word is written to memory according to the host endianness.

DESCRIPTION

vkCmdFillBuffer is treated as “transfer” operation for the purposes of synchronization barriers. The VK_BUFFER_USAGE_TRANSFER_DST_BIT must be specified in usage of VkBufferCreateInfo in order for the buffer to be compatible with vkCmdFillBuffer.

VALID USAGE

    • commandBuffer must be a valid VkCommandBuffer handle

    • dstBuffer must be a valid VkBuffer handle

    • commandBuffer must be in the recording state

    • The VkCommandPool that commandBuffer was allocated from must support graphics, or compute operations

    • This command must only be called outside of a render pass instance

    • Both of commandBuffer, and dstBuffer must have been created, allocated, or retrieved from the same VkDevice

    • dstOffset must be less than the size of dstBuffer

    • dstOffset must be a multiple of 4

    • If size is not equal to VK_WHOLE_SIZE, size must be greater than 0

    • If size is not equal to VK_WHOLE_SIZE, size must be less than or equal to the size of dstBuffer minus dstOffset

    • If size is not equal to VK_WHOLE_SIZE, size must be a multiple of 4

    • dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag

HOST SYNCHRONIZATION

    • Host access to commandBuffer must be externally synchronized

COMMAND PROPERTIES
Command Buffer Levels | Render Pass Scope | Supported Queue Types
Primary Secondary | Outside | GRAPHICS COMPUTE

SEE ALSO

VkBuffer, VkCommandBuffer, VkDeviceSize

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkCmdFillBuffer

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

COPYRIGHT

Copyright (c) 2014-2016 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.

AUTHOR

Khronos Group
    Author.