Skip to content

LiteFX::Rendering::Backends::VulkanCommandBuffer::transfer

Performs an image-to-buffer transfer from source to target.

Synopsis

Declared in <litefx/rendering.hpp>

[[dllimport]] virtual void transfer(
    image_type const& source,
    buffer_type const& target,
    UInt32 firstSubresource = 0,
    UInt32 targetElement = 0,
    UInt32 subresources = 1) const = 0;

Description

The firstSubresource parameter describes the index of the first sub-resource to copy. Each element gets copied into the subsequent sub-resource, where resources are counted in the following order:

  • Level: Contains the mip-map levels.
  • Layer: Contains the array slices.
  • Plane: Contains planes for multi-planar formats.

E.g., if 6 elements should be copied to an image with 3 mip-map levels and 3 layers, the elements 0-2 contain the mip-map levels of the first layer, while elements 3-5 contain the three mip-map levels of the second layer. The third layer would not receive any data in this example. If the image format has multiple planes, this procedure would be repeated for each plane, however one buffer element only maps to one sub-resource.

Note that you have to manually ensure that source and target are in the proper state for transfer operations. You might have to use a IBarrier before starting the transfer.

Parameters

NameDescription
sourceThe source image to transfer data from.
targetThe target buffer to transfer data to.
firstSubresourceThe index of the first sub-resource to copy from the source image.
targetElementThe index of the first target element to receive data.
subresourcesThe number of sub-resources to copy.