diff options
author | Oz Linden <oz@lindenlab.com> | 2011-11-24 06:56:57 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-11-24 06:56:57 -0500 |
commit | b69be18d7b41b639d3c62354ca7ab6e3bc32f1cb (patch) | |
tree | 355347be68e29f59ad5299abd9b42423359eb60e /indra/llwindow/llwindowwin32.cpp | |
parent | fb605a047aa1c6b293b9546a06ac800c53d109ba (diff) | |
parent | 8c86a08e72708e96dcf67830518187a00478bbfd (diff) |
merge changes for vmrg-193
Diffstat (limited to 'indra/llwindow/llwindowwin32.cpp')
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index a84bd5fb08..799f0a3fab 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -41,6 +41,7 @@ #include "llgl.h" #include "llstring.h" #include "lldir.h" +#include "llglslshader.h" // System includes #include <commdlg.h> @@ -1125,7 +1126,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_INFOS("Window") << "Drawing context is created." << llendl ; gGLManager.initWGL(); - + if (wglChoosePixelFormatARB) { // OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we @@ -1384,7 +1385,53 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } - if (!(mhRC = wglCreateContext(mhDC))) + mhRC = 0; + if (wglCreateContextAttribsARB) + { //attempt to create a specific versioned context + S32 attribs[] = + { //start at 4.2 + WGL_CONTEXT_MAJOR_VERSION_ARB, 4, + 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 + }; + + bool done = false; + while (!done) + { + mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); + + 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; + + if (LLRender::sGLCoreProfile) + { + LLGLSLShader::sNoFixedFunction = true; + } + } + } + } + + if (!mhRC && !(mhRC = wglCreateContext(mhDC))) { close(); OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); @@ -1404,7 +1451,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } - + // Disable vertical sync for swap if (disable_vsync && wglSwapIntervalEXT) { @@ -2910,7 +2957,6 @@ BOOL LLWindowWin32::resetDisplayResolution() void LLWindowWin32::swapBuffers() { - glFinish(); SwapBuffers(mhDC); } |