Asynchronous texture uploader.
More...
#include <TextureUploader.hpp>
Asynchronous texture uploader.
◆ AllocateUploadBuffer()
Allocates upload buffer.
- Parameters
-
[in] | pContext | - Pointer to the device context when the method is executed by render thread, or null when it is called from a worker thread, see remarks. |
[in] | Desc | - Buffer description, see Diligent::UploadBufferDesc. |
[out] | ppBuffer | - Memory address where pointer to the created upload buffer object will be written to. |
When the method is called from a worker thread (pContext is null), it may enqueue a render-thread operation and block until the operation is complete. If in this case the method is in fact called from the render thread, it may never return causing a deadlock. Always provide non-null device context when calling the method from the render thread. On the other hand, always pass null when calling the method from a worker thread to avoid synchronization issues, which may result in an undefined behavior.
The method can be safely called from multiple threads simultaneously. However, if pContext is not null, the application is responsible for synchronizing the access to the context.
◆ RecycleBuffer()
virtual void Diligent::ITextureUploader::RecycleBuffer |
( |
IUploadBuffer * | pUploadBuffer | ) |
|
|
pure virtual |
Recycles upload buffer to make it available for future operations.
- Parameters
-
[in] | pUploadBuffer | - Upload buffer to recycle. |
◆ ScheduleGPUCopy()
virtual void Diligent::ITextureUploader::ScheduleGPUCopy |
( |
IDeviceContext * | pContext, |
|
|
ITexture * | pDstTexture, |
|
|
Uint32 | ArraySlice, |
|
|
Uint32 | MipLevel, |
|
|
IUploadBuffer * | pUploadBuffer ) |
|
pure virtual |
Schedules a GPU copy or executes the copy immediately.
- Parameters
-
[in] | pContext | - Pointer to the device context when the method is executed by render thread, or null when it is called from a worker thread, see remarks. |
[in] | pDstTexture | - Destination texture for copy operation. |
[in] | ArraySlice | - Destination array slice. When multiple slices are copied, the starting slice. |
[in] | MipLevel | - Destination mip level. When multiple mip levels are copied, the starting mip level. |
[in] | pUploadBuffer | - Upload buffer to copy data from. |
When the method is called from a worker thread (pContext is null), it may enqueue a render-thread operation and block until the operation is complete. If in this case the method is in fact called from the render thread, it may never return causing a deadlock. Always provide non-null device context when calling the method from the render thread. On the other hand, always pass null when calling the method from a worker thread to avoid synchronization issues, which may result in an undefined behavior.