unsigned int* MessageBuffer::ReserveMessageSlot( std::size_t size )
{
+ Dali::Mutex::ScopedLock lock(mMutex);
DALI_ASSERT_DEBUG( 0 != size );
// Number of aligned words required to handle a message of size in bytes
// EXTERNAL INCLUDES
#include <cstddef>
+// INTERNAL INCLUDES
+#include <dali/devel-api/common/mutex.h>
+
namespace Dali
{
std::size_t mCapacity; ///< The memory allocated with respect to sizeof(WordType)
std::size_t mSize; ///< The memory reserved for messages with respect to sizeof(WordType)
+ Dali::Mutex mMutex; ///< Mutex to ensure correct access locking
};
} // namespace Internal
Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
- float frameTime; ///< The elapsed time since the previous frame
+ volatile float frameTime; ///< The elapsed time since the previous frame
float lastFrameTime; ///< Last frame delta.
unsigned int frameCount; ///< The current frame count
void RenderManager::SetFrameDeltaTime( float deltaTime )
{
+ Dali::Mutex::ScopedLock lock( mMutex );
mImpl->frameTime = deltaTime;
}
PERF_MONITOR_END(PerformanceMonitor::DRAW_NODES);
- // Update the frame time
- mImpl->lastFrameTime = mImpl->frameTime;
+ SetLastFrameTime();
// check if anything has been posted to the update thread
bool updateRequired = !mImpl->resourcePostProcessQueue[ mImpl->renderBufferIndex ].empty();
return updateRequired;
}
+void RenderManager::SetLastFrameTime()
+{
+ Dali::Mutex::ScopedLock lock(mMutex);
+ mImpl->lastFrameTime = mImpl->frameTime;
+}
+
void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultShader, float elapsedTime )
{
Rect<int> viewportRect;
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/common/mutex.h>
#include <dali/public-api/math/rect.h>
#include <dali/internal/common/shader-saver.h>
#include <dali/internal/render/common/post-process-resource-dispatcher.h>
// Undefined
RenderManager& operator=( const RenderManager& rhs );
+ // Set the last frame time while locking access
+ void SetLastFrameTime();
+
private:
struct Impl;
Impl* mImpl;
+ Dali::Mutex mMutex;
};
: container0( NULL ),
container1( NULL )
{
+ Dali::Mutex::ScopedLock lock(mMutex);
container0 = new MessageBuffer( INITIAL_BUFFER_SIZE );
container1 = new MessageBuffer( INITIAL_BUFFER_SIZE );
}
RenderQueue::~RenderQueue()
{
+ Dali::Mutex::ScopedLock lock(mMutex);
if( container0 )
{
for( MessageBuffer::Iterator iter = container0->Begin(); iter.IsValid(); iter.Next() )
unsigned int* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size )
{
+ Dali::Mutex::ScopedLock lock(mMutex);
MessageBuffer* container = GetCurrentContainer( updateBufferIndex );
return container->ReserveMessageSlot( size );
void RenderQueue::ProcessMessages( BufferIndex bufferIndex )
{
+ Dali::Mutex::ScopedLock lock(mMutex);
MessageBuffer* container = GetCurrentContainer( bufferIndex );
for( MessageBuffer::Iterator iter = container->Begin(); iter.IsValid(); iter.Next() )
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/common/mutex.h>
#include <dali/internal/common/buffer-index.h>
#include <dali/internal/common/message-buffer.h>
private:
+ Dali::Mutex mMutex; ///< Mutex to ensure access locking
MessageBuffer* container0; ///< Messages are queued here when the update buffer index == 0
MessageBuffer* container1; ///< Messages are queued here when the update buffer index == 1
};
void PanGesture::AddGesture( const Dali::PanGesture& gesture )
{
+ Dali::Mutex::ScopedLock lock( mMutex );
mGestures[ mWritePosition ] = gesture;
// Update our write position.
bool PanGesture::ReadAndResampleGestures( FrameGestureInfo& info, unsigned int currentTimestamp )
{
PanInfo lastReadGesture;
+ Dali::Mutex::ScopedLock lock( mMutex );
while( mReadPosition != mWritePosition )
{
// Copy the gesture first
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/common/mutex.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/pan-gesture.h>
#include <dali/internal/update/common/property-owner.h>
PanInfo mLastGesture; ///< The last gesture. (last update frame).
PanInfo mTargetGesture; ///< The most recent input gesture, if the current used gesture does not match.
PanInfo mLastUnmodifiedGesture; ///< The last gesture before any processing was done on it.
- unsigned int mWritePosition; ///< The next PanInfo buffer to write to. (starts at 0).
+ volatile unsigned int mWritePosition; ///< The next PanInfo buffer to write to. (starts at 0).
unsigned int mReadPosition; ///< The next PanInfo buffer to read. (starts at 0).
bool mNotAtTarget; ///< Keeps track of if the last gesture used was the most recent received.
bool mInGesture; ///< True if the gesture is currently being handled i.e. between Started <-> Finished/Cancelled.
SmoothingMode mSmoothingMode; ///< The pan gesture prediction mode
float mSmoothingAmount; ///< How much smoothing to apply [0.0f,1.0f]
PanGestureProfiling* mProfiling; ///< NULL unless pan-gesture profiling information is required.
+ Dali::Mutex mMutex; ///< Mutex to lock access.
};
} // namespace SceneGraph