diff options
author | Dave Parks <davep@lindenlab.com> | 2011-10-31 11:29:32 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-10-31 11:29:32 -0500 |
commit | bc65e929fc32950a42d58931694961263db9c8ed (patch) | |
tree | d4ca28768457cfc30bcbf642ee18f8085e942f3e /indra/llwindow | |
parent | 969aa248a4c398dd0608a447f99cf74683d09f65 (diff) |
SH-2240 Fix for heap corruption under debugger when starting viewer with basic shaders disabled.
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index bac23279cc..e46fcea692 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1381,29 +1381,42 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhRC = 0; if (wglCreateContextAttribsARB) - { //attempt to create a non-compatibility profile context + { //attempt to create a specific versioned context S32 attribs[] = - { + { //start at 4.2 WGL_CONTEXT_MAJOR_VERSION_ARB, 4, - WGL_CONTEXT_MINOR_VERSION_ARB, 0, + WGL_CONTEXT_MINOR_VERSION_ARB, 2, WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0, 0 }; - mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); - - if (!mhRC) + bool done = false; + while (!done) { - attribs[1] = 3; - attribs[3] = 3; - mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); - } - if (mhRC) - { //success, disable fixed function calls - LLGLSLShader::sNoFixedFunction = true; + if (!mhRC) + { + if (attribs[3] > 0) + { //decrement minor version + attribs[3]--; + } + else if (attribs[1] > 3) + { //decrement major version and start minor version over at 3 + attribs[1]--; + attribs[3] = 3; + } + else + { //we reached 3.0 and still failed, bail out + done = true; + } + } + else + { + llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl; + done = true; + } } } |