LiteFX::Rendering::Backends::DirectX12CommandBuffer::transfer¶
Performs a buffer-to-buffer transfer from source to target.
Synopsis¶
Declared in <litefx/rendering.hpp>
[[dllimport]] virtual void transfer(
SharedPtr<buffer_type const> const& source,
buffer_type const& target,
UInt32 sourceElement = 0,
UInt32 targetElement = 0,
UInt32 elements = 1) const = 0;
Description¶
This method takes shared ownership over source, which means that a reference is hold until the parent command queue finished using the command buffer. At this point, the command queue calls releaseSharedState to release all shared references. Note that this is a relaxed constraint. It is only guaranteed, that the queue calls this method at some point after the command buffer has been executed.
Sharing ownership is helpful in situations where you only have a temporary buffer that you do not want to manually keep track of. For example, it makes sense to create a temporary staging buffer and delete it, if the remote resource has been initialized. In such a case, the command buffer can take ownership over the resource to release it after it has been executed.
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 buffer to transfer data to. |
| sourceElement | The index of the first element in the source buffer to copy. |
| targetElement | The index of the first element in the target buffer to copy to. |
| elements | The number of elements to copy from the source buffer into the target buffer. |