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.cpp51
1 files changed, 41 insertions, 10 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 7bc9124ac1..d97dc96cc3 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -56,6 +56,9 @@
#if LL_WINDOWS
#include "lldxhardware.h"
+#elif LL_LINUX || __FreeBSD__
+#define GLX_GLXEXT_PROTOTYPES 1
+#include <GL/glx.h>
#endif
#ifdef _DEBUG
@@ -77,7 +80,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
@@ -100,9 +103,9 @@ void APIENTRY gl_debug_callback(GLenum source,
}*/
if (gGLManager.mIsDisabled &&
- severity == GL_DEBUG_SEVERITY_HIGH_ARB &&
- source == GL_DEBUG_SOURCE_API_ARB &&
- type == GL_DEBUG_TYPE_ERROR_ARB &&
+ severity == GL_DEBUG_SEVERITY_HIGH &&
+ source == GL_DEBUG_SOURCE_API &&
+ type == GL_DEBUG_TYPE_ERROR &&
id == GL_INVALID_VALUE)
{
// Suppress messages about deleting already deleted objects called from LLViewerWindow::stopGL()
@@ -162,7 +165,11 @@ void APIENTRY gl_debug_callback(GLenum source,
if (ubo != 0)
{
glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_SIZE, &ubo_size);
+#if GL_EXT_buffer_storage
+ glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_IMMUTABLE_STORAGE_EXT, &ubo_immutable);
+#else
glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_IMMUTABLE_STORAGE, &ubo_immutable);
+#endif
}
// No needs to halt when is called from LLViewerWindow::stopGL()
@@ -235,6 +242,8 @@ PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC wglBlitContextFramebufferAMD = n
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr;
+/*
+
// GL_VERSION_1_2
//PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = nullptr;
//PFNGLTEXIMAGE3DPROC glTexImage3D = nullptr;
@@ -979,6 +988,7 @@ PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC glMultiDrawArraysIndirectCount = nullpt
PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC glMultiDrawElementsIndirectCount = nullptr;
PFNGLPOLYGONOFFSETCLAMPPROC glPolygonOffsetClamp = nullptr;
+*/
#endif
LLGLManager gGLManager;
@@ -1129,6 +1139,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);
@@ -1137,12 +1148,13 @@ 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.
// NOTE: AMD has been pretty good about not breaking this check, do not rename without good reason
if (mGLVendor.substr(0,4) == "ATI "
-#if LL_LINUX
+#if LL_LINUX || __FreeBSD__
|| mGLVendor.find("AMD") != std::string::npos
#endif //LL_LINUX
)
@@ -1157,7 +1169,7 @@ bool LLGLManager::initGL()
mIsNVIDIA = true;
}
else if (mGLVendor.find("INTEL") != std::string::npos
-#if LL_LINUX
+#if LL_LINUX || __FreeBSD__
// The Mesa-based drivers put this in the Renderer string,
// not the Vendor string.
|| mGLRenderer.find("INTEL") != std::string::npos
@@ -1213,7 +1225,7 @@ bool LLGLManager::initGL()
}
} else
#endif
-#if LL_WINDOWS || LL_LINUX
+#if LL_WINDOWS || LL_LINUX || __FreeBSD__
if (mHasNVXGpuMemoryInfo)
{
GLint mem_kb = 0;
@@ -1226,6 +1238,13 @@ bool LLGLManager::initGL()
}
}
#endif
+#if LL_LINUX || __FreeBSD__
+ if (!mVRAM)
+ {
+ auto queryInteger = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXQueryCurrentRendererIntegerMESA");
+ queryInteger(GLX_RENDERER_VIDEO_MEMORY_MESA, &mVRAM);
+ }
+#endif // LL_LINUX || __FreeBSD__
#if LL_WINDOWS
if (mVRAM < 256)
@@ -1253,10 +1272,12 @@ bool LLGLManager::initGL()
}
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &mNumTextureImageUnits);
+#if GL_VERSION_3_2
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples);
glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples);
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
+#endif
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &mMaxUniformBlockSize);
@@ -1266,7 +1287,7 @@ bool LLGLManager::initGL()
if (mGLVersion >= 4.59f)
{
- glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &mMaxAnisotropy);
+ glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &mMaxAnisotropy);
}
initGLStates();
@@ -1406,7 +1427,7 @@ void LLGLManager::shutdownGL()
void LLGLManager::initExtensions()
{
-#if LL_LINUX
+#if LL_LINUX || __FreeBSD__
glh_init_extensions("");
#endif
#if LL_DARWIN
@@ -1432,7 +1453,7 @@ void LLGLManager::initExtensions()
mHasTransformFeedback = mGLVersion >= 3.99f;
mHasDebugOutput = mGLVersion >= 4.29f;
-#if LL_WINDOWS || LL_LINUX
+#if LL_WINDOWS || LL_LINUX || __FreeBSD__
if( gGLHExts.mSysExts )
mHasNVXGpuMemoryInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
else
@@ -1446,6 +1467,7 @@ void LLGLManager::initExtensions()
mInited = true;
+/*
#if LL_WINDOWS
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
@@ -2283,6 +2305,7 @@ void LLGLManager::initExtensions()
glPolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC)GLH_EXT_GET_PROC_ADDRESS("glPolygonOffsetClamp");
#endif
+*/
}
void rotate_quat(LLQuaternion& rotation)
@@ -2309,12 +2332,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.
@@ -2333,6 +2358,7 @@ void do_assert_glerror()
if (LL_UNLIKELY(error))
{
quit = true;
+#if GLU_VERSION_1_1
GLubyte const * gl_error_msg = gluErrorString(error);
if (NULL != gl_error_msg)
{
@@ -2345,6 +2371,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.
@@ -2419,8 +2446,10 @@ void LLGLState::initClass()
// sStateMap[GL_TEXTURE_2D] = GL_TRUE;
//make sure multisample defaults to disabled
+#if GL_EXT_multisample || GL_EXT_multisampled_compatibility
sStateMap[GL_MULTISAMPLE] = GL_FALSE;
glDisable(GL_MULTISAMPLE);
+#endif
}
//static
@@ -2435,6 +2464,7 @@ void LLGLState::restoreGL()
void LLGLState::resetTextureStates()
{
gGL.flush();
+#if GL_VERSION_1_3
GLint maxTextureUnits;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits);
@@ -2444,6 +2474,7 @@ void LLGLState::resetTextureStates()
glClientActiveTexture(GL_TEXTURE0+j);
j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable();
}
+#endif
}
void LLGLState::dumpStates()