Skip to content

LiteFX::Rendering::Backends::DirectX12CommandBuffer::transfer

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

Synopsis

Declared in <litefx/backends/dx12.hpp>

[[dllimport, dllexport]] virtual void transfer(
    IDirectX12Buffer const& source,
    IDirectX12Image const& target,
    UInt32 sourceElement = 0,
    UInt32 firstSubresource = 0,
    UInt32 elements = 1) const override;

Description

The subresource 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 buffer to transfer data from.
targetThe target image to transfer data to.
sourceElementThe index of the first element in the source buffer to copy.
firstSubresourceThe index of the first sub-resource of the target image to receive data.
elementsThe number of elements to copy from the source buffer into the target image sub-resources.