c++vulkandirect3ddirectx-12

Whats the vulkan equialent for D3D12 ClearUnorderedAccessView


I need to clear an unordered access view. In D3D12 you have ClearUnorderedAccessView(Uint/Float).

How can I achieve this using Vulkan?


Solution

  • An "unordered access view" in D3D is, in Vulkan, is usually a storage image.

    Vulkan has no facilities to allow you to directly manipulate the contents of a resource through a descriptor index/reference. Only shader processes can modify the contents of a descriptor through a descriptor index. To modify a resource via a CPU command, you must actually access that resource.

    To clear an image means using vkCmdClearColor/DepthStencilImage. This function can only be called outside of a render pass. While functions exist to clear attached images, you cannot clear non-attachment images inside of a render pass.

    If this was a unordered access view of a buffer, you would use vkCmdFillBuffer instead.