The ICubismOffscreenManager<T> is a template class used to manage a pool of offscreen render targets (of type T). It handles the lifecycle of these targets, including creation, tracking their usage state, and releasing unused resources to optimize memory.
To use the manager correctly within a rendering loop, you must follow the frame lifecycle:
- Call
BeginFrameProcess() at the start of the frame. - Perform rendering operations using the managed render targets.
- Call
EndFrameProcess() at the end of the frame.
Key lifecycle management tasks:
- Releasing unused textures: Call
ReleaseStaleRenderTextures() to free up render targets that are no longer being used, resizing the pool to the previous frame's maximum active count to prevent excessive allocation/deallocation. - Full cleanup: Call
ReleaseAllRenderTextures() to destroy all managed render targets and clear the list.
// Conceptual usage pattern
ICubismOffscreenManager<MyRenderTargetType> manager;
// Inside your render loop
manager.BeginFrameProcess();
// ... use render targets ...
manager.EndFrameProcess();
manager.ReleaseStaleRenderTextures();