Add extra workQueue synchronisation

Minor issues with the Ogre API that can be trivial to fix
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Add extra workQueue synchronisation

Post by al2950 »

Bug tracker link: http://www.ogre3d.org/mantis/view.php?id=386

There are several cases where I need to make sure certain tasks have completed before I render another frame. As a result I would like to add an extra feature to the workQueue which will allow certain tasks to be added which must be completed before the next frame. The implementation of this should be fairly simple, however is this a stupid idea!!?? Should I go about this in a different way?

The way I think this should work is to have an extra, optional, parameter in "addRequest" called completeBeforeNextFrame, or something! If true its added to a different task queue. I have not decided how the logic should work on dealing out the tasks in the different queues as it will depend on the number of worker threads. The workQueue then just needs an extra method which will wait for the completeBeforeNextFrame queue to be empty (a bit more logic needed here as when queue is empty it does not mean all tasks have finished)

This may require a bit more locking but it should be minimal and not affect the performance.

Anyway I hope that makes sense, please let me know your thoughts!
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58

Re: Add extra workQueue synchronisation

Post by CABAListic »

I'm not sure there's additional logic required.
You could use a ResponseHandler to know when your job finished. You could then, in your render loop, wait for a condition set by this Handler; that's what would need to be done either way.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Add extra workQueue synchronisation

Post by al2950 »

I could use a ResponseHandler to do this, infact that is how I am doing it now, sort of! However it seems like a feature that would be needed by most engines which is why I am suggesting a more central approach in the work queue.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Add extra workQueue synchronisation

Post by al2950 »

Would anyone been interested in a patch that did this!? Ogre Mods?