Skip to content
Snippets Groups Projects
Commit bc65e929 authored by David Parks's avatar David Parks
Browse files

SH-2240 Fix for heap corruption under debugger when starting viewer with basic shaders disabled.

parent 969aa248
No related branches found
No related tags found
No related merge requests found
...@@ -1381,29 +1381,42 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO ...@@ -1381,29 +1381,42 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
mhRC = 0; mhRC = 0;
if (wglCreateContextAttribsARB) if (wglCreateContextAttribsARB)
{ //attempt to create a non-compatibility profile context { //attempt to create a specific versioned context
S32 attribs[] = S32 attribs[] =
{ { //start at 4.2
WGL_CONTEXT_MAJOR_VERSION_ARB, 4, 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_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, WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
0 0
}; };
mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); bool done = false;
while (!done)
if (!mhRC)
{ {
attribs[1] = 3;
attribs[3] = 3;
mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
}
if (mhRC) if (!mhRC)
{ //success, disable fixed function calls {
LLGLSLShader::sNoFixedFunction = true; 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;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment