LiteFX::Rendering::CommandBuffer::transfer¶
Performs a buffer-to-buffer transfer from source to target.
Synopsis¶
Declared in <litefx/rendering.hpp>
virtual void transfer(
SharedPtr<image_type const> const& source,
buffer_type const& target,
UInt32 firstSubresource = 0,
UInt32 targetElement = 0,
UInt32 subresources = 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. |
| targetElement | The index of the first element in the target buffer to copy to. |
| firstSubresource | A type for an unsigned 32 bit integer. |
| subresources | A type for an unsigned 32 bit integer. |