summaryrefslogtreecommitdiff
path: root/indra/llrender/llgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llgl.cpp')
-rw-r--r--indra/llrender/llgl.cpp65
1 files changed, 58 insertions, 7 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index cfc9ce735d..5ad8e7f5df 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -72,7 +72,7 @@ static const std::string HEADLESS_VERSION_STRING("1.0");
llofstream gFailLog;
-#if GL_ARB_debug_output
+#if GL_ARB_debug_output || GL_KHR_debug
#ifndef APIENTRY
#define APIENTRY
@@ -86,14 +86,24 @@ void APIENTRY gl_debug_callback(GLenum source,
const GLchar* message,
GLvoid* userParam)
{
+#if GL_ARB_debug_output
if (severity != GL_DEBUG_SEVERITY_HIGH_ARB &&
severity != GL_DEBUG_SEVERITY_MEDIUM_ARB &&
severity != GL_DEBUG_SEVERITY_LOW_ARB)
+#elif GL_KHR_debug
+ if (severity != GL_DEBUG_SEVERITY_HIGH_KHR &&
+ severity != GL_DEBUG_SEVERITY_MEDIUM_KHR &&
+ severity != GL_DEBUG_SEVERITY_LOW_KHR)
+#endif
{ //suppress out-of-spec messages sent by nvidia driver (mostly vertexbuffer hints)
return;
}
+#if GL_ARB_debug_output
if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
+#elif GL_KHR_debug
+ if (severity == GL_DEBUG_SEVERITY_HIGH_KHR)
+#endif
{
LL_WARNS() << "----- GL ERROR --------" << LL_ENDL;
}
@@ -106,7 +116,11 @@ void APIENTRY gl_debug_callback(GLenum source,
LL_WARNS() << "Severity: " << std::hex << severity << LL_ENDL;
LL_WARNS() << "Message: " << message << LL_ENDL;
LL_WARNS() << "-----------------------" << LL_ENDL;
+#if GL_ARB_debug_output
if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
+#elif GL_KHR_debug
+ if (severity == GL_DEBUG_SEVERITY_HIGH_KHR)
+#endif
{
LL_ERRS() << "Halting on GL Error" << LL_ENDL;
}
@@ -162,6 +176,8 @@ std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
PFNGLGETSTRINGIPROC glGetStringi = NULL;
#endif
+/*
+
// vertex blending prototypes
PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL;
PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL;
@@ -399,6 +415,7 @@ PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL;
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL;
PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = NULL;
#endif // LL_LINUX_NV_GL_HEADERS
+*/
#endif
LLGLManager gGLManager;
@@ -592,6 +609,7 @@ bool LLGLManager::initGL()
#endif
}
+#if GL_VERSION_1_3
if (mGLVersion >= 2.1f && LLImageGL::sCompressTextures)
{ //use texture compression
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
@@ -600,6 +618,7 @@ bool LLGLManager::initGL()
{ //GL version is < 3.0, always disable texture compression
LLImageGL::sCompressTextures = false;
}
+#endif
// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
// from being recognized as ATI.
@@ -616,7 +635,7 @@ bool LLGLManager::initGL()
mIsNVIDIA = TRUE;
}
else if (mGLVendor.find("INTEL") != std::string::npos
-#if LL_LINUX
+#if LL_LINUX || LL_FREEBSD
// The Mesa-based drivers put this in the Renderer string,
// not the Vendor string.
|| mGLRenderer.find("INTEL") != std::string::npos
@@ -715,7 +734,7 @@ bool LLGLManager::initGL()
stop_glerror();
GLint num_tex_image_units;
- glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
+ glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &num_tex_image_units);
mNumTextureImageUnits = llmin(num_tex_image_units, 32);
if (mHasMultitexture)
@@ -724,6 +743,7 @@ bool LLGLManager::initGL()
{
mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS);
}
+#if GL_VERSION_1_3
else
{
GLint num_tex_units;
@@ -734,6 +754,7 @@ bool LLGLManager::initGL()
mNumTextureUnits = llmin(mNumTextureUnits, 2);
}
}
+#endif
}
else
{
@@ -1012,7 +1033,11 @@ void LLGLManager::initExtensions()
mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts);
mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression");
mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
+#if GL_ARB_timer_query
mHasTimerQuery = ExtensionExists("GL_ARB_timer_query", gGLHExts.mSysExts);
+#else
+ mHasTimerQuery = ExtensionExists("GL_EXT_disjoint_timer_query", gGLHExts.mSysExts);
+#endif
mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts);
mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
mHasVertexArrayObject = ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts);
@@ -1053,14 +1078,22 @@ void LLGLManager::initExtensions()
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
+#if GL_ARB_debug_output
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
+#else
+ mHasDebugOutput = ExtensionExists("GL_KHR_debug", gGLHExts.mSysExts);
+#endif
+#if GL_EXT_draw_transform_feedback
+ mHasTransformFeedback = ExtensionExists("GL_EXT_draw_transform_feedback", gGLHExts.mSysExts);
+#else
mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE;
+#endif
#if !LL_DARWIN
mHasPointParameters = ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
#endif
#endif
-#if LL_LINUX
+#if LL_LINUX || LL_FREEBSD
LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL;
// Our extension support for the Linux Client is very young with some
// potential driver gotchas, so offer a semi-secret way to turn it off.
@@ -1180,6 +1213,7 @@ void LLGLManager::initExtensions()
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize);
+/*
#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
if (mHasVertexBufferObject)
@@ -1443,6 +1477,7 @@ void LLGLManager::initExtensions()
LL_DEBUGS("RenderInit") << "GL Probe: Got symbols" << LL_ENDL;
#endif
+*/
mInited = TRUE;
}
@@ -1471,12 +1506,14 @@ void log_glerror()
error = glGetError();
while (LL_UNLIKELY(error))
{
+#if GLU_VERSION_1_1
GLubyte const * gl_error_msg = gluErrorString(error);
if (NULL != gl_error_msg)
{
LL_WARNS() << "GL Error: " << error << " GL Error String: " << gl_error_msg << LL_ENDL ;
}
else
+#endif // GLU_VERSION_1_1
{
// gluErrorString returns NULL for some extensions' error codes.
// you'll probably have to grep for the number in glext.h.
@@ -1495,6 +1532,7 @@ void do_assert_glerror()
while (LL_UNLIKELY(error))
{
quit = TRUE;
+#if GLU_VERSION_1_1
GLubyte const * gl_error_msg = gluErrorString(error);
if (NULL != gl_error_msg)
{
@@ -1507,6 +1545,7 @@ void do_assert_glerror()
}
}
else
+#endif // GLU_VERSION_1_1
{
// gluErrorString returns NULL for some extensions' error codes.
// you'll probably have to grep for the number in glext.h.
@@ -1582,8 +1621,13 @@ void LLGLState::initClass()
// sStateMap[GL_TEXTURE_2D] = GL_TRUE;
//make sure multisample defaults to disabled
+#if GL_ARB_multisample
sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
glDisable(GL_MULTISAMPLE_ARB);
+#else
+ sStateMap[GL_MULTISAMPLE_EXT] = GL_FALSE;
+ glDisable(GL_MULTISAMPLE_EXT);
+#endif
}
//static
@@ -1598,15 +1642,17 @@ void LLGLState::restoreGL()
void LLGLState::resetTextureStates()
{
gGL.flush();
+#if GL_VERSION_1_3
GLint maxTextureUnits;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits);
for (S32 j = maxTextureUnits-1; j >=0; j--)
{
gGL.getTexUnit(j)->activate();
- glClientActiveTextureARB(GL_TEXTURE0_ARB+j);
+ glClientActiveTexture(GL_TEXTURE0_ARB+j);
j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable();
}
+#endif
}
void LLGLState::dumpStates()
@@ -1861,6 +1907,7 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) :
mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+#if GL_VERSION_1_1
switch (state)
{
case GL_ALPHA_TEST:
@@ -1877,6 +1924,7 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) :
mState = 0;
break;
}
+#endif // GL_VERSION_1_1
stop_glerror();
@@ -2336,8 +2384,11 @@ void LLGLSyncFence::wait()
}
LLGLSPipelineSkyBox::LLGLSPipelineSkyBox()
-: mAlphaTest(GL_ALPHA_TEST)
-, mCullFace(GL_CULL_FACE)
+:
+#if GL_VERSION_1_1
+mAlphaTest(GL_ALPHA_TEST),
+#endif
+mCullFace(GL_CULL_FACE)
, mSquashClip()
{
}