From 66acb932ba7bbd7fecbe78a34e753b5aab2d2104 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 20 Sep 2011 03:34:09 -0500 Subject: SH-2244 Add "RenderGLCoreProfile" debug setting that allows the viewer to start with a non-compatibility-profile OpenGL context. --- indra/llwindow/llwindowwin32.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 1239e2d40b..2ba14f8f6e 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1122,6 +1122,34 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO gGLManager.initWGL(); + if (wglCreateContextAttribsARB && LLRender::sGLCoreProfile) + { + S32 attribs[] = + { + WGL_CONTEXT_MAJOR_VERSION_ARB, 4, + WGL_CONTEXT_MINOR_VERSION_ARB, 0, + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, + 0 + }; + + HGLRC res = wglCreateContextAttribsARB(mhDC, mhRC, attribs); + + if (!res) + { + attribs[1] = 3; + attribs[3] = 1; + + res = wglCreateContextAttribsARB(mhDC, mhRC, attribs); + } + + if (res) + { + wglMakeCurrent(mhDC, res); + wglDeleteContext(mhRC); + mhRC = res; + } + } + if (wglChoosePixelFormatARB) { // OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we -- cgit v1.2.3 From a2d08a6d80c4be7456d30f728da1838e63eb397f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 22 Sep 2011 00:10:57 -0500 Subject: SH-2244 Fix "RenderGLCoreProfile" actually make a core profile context and modify viewer to run under said context without generating errors. --- indra/llwindow/llwindowwin32.cpp | 61 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 2ba14f8f6e..bac23279cc 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 @@ -1121,34 +1122,6 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO } gGLManager.initWGL(); - - if (wglCreateContextAttribsARB && LLRender::sGLCoreProfile) - { - S32 attribs[] = - { - WGL_CONTEXT_MAJOR_VERSION_ARB, 4, - WGL_CONTEXT_MINOR_VERSION_ARB, 0, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - 0 - }; - - HGLRC res = wglCreateContextAttribsARB(mhDC, mhRC, attribs); - - if (!res) - { - attribs[1] = 3; - attribs[3] = 1; - - res = wglCreateContextAttribsARB(mhDC, mhRC, attribs); - } - - if (res) - { - wglMakeCurrent(mhDC, res); - wglDeleteContext(mhRC); - mhRC = res; - } - } if (wglChoosePixelFormatARB) { @@ -1406,7 +1379,35 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } - if (!(mhRC = wglCreateContext(mhDC))) + mhRC = 0; + if (wglCreateContextAttribsARB) + { //attempt to create a non-compatibility profile context + S32 attribs[] = + { + WGL_CONTEXT_MAJOR_VERSION_ARB, 4, + WGL_CONTEXT_MINOR_VERSION_ARB, 0, + 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) + { + attribs[1] = 3; + attribs[3] = 3; + + mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); + } + + if (mhRC) + { //success, disable fixed function calls + LLGLSLShader::sNoFixedFunction = true; + } + } + + if (!mhRC && !(mhRC = wglCreateContext(mhDC))) { close(); OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); @@ -1426,7 +1427,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) { -- cgit v1.2.3 From 967479f9039dc358b9419be7f117162f7d90609c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 5 Oct 2011 15:12:02 -0500 Subject: SH-2031 Fix for stall in image update -- don't use the CPU to convert a height map into a normal map -- use the GPU instead via a shader. Also, WTF glFinish? --- indra/llwindow/llwindowwin32.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index e4e5256ae7..bac23279cc 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2925,7 +2925,6 @@ BOOL LLWindowWin32::resetDisplayResolution() void LLWindowWin32::swapBuffers() { - glFinish(); SwapBuffers(mhDC); } -- cgit v1.2.3 From 1a499c13c813d4aa9631ffae00b36a053f260747 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 Oct 2011 11:06:57 -0500 Subject: NEVER use glFinish outside shutdownGL --- indra/llwindow/llwindowmacosx.cpp | 1 - indra/llwindow/llwindowsdl.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 4dd11541b9..cb2abc5bc0 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1266,7 +1266,6 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size) void LLWindowMacOSX::swapBuffers() { - glFinish(); aglSwapBuffers(mContext); } diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index e41aa9820f..91689f54fd 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -985,7 +985,6 @@ void LLWindowSDL::swapBuffers() { if (mWindow) { - glFinish(); SDL_GL_SwapBuffers(); } } -- cgit v1.2.3