Skip to content

Commit

Permalink
GRAPHICS: Use the new frame locking mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Feb 4, 2014
1 parent 3acce33 commit 98fe5f3
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/graphics/aurora/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "common/stream.h"
#include "common/uuid.h"

#include "graphics/graphics.h"
#include "graphics/util.h"
#include "graphics/meshutil.h"
#include "graphics/materialman.h"
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/** Macro to lock the SceneManager / frame rendering for the remainder of the current scope.
Note: To avoid deadlocks, never use the RequestManager to force a function to run in the
main thread after the SceneManager has been locked! */
#define LOCK_FRAME() OGRE_LOCK_MUTEX(Ogre::Root::getSingleton().getSceneManager("world")->sceneGraphMutex)
#define LOCK_FRAME() ::Graphics::FrameLocker xoreosFrameLocker;

namespace Common {
class UString;
Expand Down
1 change: 1 addition & 0 deletions src/graphics/renderable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "common/threads.h"

#include "graphics/graphics.h"
#include "graphics/util.h"
#include "graphics/renderable.h"
#include "graphics/materialman.h"
Expand Down
2 changes: 0 additions & 2 deletions src/graphics/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class OgreAnimator : public Ogre::FrameListener {
}

bool frameRenderingQueued(const Ogre::FrameEvent &event) {
LOCK_FRAME();

_currentFPS++;
if ((_currentFPSTime += event.timeSinceLastFrame) >= 1.0) {
_lastFPS = _currentFPS / _currentFPSTime;
Expand Down
7 changes: 2 additions & 5 deletions src/graphics/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include "common/ustring.h"
#include "common/maths.h"

#define LOCK_SCENE() OGRE_LOCK_MUTEX(Ogre::Root::getSingleton().getSceneManager("world")->sceneGraphMutex)

namespace Graphics {

static inline Ogre::SceneManager &getOgreSceneManager(const Common::UString &name = "world") {
Expand Down Expand Up @@ -128,9 +130,4 @@ static inline uint32 deSwizzleOffset(uint32 x, uint32 y, uint32 width, uint32 he

} // End of namespace Graphics

/** Macro to lock the SceneManager / frame rendering for the remainder of the current scope.
Note: To avoid deadlocks, never use the RequestManager to force a function to run in the
main thread after the SceneManager has been locked! */
#define LOCK_FRAME() OGRE_LOCK_MUTEX(Graphics::getOgreSceneManager().sceneGraphMutex)

#endif // GRAPHICS_UTIL_H
4 changes: 0 additions & 4 deletions src/video/aurora/videoplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ class VideoFrameRenderer : public Ogre::FrameListener {
}

void createOverlay() {
LOCK_FRAME();

// Dimensions and coordinates

int scaledWidth, scaledHeight;
Expand Down Expand Up @@ -208,8 +206,6 @@ class VideoFrameRenderer : public Ogre::FrameListener {
}

bool frameRenderingQueued(const Ogre::FrameEvent &event) {
LOCK_FRAME();

if (!_overlay)
createOverlay();

Expand Down

0 comments on commit 98fe5f3

Please sign in to comment.