Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::ITextureUploader Class Referenceabstract

Asynchronous texture uploader. More...

#include <TextureUploader.hpp>

Inheritance diagram for Diligent::ITextureUploader:
Diligent.IObject Diligent::RefCountedObject< ITextureUploader > Diligent::ObjectBase< ITextureUploader >

Public Member Functions

virtual void RenderThreadUpdate (IDeviceContext *pContext)=0
 Executes pending render-thread operations.
 
virtual void AllocateUploadBuffer (IDeviceContext *pContext, const UploadBufferDesc &Desc, IUploadBuffer **ppBuffer)=0
 Allocates upload buffer.
 
virtual void ScheduleGPUCopy (IDeviceContext *pContext, ITexture *pDstTexture, Uint32 ArraySlice, Uint32 MipLevel, IUploadBuffer *pUploadBuffer)=0
 Schedules a GPU copy or executes the copy immediately.
 
virtual void RecycleBuffer (IUploadBuffer *pUploadBuffer)=0
 Recycles upload buffer to make it available for future operations.
 
virtual TextureUploaderStats GetStats ()=0
 Returns texture uploader statistics, see Diligent::TextureUploaderStats.
 
- Public Member Functions inherited from Diligent.IObject
virtual void DILIGENT_CALL_TYPE QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
 Queries the specific interface.
 
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE AddRef ()=0
 Increments the number of strong references by 1.
 
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE Release ()=0
 
virtual IReferenceCounters *DILIGENT_CALL_TYPE GetReferenceCounters () const =0
 

Detailed Description

Asynchronous texture uploader.

Member Function Documentation

◆ AllocateUploadBuffer()

virtual void Diligent::ITextureUploader::AllocateUploadBuffer ( IDeviceContext * pContext,
const UploadBufferDesc & Desc,
IUploadBuffer ** ppBuffer )
pure virtual

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.