GraphicsEngine::get_render_lock()

This commit is contained in:
David Rose 2012-01-03 03:05:54 +00:00
parent cfcde491a8
commit f110a269c8
3 changed files with 18 additions and 0 deletions

View File

@ -13,6 +13,20 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: GraphicsEngine::get_render_lock
// Access: Published
// Description: Returns a ReMutex object that is held by the
// GraphicsEngine during the entire call to
// render_frame(). While you hold this lock you can be
// confident that no part of the frame will be rendered
// (at least by the app thread).
////////////////////////////////////////////////////////////////////
INLINE const ReMutex &GraphicsEngine::
get_render_lock() const {
return _public_lock;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GraphicsEngine::set_auto_flip // Function: GraphicsEngine::set_auto_flip
// Access: Published // Access: Published

View File

@ -645,6 +645,7 @@ get_window(int n) const {
void GraphicsEngine:: void GraphicsEngine::
render_frame() { render_frame() {
Thread *current_thread = Thread::get_current_thread(); Thread *current_thread = Thread::get_current_thread();
ReMutexHolder public_holder(_public_lock);
// Since this gets called every frame, we should take advantage of // Since this gets called every frame, we should take advantage of
// the opportunity to flush the cache if necessary. // the opportunity to flush the cache if necessary.

View File

@ -63,6 +63,8 @@ PUBLISHED:
void set_threading_model(const GraphicsThreadingModel &threading_model); void set_threading_model(const GraphicsThreadingModel &threading_model);
GraphicsThreadingModel get_threading_model() const; GraphicsThreadingModel get_threading_model() const;
INLINE const ReMutex &get_render_lock() const;
INLINE void set_auto_flip(bool auto_flip); INLINE void set_auto_flip(bool auto_flip);
INLINE bool get_auto_flip() const; INLINE bool get_auto_flip() const;
@ -325,6 +327,7 @@ private:
bool _singular_warning_this_frame; bool _singular_warning_this_frame;
ReMutex _lock; ReMutex _lock;
ReMutex _public_lock;
class LoadedTexture { class LoadedTexture {
public: public: