From 118a8c2ee43d4c26c78c1ab1092e46c460ed4482 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sun, 12 Nov 2023 17:17:46 -0500 Subject: [PATCH] Attempt to fix bizarre init crash on mac --- indra/llrender/llrender.cpp | 19 +++++++++++++++++-- indra/newview/llappviewer.cpp | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 2c4bb6b28be..58272ec12e0 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -54,7 +54,7 @@ extern void APIENTRY gl_debug_callback(GLenum source, ; #endif -thread_local LLRender gGL; +thread_local LLRender gGL = LLRender(); // Handy copies of last good GL matrices LLMatrix4a gGLModelView; @@ -66,7 +66,7 @@ LLMatrix4a gGLProjection; LLMatrix4a gGLDeltaModelView; LLMatrix4a gGLInverseDeltaModelView; -S32 gGLViewport[4]; +S32 gGLViewport[4] = {}; U32 LLRender::sUICalls = 0; @@ -120,6 +120,21 @@ static const GLenum sGLBlendFactor[] = GL_ZERO // 'BF_UNDEF' }; +void init_gl_globals() +{ + gGLManager = LLGLManager(); + gGL = LLRender(); + + gGLModelView.setIdentity(); + gGLLastModelView.setIdentity(); + gGLLastProjection.setIdentity(); + gGLProjection.setIdentity(); + + // transform from last frame's camera space to this frame's camera space (and inverse) + gGLDeltaModelView.setIdentity(); + gGLInverseDeltaModelView.setIdentity(); +} + LLTexUnit::LLTexUnit(S32 index) : mCurrTexType(TT_NONE), mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7c108228e45..5400cb3cc10 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3028,10 +3028,14 @@ void LLAppViewer::initStrings() } } +extern void init_gl_globals(); + bool LLAppViewer::initWindow() { LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL; + init_gl_globals(); + // store setting in a global for easy access and modification gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient"); -- GitLab