#include <CE_HotSwapPoolEntry.h>
Base class for objects that can be managed by the CE_HotSwapPool This handles the registration / unloading /etc of the GPU buffers.
Definition at line 20 of file CE_HotSwapPoolEntry.h.
To avoid the need for dynamic casts:
| Enumerator |
|---|
| BUFFER |
|
| VDB |
|
| ATTRIBUTE |
|
Definition at line 24 of file CE_HotSwapPoolEntry.h.
| CE_HotSwapPoolEntry::CE_HotSwapPoolEntry |
( |
| ) |
|
|
inline |
Creates a new buffer. You must call setSize to make this buffer usable.
Definition at line 32 of file CE_HotSwapPoolEntry.h.
| virtual CE_HotSwapPoolEntry::~CE_HotSwapPoolEntry |
( |
| ) |
|
|
inlinevirtual |
| void CE_HotSwapPoolEntry::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.
| bool CE_HotSwapPoolEntry::isInUseGPU |
( |
| ) |
const |
|
inline |
Returns whether the GPU data for this image is currently being used by someone.
Definition at line 41 of file CE_HotSwapPoolEntry.h.
| virtual bool CE_HotSwapPoolEntry::poolIsGPUBufferEmpty |
( |
| ) |
const |
|
protectedpure virtual |
| virtual bool CE_HotSwapPoolEntry::poolIsGPUBufferValid |
( |
| ) |
const |
|
protectedpure virtual |
| virtual void CE_HotSwapPoolEntry::poolResetGPUBuffer |
( |
| ) |
|
|
protectedpure virtual |
| virtual void CE_HotSwapPoolEntry::poolSetOnGPU |
( |
bool |
ongpu | ) |
|
|
protectedpure virtual |
| virtual EntryType CE_HotSwapPoolEntry::poolTypeID |
( |
| ) |
const |
|
pure virtual |
| void CE_HotSwapPoolEntry::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. CE_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. }
| virtual void CE_HotSwapPoolEntry::unloadFromGPU |
( |
| ) |
|
|
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, and GA_CEAttribute.
The documentation for this class was generated from the following file: