From 0b066539fe68dc5750900c3452189645c40adb45 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 24 Nov 2021 10:47:54 -0500 Subject: DRTVWR-546, SL-16220, SL-16094: Undo previous glthread branch revert. Reverting a merge is sticky: it tells git you never want to see that branch again. Merging the DRTVWR-546 branch, which contained the revert, into the glthread branch undid much of the development work on that branch. To restore it we must revert the revert. This reverts commit 029b41c0419e975bbb28454538b46dc69ce5d2ba. --- indra/llrender/llimagegl.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'indra/llrender/llimagegl.h') diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index bb46dbc639..ae773bb362 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -37,6 +37,7 @@ #include "llunits.h" #include "llthreadsafequeue.h" #include "llrender.h" +#include "threadpool.h" #include "workqueue.h" class LLTextureAtlas ; @@ -198,6 +199,7 @@ private: void freePickMask(); LLPointer mSaveData; // used for destroyGL/restoreGL + LL::WorkQueue::weak_t mMainQueue; U8* mPickMask; //downsampled bitmap approximation of alpha channel. NULL if no alpha channel U16 mPickMaskWidth; U16 mPickMaskHeight; @@ -271,7 +273,6 @@ public: public: static void initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha = false); - static void updateClass(); static void cleanupClass() ; private: @@ -307,34 +308,24 @@ public: }; -class LLImageGLThread : public LLThread +class LLImageGLThread : public LLSimpleton, LL::ThreadPool { public: LLImageGLThread(LLWindow* window); // post a function to be executed on the LLImageGL background thread - bool post(const std::function& func); - - //post a callback to be executed on the main thread - bool postCallback(const std::function& callback); - - void executeCallbacks(); + template + bool post(CALLABLE&& func) + { + return getQueue().postIfOpen(std::forward(func)); + } void run() override; - // Work Queue for background thread - LL::WorkQueue mFunctionQueue; - - // Work Queue for main thread (run from updateClass) - LL::WorkQueue mCallbackQueue; - +private: LLWindow* mWindow; void* mContext = nullptr; LLAtomicBool mFinished; - - std::queue> mPendingCallbackQ; - - static LLImageGLThread* sInstance; }; -- cgit v1.2.3