SH-2244 Add "RenderGLCoreProfile" debug setting that allows the viewer to start with a non-compatibility-profile OpenGL context.
parent
9ea41c8094
commit
66acb932ba
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -428,6 +428,7 @@ public:
|
|||
public:
|
||||
static U32 sUICalls;
|
||||
static U32 sUIVerts;
|
||||
static bool sGLCoreProfile;
|
||||
|
||||
private:
|
||||
friend class LLLightState;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue