diff options
| author | Dave Parks <davep@lindenlab.com> | 2011-09-20 03:34:09 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2011-09-20 03:34:09 -0500 | 
| commit | 66acb932ba7bbd7fecbe78a34e753b5aab2d2104 (patch) | |
| tree | 87ae87b36d20082008feeb7c46c38d2d6d498332 | |
| parent | 9ea41c8094695365bc7ea10165ffd54cda204e88 (diff) | |
SH-2244 Add "RenderGLCoreProfile" debug setting that allows the viewer to start with a non-compatibility-profile OpenGL context.
| -rw-r--r-- | indra/llrender/llgl.cpp | 13 | ||||
| -rw-r--r-- | indra/llrender/llglheaders.h | 2 | ||||
| -rw-r--r-- | indra/llrender/llrender.cpp | 1 | ||||
| -rw-r--r-- | indra/llrender/llrender.h | 1 | ||||
| -rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 28 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
| -rw-r--r-- | indra/newview/llappviewer.cpp | 2 | 
7 files changed, 58 insertions, 0 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 771693f2f0..718de346f6 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -249,6 +249,10 @@ PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL;  PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;  PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL; +#if LL_WINDOWS +PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; +#endif +  // vertex shader prototypes  #if LL_LINUX || LL_SOLARIS  PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; @@ -409,6 +413,15 @@ void LLGLManager::initWGL()  		LL_WARNS("RenderInit") << "No ARB pixel format extensions" << LL_ENDL;  	} +	if (ExtensionExists("WGL_ARB_create_context",gGLHExts.mSysExts)) +	{ +		GLH_EXT_NAME(wglCreateContextAttribsARB) = (PFNWGLCREATECONTEXTATTRIBSARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreateContextAttribsARB"); +	} +	else +	{ +		LL_WARNS("RenderInit") << "No ARB create context extensions" << LL_ENDL; +	} +	  	if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts))  	{          GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT"); diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 851a75629e..f319009bc8 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -531,6 +531,8 @@ extern PFNGLSAMPLEMASKIPROC glSampleMaski;  #include "GL/glext.h"  #include "GL/glh_extensions.h" +// WGL_ARB_create_context +extern PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;  // GL_ARB_vertex_buffer_object  extern PFNGLBINDBUFFERARBPROC		glBindBufferARB; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index f0d59d0eaf..efeb7709a4 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -47,6 +47,7 @@ S32	gGLViewport[4];  U32 LLRender::sUICalls = 0;  U32 LLRender::sUIVerts = 0;  U32 LLTexUnit::sWhiteTexture = 0; +bool LLRender::sGLCoreProfile = false;  static const U32 LL_NUM_TEXTURE_LAYERS = 32;   static const U32 LL_NUM_LIGHT_UNITS = 8; diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 7d636060f5..44d9ec1f15 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -428,6 +428,7 @@ public:  public:  	static U32 sUICalls;  	static U32 sUIVerts; +	static bool sGLCoreProfile;  private:  	friend class LLLightState; 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 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 27598c9aac..32d4097ff3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8591,6 +8591,17 @@        <key>Value</key>        <real>1.0</real>      </map> +    <key>RenderGLCoreProfile</key> +    <map> +      <key>Comment</key> +      <string>Don't use a compatibility profile OpenGL context.  Requires restart.  Basic shaders MUST be enabled.</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>0</integer> +    </map>      <key>RenderGlow</key>      <map>        <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7e597fe5dc..bb0679de74 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -518,6 +518,8 @@ static void settings_to_globals()  	LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize")); +	LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLCoreProfile"); +  	LLImageGL::sGlobalUseAnisotropic	= gSavedSettings.getBOOL("RenderAnisotropic");  	LLVOVolume::sLODFactor				= gSavedSettings.getF32("RenderVolumeLODFactor");  	LLVOVolume::sDistanceFactor			= 1.f-LLVOVolume::sLODFactor * 0.1f;  | 
