summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llgl.cpp17
-rw-r--r--indra/llrender/llvertexbuffer.cpp12
2 files changed, 26 insertions, 3 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index f546e07320..4d0dfbf75d 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -67,6 +67,12 @@ static const std::string HEADLESS_VERSION_STRING("1.0");
std::ofstream gFailLog;
+#if GL_ARB_debug_output
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
void APIENTRY gl_debug_callback(GLenum source,
GLenum type,
GLuint id,
@@ -82,6 +88,7 @@ void APIENTRY gl_debug_callback(GLenum source,
llwarns << "Message: " << message << llendl;
llwarns << "-----------------------" << llendl;
}
+#endif
void ll_init_fail_log(std::string filename)
{
@@ -127,7 +134,9 @@ std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
// ATI prototypes
+#if LL_WINDOWS
PFNGLGETSTRINGIPROC glGetStringi = NULL;
+#endif
// vertex blending prototypes
PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL;
@@ -484,6 +493,7 @@ bool LLGLManager::initGL()
LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL;
}
+#if LL_WINDOWS
if (!glGetStringi)
{
glGetStringi = (PFNGLGETSTRINGIPROC) GLH_EXT_GET_PROC_ADDRESS("glGetStringi");
@@ -501,7 +511,6 @@ bool LLGLManager::initGL()
str << (const char*) glGetStringi(GL_EXTENSIONS, i) << " ";
}
-#if LL_WINDOWS
{
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
@@ -510,12 +519,12 @@ bool LLGLManager::initGL()
str << (const char*) wglGetExtensionsStringARB(wglGetCurrentDC());
}
}
-#endif
+
free(gGLHExts.mSysExts);
std::string extensions = str.str();
gGLHExts.mSysExts = strdup(extensions.c_str());
-
}
+#endif
// Extract video card strings and convert to upper case to
// work around driver-to-driver variation in capitalization.
@@ -654,12 +663,14 @@ bool LLGLManager::initGL()
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
}
+#if LL_WINDOWS
if (mHasDebugOutput && gDebugGL)
{ //setup debug output callback
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
}
+#endif
//HACK always disable texture multisample, use FXAA instead
mHasTextureMultisample = FALSE;
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index b2a0f6822d..add3decee3 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -575,7 +575,9 @@ void LLVertexBuffer::unbind()
{
if (sGLRenderArray)
{
+#if GL_ARB_vertex_array_object
glBindVertexArray(0);
+#endif
sGLRenderArray = 0;
}
@@ -733,7 +735,9 @@ LLVertexBuffer::~LLVertexBuffer()
if (mGLArray)
{
+#if GL_ARB_vertex_array_object
glDeleteVertexArrays(1, &mGLArray);
+#endif
}
sCount--;
@@ -1049,7 +1053,9 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
if (gGLManager.mHasVertexArrayObject && useVBOs() && (LLRender::sGLCoreProfile || sUseVAO))
{
+#if GL_ARB_vertex_array_object
glGenVertexArrays(1, &mGLArray);
+#endif
setupVertexArray();
}
}
@@ -1128,7 +1134,9 @@ void LLVertexBuffer::setupVertexArray()
}
}
+#if GL_ARB_vertex_array_object
glBindVertexArray(0);
+#endif
}
void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
@@ -1864,7 +1872,9 @@ bool LLVertexBuffer::bindGLArray()
{
if (mGLArray && sGLRenderArray != mGLArray)
{
+#if GL_ARB_vertex_array_object
glBindVertexArray(mGLArray);
+#endif
sGLRenderArray = mGLArray;
return true;
}
@@ -2072,7 +2082,9 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
{
if (sGLRenderArray)
{
+#if GL_ARB_vertex_array_object
glBindVertexArray(0);
+#endif
sGLRenderArray = 0;
}