![]() |
OGRE 14.6
Object-Oriented Graphics Rendering Engine
|
Performs resource operations on the shared background work queue. More...
#include <OgreResourceBackgroundQueue.h>
Public Member Functions | |
| ResourceBackgroundQueue () | |
| virtual | ~ResourceBackgroundQueue () |
| std::future< void > | initialiseAllResourceGroups () |
| Initialise all resource groups which are yet to be initialised in the background. | |
| std::future< void > | initialiseResourceGroup (const String &name) |
| Initialise a resource group in the background. | |
| std::future< void > | load (const ResourcePtr &res) |
| Load a single resource in the background. | |
| std::future< void > | loadResourceGroup (const String &name) |
| Loads a resource group in the background. | |
| std::future< void > | prepare (const ResourcePtr &res) |
| Prepare a single resource in the background. | |
| std::future< void > | prepareResourceGroup (const String &name) |
| Prepares a resource group in the background. | |
| std::future< void > | unload (const ResourcePtr &res) |
| Unload a single resource in the background. | |
| std::future< void > | unloadResourceGroup (const String &name) |
| Unloads a resource group in the background. | |
| Public Member Functions inherited from Ogre::Singleton< ResourceBackgroundQueue > | |
| ~Singleton (void) | |
Static Public Member Functions | |
| static ResourceBackgroundQueue & | getSingleton (void) |
| Get the singleton instance. | |
| static ResourceBackgroundQueue * | getSingletonPtr (void) |
| Get the singleton instance. | |
| Static Public Member Functions inherited from Ogre::Singleton< ResourceBackgroundQueue > | |
| static ResourceBackgroundQueue & | getSingleton (void) |
| Get the singleton instance. | |
| static ResourceBackgroundQueue * | getSingletonPtr (void) |
| Get the singleton instance. | |
Performs resource operations on the shared background work queue.
All operations are queued via Root::getWorkQueue in order to share the thread pool amongst all background tasks. You should therefore refer to Background Resource Loading for configuring the threads and for the lifetime and exception rules of tasks; this class merely provides an interface that is specific to resource handling.
Every call returns a std::future<void> that becomes ready when the background portion of the operation has finished. This may be before the corresponding Resource::Listener callback has run, because those callbacks are dispatched back to the main thread. Use the future to wait for the data to become available, and a listener to observe the completed resource.
Which resource methods can run on a worker thread depends on OGRE_THREAD_SUPPORT. With the default configuration (3), workers cannot access the RenderSystem: prepare() runs Resource::prepare in the background, while load() prepares in the background and performs the actual load on the main thread. With OGRE_THREAD_SUPPORT == 1, resources are fully thread-safe and load() runs entirely in the background.
| Ogre::ResourceBackgroundQueue::ResourceBackgroundQueue | ( | ) |
Referenced by getSingleton(), and getSingletonPtr().
|
virtual |
| std::future< void > Ogre::ResourceBackgroundQueue::initialiseResourceGroup | ( | const String & | name | ) |
Initialise a resource group in the background.
| name | The name of the resource group to initialise |
| std::future< void > Ogre::ResourceBackgroundQueue::initialiseAllResourceGroups | ( | ) |
Initialise all resource groups which are yet to be initialised in the background.
| std::future< void > Ogre::ResourceBackgroundQueue::prepareResourceGroup | ( | const String & | name | ) |
Prepares a resource group in the background.
| name | The name of the resource group to prepare |
| std::future< void > Ogre::ResourceBackgroundQueue::loadResourceGroup | ( | const String & | name | ) |
Loads a resource group in the background.
| name | The name of the resource group to load |
| std::future< void > Ogre::ResourceBackgroundQueue::unload | ( | const ResourcePtr & | res | ) |
Unload a single resource in the background.
| std::future< void > Ogre::ResourceBackgroundQueue::unloadResourceGroup | ( | const String & | name | ) |
Unloads a resource group in the background.
| name | The name of the resource group to load |
| std::future< void > Ogre::ResourceBackgroundQueue::prepare | ( | const ResourcePtr & | res | ) |
Prepare a single resource in the background.
| std::future< void > Ogre::ResourceBackgroundQueue::load | ( | const ResourcePtr & | res | ) |
Load a single resource in the background.
|
static |
Get the singleton instance.
References ResourceBackgroundQueue().
|
static |
Get the singleton instance.
References ResourceBackgroundQueue().