class
CoreObjectManager
Manager that keeps track of all active CoreObjects.
Public
Constructors
CoreObjectManager
Methods
~CoreObjectManager
staticGenerateId
Generates a new unique ID for a core object.
RegisterObject
Registers a new CoreObject notifying the manager the object is created.
UnregisterObject
Unregisters a CoreObject notifying the manager the object is destroyed.
NotifyRenderProxyDirty
Notifies the system that a CoreObject's render proxy data is dirty and needs to be synced with the render thread.
NotifyDependenciesDirty
Notifies the system that CoreObject dependencies are dirty and should be updated.
SyncToRenderThread
Synchronizes all CoreObjects with dirty render proxy data with the render thread.
Their dirty data will be allocated using the global frame allocator and then queued for update using the render thread queue for the calling thread.
- swapBuffers
- Switch ownership of the current buffer from the main thread to the render thread. All data written during sync download
will now become owned by the render thread, and a new buffer will be made available on the main thread. Note that
there is a limited number of buffers (as specified by RenderThread::kSyncBufferCount), and the caller must ensure
that the render thread is still not using the oldest buffer. Generally this is done by ensuring that the render thread
never runs more than
RenderThread::kSyncBufferCount - 1frames ahead of the main thread).
SyncToRenderThread
Synchronizes an individual dirty CoreObject with the render thread.
Its dirty data will be allocated using the global frame allocator and then queued for update the render thread queue for the calling thread.
staticInstance
Returns a reference to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticInstancePtr
Returns a pointer to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticShutDown
Shuts down this module and frees any resources it is using.
staticIsStarted
Query if the module has been started.
Protected
Methods
~Module<T>
OnStartUp
Override if you want your module to be notified once it has been constructed and started.
OnShutDown
Override if you want your module to be notified just before it is deleted.
staticInstanceInternal
Returns a singleton instance of this module.
Private
Methods
SyncDownload
Stores all syncable data from dirty core objects into memory allocated by the provided allocator.
Additional meta-data is stored internally to be used by call to SyncUpload().
- allocator
- Allocator to use for allocating memory for stored data.
SyncUpload
Copies all the data stored by previous call to SyncDownload() into destination render proxies.
UpdateDependencies
Updates the cached list of dependencies and dependants for the specified object.
- object
- Object to update dependencies for.
- dependencies
- New set of dependencies, or null to clear all dependencies.
Fields
mObjects
mDirtyObjects
mDependencies
mDependants
mDestroyedSyncData
mPerFrameSyncData
mSyncAllocators
Allocators used for passing temporary data from main thread to the render thread every frame.
As external code guarantees that render thread will never go more than RenderThread::kSyncBufferCount frames ahead of the main thread, we use a ring-buffer of allocators. We use one extra buffer as one buffer could currently be in progress of being passed from main to render thread.