Not really a "feature" request, but not really Help either. I would like to use ResourceBackgroundQueue to load resources in the background, but don't know how, and looking through the forums it looks like it's easy to make obvious mistakes trying to use it (like not compiling Ogre with OGRE_THREAD_SUPPORT defined.) It would be very helpful if there was a tutorial on the wiki or something about loading resources in the background.
Oh, I guess I do have a feature request. Enabling thread support shouldn't involve recompiling Ogre, as some people (like me) just download the binaries. It should either be a preprocessor definition that doesn't involve recompiling Ogre, or a function call at startup.
ResourceBackgroundQueue Tutorial
- Moohasha
- Gnoll
- Posts: 672
- Joined: Fri Dec 07, 2007 7:37 pm
- x 8
ResourceBackgroundQueue Tutorial
Black holes are where God divided by 0
-
scratchyrice
- Gnome
- Posts: 361
- Joined: Thu Apr 27, 2006 9:14 pm
- Location: United Kingdom - England
- x 19
Re: ResourceBackgroundQueue Tutorial
I second this. Im currently in the procsess of learning to use background resources, So i may do a small guide my self. But we still should not have to recompile the whole libary to enable mutlithreading.
AMD Ryzen 7900x, Gigabyte Nvidia GeForce 3080 10GB, 32GB DDR5
- Azgur
- Goblin
- Posts: 264
- Joined: Thu Aug 21, 2008 4:48 pm
Re: ResourceBackgroundQueue Tutorial
It makes sense in a way. Threading will introduce locking at places where it wouldn't be needed otherwise.scratchyrice wrote: But we still should not have to recompile the whole libary to enable mutlithreading.
This might be a small performance impact you wouldn't want if you're not using threading.
That's my guess at least.
- Moohasha
- Gnoll
- Posts: 672
- Joined: Fri Dec 07, 2007 7:37 pm
- x 8
Re: ResourceBackgroundQueue Tutorial
You're right, but that's only if threading is enabled and you aren't using it. I'm talking about having some preprocessor definition in YOUR apps (rather than Ogre), or some function call that enables/disables threading, either at linkage or startup. Qt does this with a preprocessor. You have to #define QT_THREAD_SUPPORT in order to use the classes QThread and QMutex. You don't have to rebuild Qt.Azgur wrote:It makes sense in a way. Threading will introduce locking at places where it wouldn't be needed otherwise.
I've looked at the source code, but not well enough to know how the threading works, but it sounds like there's one background thread to load resources, and all ResourceManagers have a mutex to make them thread safe, in which case it might be something as simple as:
Code: Select all
void ResourceManager::enableBackgroundLoading(bool enable)
{
if (enable)
{
// Start background thread
// Instanciate shared mutex
// Anything else to support threading
}
}Black holes are where God divided by 0