summaryrefslogtreecommitdiff
path: root/indra/llrender/llimagegl.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2021-11-24 10:47:54 -0500
committerNat Goodspeed <nat@lindenlab.com>2021-11-24 10:47:54 -0500
commit0b066539fe68dc5750900c3452189645c40adb45 (patch)
treefd01b6eaf174f7744fd82a28b0b948d301fd4d2b /indra/llrender/llimagegl.h
parent78d837789a3741c65c3334934d96a505a522ee43 (diff)
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.
Diffstat (limited to 'indra/llrender/llimagegl.h')
-rw-r--r--indra/llrender/llimagegl.h27
1 files changed, 9 insertions, 18 deletions
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<LLImageRaw> 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<LLImageGLThread>, LL::ThreadPool
{
public:
LLImageGLThread(LLWindow* window);
// post a function to be executed on the LLImageGL background thread
- bool post(const std::function<void()>& func);
-
- //post a callback to be executed on the main thread
- bool postCallback(const std::function<void()>& callback);
-
- void executeCallbacks();
+ template <typename CALLABLE>
+ bool post(CALLABLE&& func)
+ {
+ return getQueue().postIfOpen(std::forward<CALLABLE>(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<std::function<void()>> mPendingCallbackQ;
-
- static LLImageGLThread* sInstance;
};