HDK
|
#include <IMX_PoolEntry.h>
Public Types | |
enum | EntryType { EntryType::BUFFER = 0, EntryType::VDB } |
To avoid the need for dynamic casts: More... | |
Public Member Functions | |
IMX_PoolEntry () | |
Creates a new buffer. You must call setSize to make this buffer usable. More... | |
virtual | ~IMX_PoolEntry () |
IMX_PoolEntry (const IMX_PoolEntry &)=delete | |
IMX_PoolEntry & | operator= (const IMX_PoolEntry &)=delete |
virtual EntryType | poolTypeID () const =0 |
bool | isInUseGPU () const |
void | setInUseGPUFlag () const |
void | clearInUseGPUFlag () const |
Protected Member Functions | |
virtual void | unloadFromGPU ()=0 |
virtual void | poolResetGPUBuffer ()=0 |
Resets the GPU Buffer pointer. More... | |
virtual void | poolSetOnGPU (bool ongpu)=0 |
CHnages the OnGPU status. More... | |
virtual bool | poolIsGPUBufferEmpty () const =0 |
True if the gpu buffer is null. More... | |
virtual bool | poolIsGPUBufferValid () const =0 |
True if the gpu buffer is not null and valid. More... | |
virtual bool | poolSwapGPUBuffer (IMX_PoolEntry *other)=0 |
Swap two GPU buffers. Returns true if it did something. More... | |
virtual void | poolShallowCopyGPUBuffer (const IMX_PoolEntry *src)=0 |
Copies GPU buffer from source, shallow copy so it shares. More... | |
Protected Attributes | |
int | myGPUInUseCount = 0 |
Friends | |
class | IMX_CEMemoryPool |
Base class for objects that can be managed by the IMX_CEMemoryPool This handles the registration / unloading /etc of the GPU buffers.
Definition at line 23 of file IMX_PoolEntry.h.
|
strong |
To avoid the need for dynamic casts:
Enumerator | |
---|---|
BUFFER | |
VDB |
Definition at line 27 of file IMX_PoolEntry.h.
|
inline |
Creates a new buffer. You must call setSize to make this buffer usable.
Definition at line 34 of file IMX_PoolEntry.h.
|
inlinevirtual |
Definition at line 35 of file IMX_PoolEntry.h.
|
delete |
void IMX_PoolEntry::clearInUseGPUFlag | ( | ) | const |
Decrements the user count of our GPU data. If there are no active users of the GPU data, the memory pool will be able to unload this buffer. See setInUseGPUFlag() documentation for how these methods must be used. This method also refreshes the buffer in the eyes of the memory pool, making it less likely to get evicted.
|
inline |
Returns whether the GPU data for this image is currently being used by someone.
Definition at line 43 of file IMX_PoolEntry.h.
|
delete |
|
protectedpure virtual |
True if the gpu buffer is null.
Implemented in IMX_Buffer, and IMX_VDB.
|
protectedpure virtual |
True if the gpu buffer is not null and valid.
Implemented in IMX_Buffer, and IMX_VDB.
|
protectedpure virtual |
Resets the GPU Buffer pointer.
Implemented in IMX_Buffer, and IMX_VDB.
|
protectedpure virtual |
CHnages the OnGPU status.
Implemented in IMX_Buffer, and IMX_VDB.
|
protectedpure virtual |
Copies GPU buffer from source, shallow copy so it shares.
Implemented in IMX_Buffer, and IMX_VDB.
|
protectedpure virtual |
Swap two GPU buffers. Returns true if it did something.
Implemented in IMX_Buffer, and IMX_VDB.
|
pure virtual |
Implemented in IMX_Buffer, and IMX_VDB.
void IMX_PoolEntry::setInUseGPUFlag | ( | ) | const |
Increments the user count of our GPU data. If there are no active users of the GPU data, the memory pool will be able to unload the buffer. When using one of the getGPUBuffer() methods, the in-use GPU flag must be set to prevent the GPU data from getting unloaded: // Set the in-use flag before grabbing the GPU buffer. buffer.setInUseGPUFlag(); CE_Image& img = buffer.getGPUBufferW(); // Do stuff with the CE_Image (i.e. queue up an OpenCL command with // it, can be asynchronous). ... // Flip the flag that we set earlier. buffer.clearInUseGPUFlag(); Alternatively, you can use the RAII wrapper for this: { // Set the in-use flag before grabbing the GPU buffer. IMX_ScopedBufferInUseGPU scoped_gpu_use(buffer); CE_Image& img = buffer.getGPUBufferW(); // Do stuff with the CE_Image (i.e. queue up an OpenCL command // with it, can be asynchronous). ... // Destructor automatically clears the flag that we set earlier. }
|
protectedpure virtual |
Queues up commands that transfer this buffer's GPU storage to main memory. TODO: this is non-blocking, make sure that's okay...
Implemented in IMX_VDB.
|
friend |
Definition at line 100 of file IMX_PoolEntry.h.
|
mutableprotected |
Number of current users of the GPU memory from this buffer. All changes to this member must be done by the memory pool!!!
Definition at line 98 of file IMX_PoolEntry.h.