To clear buffer data, call:
void vkCmdFillBuffer(
VkCommandBuffer commandBuffer,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize size,
uint32_t data);
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.
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.