LiteFX::Rendering::Backends::DirectX12CommandBuffer::transfer¶
Performs a buffer-to-image transfer from source to target.
Synopsis¶
Declared in <litefx/rendering.hpp>
[[dllimport]] virtual void transfer(
buffer_type const& source,
image_type const& target,
UInt32 sourceElement = 0,
UInt32 firstSubresource = 0,
UInt32 elements = 1) const = 0;
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¶
| Name | Description |
|---|---|
| source | The source buffer to transfer data from. |
| target | The target image to transfer data to. |
| sourceElement | The index of the first element in the source buffer to copy. |
| firstSubresource | The index of the first sub-resource of the target image to receive data. |
| elements | The number of elements to copy from the source buffer into the target image sub-resources. |