summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llimagegl.cpp6
-rw-r--r--indra/llrender/llimagegl.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 1b6920fe3b..eda61d3c74 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -2257,6 +2257,7 @@ LLImageGLThread::LLImageGLThread(LLWindow* window)
: ThreadPool("LLImageGL", 1, 1024*1024)
, mWindow(window)
{
+ LL_PROFILE_ZONE_SCOPED;
mFinished = false;
mContext = mWindow->createSharedContext();
@@ -2264,8 +2265,13 @@ LLImageGLThread::LLImageGLThread(LLWindow* window)
void LLImageGLThread::run()
{
+ LL_PROFILE_ZONE_SCOPED;
// We must perform setup on this thread before actually servicing our
// WorkQueue, likewise cleanup afterwards.
+ while (mContext == nullptr)
+ { // HACK -- wait for mContext to be initialized since this thread will usually start before mContext is set
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
mWindow->makeContextCurrent(mContext);
gGL.init();
ThreadPool::run();
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index 27496def1d..ae773bb362 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -324,7 +324,7 @@ public:
private:
LLWindow* mWindow;
- void* mContext;
+ void* mContext = nullptr;
LLAtomicBool mFinished;
};