PageRenderTime 108ms CodeModel.GetById 13ms app.highlight 84ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llrender/llgl.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 1707 lines | 1419 code | 180 blank | 108 comment | 214 complexity | 531c3023649f7374b910ef05abc16973 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/** 
   2 * @file llgl.cpp
   3 * @brief LLGL implementation
   4 *
   5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
   6 * Second Life Viewer Source Code
   7 * Copyright (C) 2010, Linden Research, Inc.
   8 * 
   9 * This library is free software; you can redistribute it and/or
  10 * modify it under the terms of the GNU Lesser General Public
  11 * License as published by the Free Software Foundation;
  12 * version 2.1 of the License only.
  13 * 
  14 * This library is distributed in the hope that it will be useful,
  15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17 * Lesser General Public License for more details.
  18 * 
  19 * You should have received a copy of the GNU Lesser General Public
  20 * License along with this library; if not, write to the Free Software
  21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  22 * 
  23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  24 * $/LicenseInfo$
  25 */
  26
  27// This file sets some global GL parameters, and implements some 
  28// useful functions for GL operations.
  29
  30#define GLH_EXT_SINGLE_FILE
  31
  32#include "linden_common.h"
  33
  34#include "boost/tokenizer.hpp"
  35
  36#include "llsys.h"
  37
  38#include "llgl.h"
  39#include "llrender.h"
  40
  41#include "llerror.h"
  42#include "llerrorcontrol.h"
  43#include "llquaternion.h"
  44#include "llmath.h"
  45#include "m4math.h"
  46#include "llstring.h"
  47#include "llmemtype.h"
  48#include "llstacktrace.h"
  49
  50#include "llglheaders.h"
  51#include "llglslshader.h"
  52
  53#ifdef _DEBUG
  54//#define GL_STATE_VERIFY
  55#endif
  56
  57
  58BOOL gDebugSession = FALSE;
  59BOOL gDebugGL = FALSE;
  60BOOL gClothRipple = FALSE;
  61BOOL gHeadlessClient = FALSE;
  62BOOL gGLActive = FALSE;
  63
  64static const std::string HEADLESS_VENDOR_STRING("Linden Lab");
  65static const std::string HEADLESS_RENDERER_STRING("Headless");
  66static const std::string HEADLESS_VERSION_STRING("1.0");
  67
  68std::ofstream gFailLog;
  69
  70#if GL_ARB_debug_output
  71
  72#ifndef APIENTRY
  73#define APIENTRY
  74#endif
  75
  76void APIENTRY gl_debug_callback(GLenum source,
  77                                GLenum type,
  78                                GLuint id,
  79                                GLenum severity,
  80                                GLsizei length,
  81                                const GLchar* message,
  82                                GLvoid* userParam)
  83{
  84	if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
  85	{
  86		llwarns << "----- GL ERROR --------" << llendl;
  87	}
  88	else
  89	{
  90		llwarns << "----- GL WARNING -------" << llendl;
  91	}
  92	llwarns << "Type: " << std::hex << type << llendl;
  93	llwarns << "ID: " << std::hex << id << llendl;
  94	llwarns << "Severity: " << std::hex << severity << llendl;
  95	llwarns << "Message: " << message << llendl;
  96	llwarns << "-----------------------" << llendl;
  97}
  98#endif
  99
 100void ll_init_fail_log(std::string filename)
 101{
 102	gFailLog.open(filename.c_str());
 103}
 104
 105
 106void ll_fail(std::string msg)
 107{
 108	
 109	if (gDebugSession)
 110	{
 111		std::vector<std::string> lines;
 112
 113		gFailLog << LLError::utcTime() << " " << msg << std::endl;
 114
 115		gFailLog << "Stack Trace:" << std::endl;
 116
 117		ll_get_stack_trace(lines);
 118		
 119		for(size_t i = 0; i < lines.size(); ++i)
 120		{
 121			gFailLog << lines[i] << std::endl;
 122		}
 123
 124		gFailLog << "End of Stack Trace." << std::endl << std::endl;
 125
 126		gFailLog.flush();
 127	}
 128};
 129
 130void ll_close_fail_log()
 131{
 132	gFailLog.close();
 133}
 134
 135LLMatrix4 gGLObliqueProjectionInverse;
 136
 137#define LL_GL_NAME_POOLING 0
 138
 139std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
 140
 141#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS)  && !LL_MESA_HEADLESS
 142// ATI prototypes
 143
 144#if LL_WINDOWS
 145PFNGLGETSTRINGIPROC glGetStringi = NULL;
 146#endif
 147
 148// vertex blending prototypes
 149PFNGLWEIGHTPOINTERARBPROC			glWeightPointerARB = NULL;
 150PFNGLVERTEXBLENDARBPROC				glVertexBlendARB = NULL;
 151PFNGLWEIGHTFVARBPROC				glWeightfvARB = NULL;
 152
 153// Vertex buffer object prototypes
 154PFNGLBINDBUFFERARBPROC				glBindBufferARB = NULL;
 155PFNGLDELETEBUFFERSARBPROC			glDeleteBuffersARB = NULL;
 156PFNGLGENBUFFERSARBPROC				glGenBuffersARB = NULL;
 157PFNGLISBUFFERARBPROC				glIsBufferARB = NULL;
 158PFNGLBUFFERDATAARBPROC				glBufferDataARB = NULL;
 159PFNGLBUFFERSUBDATAARBPROC			glBufferSubDataARB = NULL;
 160PFNGLGETBUFFERSUBDATAARBPROC		glGetBufferSubDataARB = NULL;
 161PFNGLMAPBUFFERARBPROC				glMapBufferARB = NULL;
 162PFNGLUNMAPBUFFERARBPROC				glUnmapBufferARB = NULL;
 163PFNGLGETBUFFERPARAMETERIVARBPROC	glGetBufferParameterivARB = NULL;
 164PFNGLGETBUFFERPOINTERVARBPROC		glGetBufferPointervARB = NULL;
 165
 166//GL_ARB_vertex_array_object
 167PFNGLBINDVERTEXARRAYPROC glBindVertexArray = NULL;
 168PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays = NULL;
 169PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = NULL;
 170PFNGLISVERTEXARRAYPROC glIsVertexArray = NULL;
 171
 172// GL_ARB_map_buffer_range
 173PFNGLMAPBUFFERRANGEPROC			glMapBufferRange = NULL;
 174PFNGLFLUSHMAPPEDBUFFERRANGEPROC	glFlushMappedBufferRange = NULL;
 175
 176// GL_ARB_sync
 177PFNGLFENCESYNCPROC				glFenceSync = NULL;
 178PFNGLISSYNCPROC					glIsSync = NULL;
 179PFNGLDELETESYNCPROC				glDeleteSync = NULL;
 180PFNGLCLIENTWAITSYNCPROC			glClientWaitSync = NULL;
 181PFNGLWAITSYNCPROC				glWaitSync = NULL;
 182PFNGLGETINTEGER64VPROC			glGetInteger64v = NULL;
 183PFNGLGETSYNCIVPROC				glGetSynciv = NULL;
 184
 185// GL_APPLE_flush_buffer_range
 186PFNGLBUFFERPARAMETERIAPPLEPROC	glBufferParameteriAPPLE = NULL;
 187PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC glFlushMappedBufferRangeAPPLE = NULL;
 188
 189// vertex object prototypes
 190PFNGLNEWOBJECTBUFFERATIPROC			glNewObjectBufferATI = NULL;
 191PFNGLISOBJECTBUFFERATIPROC			glIsObjectBufferATI = NULL;
 192PFNGLUPDATEOBJECTBUFFERATIPROC		glUpdateObjectBufferATI = NULL;
 193PFNGLGETOBJECTBUFFERFVATIPROC		glGetObjectBufferfvATI = NULL;
 194PFNGLGETOBJECTBUFFERIVATIPROC		glGetObjectBufferivATI = NULL;
 195PFNGLFREEOBJECTBUFFERATIPROC		glFreeObjectBufferATI = NULL;
 196PFNGLARRAYOBJECTATIPROC				glArrayObjectATI = NULL;
 197PFNGLVERTEXATTRIBARRAYOBJECTATIPROC	glVertexAttribArrayObjectATI = NULL;
 198PFNGLGETARRAYOBJECTFVATIPROC		glGetArrayObjectfvATI = NULL;
 199PFNGLGETARRAYOBJECTIVATIPROC		glGetArrayObjectivATI = NULL;
 200PFNGLVARIANTARRAYOBJECTATIPROC		glVariantObjectArrayATI = NULL;
 201PFNGLGETVARIANTARRAYOBJECTFVATIPROC	glGetVariantArrayObjectfvATI = NULL;
 202PFNGLGETVARIANTARRAYOBJECTIVATIPROC	glGetVariantArrayObjectivATI = NULL;
 203
 204// GL_ARB_occlusion_query
 205PFNGLGENQUERIESARBPROC glGenQueriesARB = NULL;
 206PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB = NULL;
 207PFNGLISQUERYARBPROC glIsQueryARB = NULL;
 208PFNGLBEGINQUERYARBPROC glBeginQueryARB = NULL;
 209PFNGLENDQUERYARBPROC glEndQueryARB = NULL;
 210PFNGLGETQUERYIVARBPROC glGetQueryivARB = NULL;
 211PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB = NULL;
 212PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL;
 213
 214// GL_ARB_point_parameters
 215PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL;
 216PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL;
 217
 218// GL_ARB_framebuffer_object
 219PFNGLISRENDERBUFFERPROC glIsRenderbuffer = NULL;
 220PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer = NULL;
 221PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers = NULL;
 222PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers = NULL;
 223PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage = NULL;
 224PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv = NULL;
 225PFNGLISFRAMEBUFFERPROC glIsFramebuffer = NULL;
 226PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer = NULL;
 227PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers = NULL;
 228PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers = NULL;
 229PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus = NULL;
 230PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D = NULL;
 231PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D = NULL;
 232PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D = NULL;
 233PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer = NULL;
 234PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv = NULL;
 235PFNGLGENERATEMIPMAPPROC glGenerateMipmap = NULL;
 236PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer = NULL;
 237PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample = NULL;
 238PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer = NULL;
 239
 240//GL_ARB_texture_multisample
 241PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample = NULL;
 242PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample = NULL;
 243PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv = NULL;
 244PFNGLSAMPLEMASKIPROC glSampleMaski = NULL;
 245
 246//GL_ARB_debug_output
 247PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB = NULL;
 248PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB = NULL;
 249PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB = NULL;
 250PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB = NULL;
 251
 252// GL_EXT_blend_func_separate
 253PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
 254
 255// GL_ARB_draw_buffers
 256PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB = NULL;
 257
 258//shader object prototypes
 259PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
 260PFNGLGETHANDLEARBPROC glGetHandleARB = NULL;
 261PFNGLDETACHOBJECTARBPROC glDetachObjectARB = NULL;
 262PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
 263PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
 264PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
 265PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
 266PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
 267PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
 268PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
 269PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB = NULL;
 270PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL;
 271PFNGLUNIFORM2FARBPROC glUniform2fARB = NULL;
 272PFNGLUNIFORM3FARBPROC glUniform3fARB = NULL;
 273PFNGLUNIFORM4FARBPROC glUniform4fARB = NULL;
 274PFNGLUNIFORM1IARBPROC glUniform1iARB = NULL;
 275PFNGLUNIFORM2IARBPROC glUniform2iARB = NULL;
 276PFNGLUNIFORM3IARBPROC glUniform3iARB = NULL;
 277PFNGLUNIFORM4IARBPROC glUniform4iARB = NULL;
 278PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL;
 279PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL;
 280PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL;
 281PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;
 282PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL;
 283PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL;
 284PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL;
 285PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL;
 286PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB = NULL;
 287PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB = NULL;
 288PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB = NULL;
 289PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB = NULL;
 290PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL;
 291PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL;
 292PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB = NULL;
 293PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
 294PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL;
 295PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL;
 296PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;
 297PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL;
 298
 299#if LL_WINDOWS
 300PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
 301#endif
 302
 303// vertex shader prototypes
 304#if LL_LINUX || LL_SOLARIS
 305PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
 306PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL;
 307PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL;
 308PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB = NULL;
 309PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB = NULL;
 310PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB = NULL;
 311PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB = NULL;
 312PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB = NULL;
 313PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB = NULL;
 314PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB = NULL;
 315PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB = NULL;
 316PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB = NULL;
 317PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB = NULL;
 318PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB = NULL;
 319PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL;
 320PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL;
 321PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL;
 322PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL;
 323#endif // LL_LINUX || LL_SOLARIS
 324PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL;
 325PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL;
 326PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL;
 327PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL;
 328PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL;
 329PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL;
 330PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL;
 331#if LL_LINUX  || LL_SOLARIS
 332PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL;
 333PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL;
 334PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL;
 335PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB = NULL;
 336PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB = NULL;
 337PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB = NULL;
 338PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB = NULL;
 339PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB = NULL;
 340PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB = NULL;
 341PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB = NULL;
 342PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB = NULL;
 343PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB = NULL;
 344PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB = NULL;
 345PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB = NULL;
 346PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL;
 347PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL;
 348PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = NULL;
 349PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL;
 350PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB = NULL;
 351PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB = NULL;
 352PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL;
 353PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB = NULL;
 354PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB = NULL;
 355PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB = NULL;
 356PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB = NULL;
 357PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB = NULL;
 358PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB = NULL;
 359PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB = NULL;
 360PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB = NULL;
 361PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB = NULL;
 362PFNGLGETPROGRAMIVARBPROC glGetProgramivARB = NULL;
 363PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB = NULL;
 364PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB = NULL;
 365PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL;
 366PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL;
 367PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL;
 368PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
 369#endif // LL_LINUX || LL_SOLARIS
 370PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL;
 371PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL;
 372PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL;
 373
 374#if LL_WINDOWS
 375PFNWGLSWAPINTERVALEXTPROC			wglSwapIntervalEXT = NULL;
 376#endif
 377
 378#if LL_LINUX_NV_GL_HEADERS
 379// linux nvidia headers.  these define these differently to mesa's.  ugh.
 380PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL;
 381PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL;
 382PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = NULL;
 383#endif // LL_LINUX_NV_GL_HEADERS
 384#endif
 385
 386LLGLManager gGLManager;
 387
 388LLGLManager::LLGLManager() :
 389	mInited(FALSE),
 390	mIsDisabled(FALSE),
 391
 392	mHasMultitexture(FALSE),
 393	mHasATIMemInfo(FALSE),
 394	mHasNVXMemInfo(FALSE),
 395	mNumTextureUnits(1),
 396	mHasMipMapGeneration(FALSE),
 397	mHasCompressedTextures(FALSE),
 398	mHasFramebufferObject(FALSE),
 399	mMaxSamples(0),
 400	mHasBlendFuncSeparate(FALSE),
 401	mHasSync(FALSE),
 402	mHasVertexBufferObject(FALSE),
 403	mHasVertexArrayObject(FALSE),
 404	mHasMapBufferRange(FALSE),
 405	mHasFlushBufferRange(FALSE),
 406	mHasPBuffer(FALSE),
 407	mHasShaderObjects(FALSE),
 408	mHasVertexShader(FALSE),
 409	mHasFragmentShader(FALSE),
 410	mNumTextureImageUnits(0),
 411	mHasOcclusionQuery(FALSE),
 412	mHasOcclusionQuery2(FALSE),
 413	mHasPointParameters(FALSE),
 414	mHasDrawBuffers(FALSE),
 415	mHasTextureRectangle(FALSE),
 416	mHasTextureMultisample(FALSE),
 417	mMaxSampleMaskWords(0),
 418	mMaxColorTextureSamples(0),
 419	mMaxDepthTextureSamples(0),
 420	mMaxIntegerSamples(0),
 421
 422	mHasAnisotropic(FALSE),
 423	mHasARBEnvCombine(FALSE),
 424	mHasCubeMap(FALSE),
 425	mHasDebugOutput(FALSE),
 426
 427	mIsATI(FALSE),
 428	mIsNVIDIA(FALSE),
 429	mIsIntel(FALSE),
 430	mIsGF2or4MX(FALSE),
 431	mIsGF3(FALSE),
 432	mIsGFFX(FALSE),
 433	mATIOffsetVerticalLines(FALSE),
 434	mATIOldDriver(FALSE),
 435
 436	mHasRequirements(TRUE),
 437
 438	mHasSeparateSpecularColor(FALSE),
 439
 440	mDebugGPU(FALSE),
 441
 442	mDriverVersionMajor(1),
 443	mDriverVersionMinor(0),
 444	mDriverVersionRelease(0),
 445	mGLVersion(1.0f),
 446		
 447	mVRAM(0),
 448	mGLMaxVertexRange(0),
 449	mGLMaxIndexRange(0)
 450{
 451}
 452
 453//---------------------------------------------------------------------
 454// Global initialization for GL
 455//---------------------------------------------------------------------
 456void LLGLManager::initWGL()
 457{
 458	mHasPBuffer = FALSE;
 459#if LL_WINDOWS && !LL_MESA_HEADLESS
 460	if (!glh_init_extensions("WGL_ARB_pixel_format"))
 461	{
 462		LL_WARNS("RenderInit") << "No ARB pixel format extensions" << LL_ENDL;
 463	}
 464
 465	if (ExtensionExists("WGL_ARB_create_context",gGLHExts.mSysExts))
 466	{
 467		GLH_EXT_NAME(wglCreateContextAttribsARB) = (PFNWGLCREATECONTEXTATTRIBSARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreateContextAttribsARB");
 468	}
 469	else
 470	{
 471		LL_WARNS("RenderInit") << "No ARB create context extensions" << LL_ENDL;
 472	}
 473	
 474	if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts))
 475	{
 476        GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT");
 477	}
 478
 479	if( !glh_init_extensions("WGL_ARB_pbuffer") )
 480	{
 481		LL_WARNS("RenderInit") << "No ARB WGL PBuffer extensions" << LL_ENDL;
 482	}
 483
 484	if( !glh_init_extensions("WGL_ARB_render_texture") )
 485	{
 486		LL_WARNS("RenderInit") << "No ARB WGL render texture extensions" << LL_ENDL;
 487	}
 488
 489	mHasPBuffer = ExtensionExists("WGL_ARB_pbuffer", gGLHExts.mSysExts) &&
 490					ExtensionExists("WGL_ARB_render_texture", gGLHExts.mSysExts) &&
 491					ExtensionExists("WGL_ARB_pixel_format", gGLHExts.mSysExts);
 492#endif
 493}
 494
 495// return false if unable (or unwilling due to old drivers) to init GL
 496bool LLGLManager::initGL()
 497{
 498	if (mInited)
 499	{
 500		LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL;
 501	}
 502
 503	stop_glerror();
 504
 505#if LL_WINDOWS
 506	if (!glGetStringi)
 507	{
 508		glGetStringi = (PFNGLGETSTRINGIPROC) GLH_EXT_GET_PROC_ADDRESS("glGetStringi");
 509	}
 510
 511	//reload extensions string (may have changed after using wglCreateContextAttrib)
 512	if (glGetStringi)
 513	{
 514		std::stringstream str;
 515
 516		GLint count = 0;
 517		glGetIntegerv(GL_NUM_EXTENSIONS, &count);
 518		for (GLint i = 0; i < count; ++i)
 519		{
 520			std::string ext((const char*) glGetStringi(GL_EXTENSIONS, i));
 521			str << ext << " ";
 522			LL_DEBUGS("GLExtensions") << ext << llendl;
 523		}
 524		
 525		{
 526			PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
 527			wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
 528			if(wglGetExtensionsStringARB)
 529			{
 530				str << (const char*) wglGetExtensionsStringARB(wglGetCurrentDC());
 531			}
 532		}
 533
 534		free(gGLHExts.mSysExts);
 535		std::string extensions = str.str();
 536		gGLHExts.mSysExts = strdup(extensions.c_str());
 537	}
 538#endif
 539	
 540	stop_glerror();
 541
 542	// Extract video card strings and convert to upper case to
 543	// work around driver-to-driver variation in capitalization.
 544	mGLVendor = std::string((const char *)glGetString(GL_VENDOR));
 545	LLStringUtil::toUpper(mGLVendor);
 546
 547	mGLRenderer = std::string((const char *)glGetString(GL_RENDERER));
 548	LLStringUtil::toUpper(mGLRenderer);
 549
 550	parse_gl_version( &mDriverVersionMajor, 
 551		&mDriverVersionMinor, 
 552		&mDriverVersionRelease, 
 553		&mDriverVersionVendorString );
 554
 555	mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f;
 556
 557	// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
 558	// from being recognized as ATI.
 559	if (mGLVendor.substr(0,4) == "ATI ")
 560	{
 561		mGLVendorShort = "ATI";
 562		BOOL mobile = FALSE;
 563		if (mGLRenderer.find("MOBILITY") != std::string::npos)
 564		{
 565			mobile = TRUE;
 566		}
 567		mIsATI = TRUE;
 568
 569#if LL_WINDOWS && !LL_MESA_HEADLESS
 570		if (mDriverVersionRelease < 3842)
 571		{
 572			mATIOffsetVerticalLines = TRUE;
 573		}
 574#endif // LL_WINDOWS
 575
 576#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
 577		// release 7277 is a point at which we verify that ATI OpenGL
 578		// drivers get pretty stable with SL, ~Catalyst 8.2,
 579		// for both Win32 and Linux.
 580		if (mDriverVersionRelease < 7277 &&
 581		    mDriverVersionRelease != 0) // 0 == Undetectable driver version - these get to pretend to be new ATI drivers, though that decision may be revisited.
 582		{
 583			mATIOldDriver = TRUE;
 584		}
 585#endif // (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
 586	}
 587	else if (mGLVendor.find("NVIDIA ") != std::string::npos)
 588	{
 589		mGLVendorShort = "NVIDIA";
 590		mIsNVIDIA = TRUE;
 591		if (   mGLRenderer.find("GEFORCE4 MX") != std::string::npos
 592			|| mGLRenderer.find("GEFORCE2") != std::string::npos
 593			|| mGLRenderer.find("GEFORCE 2") != std::string::npos
 594			|| mGLRenderer.find("GEFORCE4 460 GO") != std::string::npos
 595			|| mGLRenderer.find("GEFORCE4 440 GO") != std::string::npos
 596			|| mGLRenderer.find("GEFORCE4 420 GO") != std::string::npos)
 597		{
 598			mIsGF2or4MX = TRUE;
 599		}
 600		else if (mGLRenderer.find("GEFORCE FX") != std::string::npos
 601				 || mGLRenderer.find("QUADRO FX") != std::string::npos
 602				 || mGLRenderer.find("NV34") != std::string::npos)
 603		{
 604			mIsGFFX = TRUE;
 605		}
 606		else if(mGLRenderer.find("GEFORCE3") != std::string::npos)
 607		{
 608			mIsGF3 = TRUE;
 609		}
 610
 611	}
 612	else if (mGLVendor.find("INTEL") != std::string::npos
 613#if LL_LINUX
 614		 // The Mesa-based drivers put this in the Renderer string,
 615		 // not the Vendor string.
 616		 || mGLRenderer.find("INTEL") != std::string::npos
 617#endif //LL_LINUX
 618		 )
 619	{
 620		mGLVendorShort = "INTEL";
 621		mIsIntel = TRUE;
 622	}
 623	else
 624	{
 625		mGLVendorShort = "MISC";
 626	}
 627	
 628	stop_glerror();
 629	// This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
 630	initExtensions();
 631	stop_glerror();
 632
 633	S32 old_vram = mVRAM;
 634
 635	if (mHasATIMemInfo)
 636	{ //ask the gl how much vram is free at startup and attempt to use no more than half of that
 637		S32 meminfo[4];
 638		glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo);
 639
 640		mVRAM = meminfo[0]/1024;
 641	}
 642	else if (mHasNVXMemInfo)
 643	{
 644		S32 dedicated_memory;
 645		glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &dedicated_memory);
 646		mVRAM = dedicated_memory/1024;
 647	}
 648
 649	if (mVRAM < 256)
 650	{ //something likely went wrong using the above extensions, fall back to old method
 651		mVRAM = old_vram;
 652	}
 653
 654	stop_glerror();
 655
 656	stop_glerror();
 657
 658	if (mHasFragmentShader)
 659	{
 660		GLint num_tex_image_units;
 661		glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
 662		mNumTextureImageUnits = llmin(num_tex_image_units, 32);
 663	}
 664
 665	if (LLRender::sGLCoreProfile)
 666	{
 667		mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS);
 668	}
 669	else if (mHasMultitexture)
 670	{
 671		GLint num_tex_units;		
 672		glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units);
 673		mNumTextureUnits = llmin(num_tex_units, (GLint)MAX_GL_TEXTURE_UNITS);
 674		if (mIsIntel)
 675		{
 676			mNumTextureUnits = llmin(mNumTextureUnits, 2);
 677		}
 678	}
 679	else
 680	{
 681		mHasRequirements = FALSE;
 682
 683		// We don't support cards that don't support the GL_ARB_multitexture extension
 684		LL_WARNS("RenderInit") << "GL Drivers do not support GL_ARB_multitexture" << LL_ENDL;
 685		return false;
 686	}
 687	
 688	stop_glerror();
 689
 690	if (mHasTextureMultisample)
 691	{
 692		glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples);
 693		glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples);
 694		glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
 695		glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
 696	}
 697
 698	stop_glerror();
 699
 700#if LL_WINDOWS
 701	if (mHasDebugOutput && gDebugGL)
 702	{ //setup debug output callback
 703		//glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
 704		glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
 705		glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
 706	}
 707#endif
 708
 709	stop_glerror();
 710
 711	//HACK always disable texture multisample, use FXAA instead
 712	mHasTextureMultisample = FALSE;
 713#if LL_WINDOWS
 714	if (mIsATI)
 715	{ //using multisample textures on ATI results in black screen for some reason
 716		mHasTextureMultisample = FALSE;
 717	}
 718#endif
 719
 720	if (mHasFramebufferObject)
 721	{
 722		glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
 723	}
 724
 725	stop_glerror();
 726	
 727	setToDebugGPU();
 728
 729	stop_glerror();
 730
 731	initGLStates();
 732
 733	stop_glerror();
 734
 735	return true;
 736}
 737
 738void LLGLManager::setToDebugGPU()
 739{
 740	//"MOBILE INTEL(R) 965 EXPRESS CHIP", 
 741	if (mGLRenderer.find("INTEL") != std::string::npos && mGLRenderer.find("965") != std::string::npos)
 742	{
 743		mDebugGPU = TRUE ;
 744	}
 745
 746	return ;
 747}
 748
 749void LLGLManager::getGLInfo(LLSD& info)
 750{
 751	if (gHeadlessClient)
 752	{
 753		info["GLInfo"]["GLVendor"] = HEADLESS_VENDOR_STRING;
 754		info["GLInfo"]["GLRenderer"] = HEADLESS_RENDERER_STRING;
 755		info["GLInfo"]["GLVersion"] = HEADLESS_VERSION_STRING;
 756		return;
 757	}
 758	else
 759	{
 760		info["GLInfo"]["GLVendor"] = std::string((const char *)glGetString(GL_VENDOR));
 761		info["GLInfo"]["GLRenderer"] = std::string((const char *)glGetString(GL_RENDERER));
 762		info["GLInfo"]["GLVersion"] = std::string((const char *)glGetString(GL_VERSION));
 763	}
 764
 765#if !LL_MESA_HEADLESS
 766	std::string all_exts = ll_safe_string((const char *)gGLHExts.mSysExts);
 767	boost::char_separator<char> sep(" ");
 768	boost::tokenizer<boost::char_separator<char> > tok(all_exts, sep);
 769	for(boost::tokenizer<boost::char_separator<char> >::iterator i = tok.begin(); i != tok.end(); ++i)
 770	{
 771		info["GLInfo"]["GLExtensions"].append(*i);
 772	}
 773#endif
 774}
 775
 776std::string LLGLManager::getGLInfoString()
 777{
 778	std::string info_str;
 779
 780	if (gHeadlessClient)
 781	{
 782		info_str += std::string("GL_VENDOR      ") + HEADLESS_VENDOR_STRING + std::string("\n");
 783		info_str += std::string("GL_RENDERER    ") + HEADLESS_RENDERER_STRING + std::string("\n");
 784		info_str += std::string("GL_VERSION     ") + HEADLESS_VERSION_STRING + std::string("\n");
 785	}
 786	else
 787	{
 788		info_str += std::string("GL_VENDOR      ") + ll_safe_string((const char *)glGetString(GL_VENDOR)) + std::string("\n");
 789		info_str += std::string("GL_RENDERER    ") + ll_safe_string((const char *)glGetString(GL_RENDERER)) + std::string("\n");
 790		info_str += std::string("GL_VERSION     ") + ll_safe_string((const char *)glGetString(GL_VERSION)) + std::string("\n");
 791	}
 792
 793#if !LL_MESA_HEADLESS 
 794	std::string all_exts= ll_safe_string(((const char *)gGLHExts.mSysExts));
 795	LLStringUtil::replaceChar(all_exts, ' ', '\n');
 796	info_str += std::string("GL_EXTENSIONS:\n") + all_exts + std::string("\n");
 797#endif
 798	
 799	return info_str;
 800}
 801
 802void LLGLManager::printGLInfoString()
 803{
 804	if (gHeadlessClient)
 805	{
 806		LL_INFOS("RenderInit") << "GL_VENDOR:     " << HEADLESS_VENDOR_STRING << LL_ENDL;
 807		LL_INFOS("RenderInit") << "GL_RENDERER:   " << HEADLESS_RENDERER_STRING << LL_ENDL;
 808		LL_INFOS("RenderInit") << "GL_VERSION:    " << HEADLESS_VERSION_STRING << LL_ENDL;
 809	}
 810	else
 811	{
 812		LL_INFOS("RenderInit") << "GL_VENDOR:     " << ((const char *)glGetString(GL_VENDOR)) << LL_ENDL;
 813		LL_INFOS("RenderInit") << "GL_RENDERER:   " << ((const char *)glGetString(GL_RENDERER)) << LL_ENDL;
 814		LL_INFOS("RenderInit") << "GL_VERSION:    " << ((const char *)glGetString(GL_VERSION)) << LL_ENDL;
 815	}
 816
 817#if !LL_MESA_HEADLESS
 818	std::string all_exts= ll_safe_string(((const char *)gGLHExts.mSysExts));
 819	LLStringUtil::replaceChar(all_exts, ' ', '\n');
 820	LL_DEBUGS("RenderInit") << "GL_EXTENSIONS:\n" << all_exts << LL_ENDL;
 821#endif
 822}
 823
 824std::string LLGLManager::getRawGLString()
 825{
 826	std::string gl_string;
 827	if (gHeadlessClient)
 828	{
 829		gl_string = HEADLESS_VENDOR_STRING + " " + HEADLESS_RENDERER_STRING;
 830	}
 831	else
 832	{
 833		gl_string = ll_safe_string((char*)glGetString(GL_VENDOR)) + " " + ll_safe_string((char*)glGetString(GL_RENDERER));
 834	}
 835	return gl_string;
 836}
 837
 838void LLGLManager::shutdownGL()
 839{
 840	if (mInited)
 841	{
 842		glFinish();
 843		stop_glerror();
 844		mInited = FALSE;
 845	}
 846}
 847
 848// these are used to turn software blending on. They appear in the Debug/Avatar menu
 849// presence of vertex skinning/blending or vertex programs will set these to FALSE by default.
 850
 851void LLGLManager::initExtensions()
 852{
 853#if LL_MESA_HEADLESS
 854# ifdef GL_ARB_multitexture
 855	mHasMultitexture = TRUE;
 856# else
 857	mHasMultitexture = FALSE;
 858# endif // GL_ARB_multitexture
 859# ifdef GL_ARB_texture_env_combine
 860	mHasARBEnvCombine = TRUE;	
 861# else
 862	mHasARBEnvCombine = FALSE;
 863# endif // GL_ARB_texture_env_combine
 864# ifdef GL_ARB_texture_compression
 865	mHasCompressedTextures = TRUE;
 866# else
 867	mHasCompressedTextures = FALSE;
 868# endif // GL_ARB_texture_compression
 869# ifdef GL_ARB_vertex_buffer_object
 870	mHasVertexBufferObject = TRUE;
 871# else
 872	mHasVertexBufferObject = FALSE;
 873# endif // GL_ARB_vertex_buffer_object
 874# ifdef GL_EXT_framebuffer_object
 875	mHasFramebufferObject = TRUE;
 876# else
 877	mHasFramebufferObject = FALSE;
 878# endif // GL_EXT_framebuffer_object
 879# ifdef GL_ARB_draw_buffers
 880	mHasDrawBuffers = TRUE;
 881#else
 882	mHasDrawBuffers = FALSE;
 883# endif // GL_ARB_draw_buffers
 884# if defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
 885	mHasDepthClamp = TRUE;
 886#else
 887	mHasDepthClamp = FALSE;
 888#endif // defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
 889# if GL_EXT_blend_func_separate
 890	mHasBlendFuncSeparate = TRUE;
 891#else
 892	mHasBlendFuncSeparate = FALSE;
 893# endif // GL_EXT_blend_func_separate
 894	mHasMipMapGeneration = FALSE;
 895	mHasSeparateSpecularColor = FALSE;
 896	mHasAnisotropic = FALSE;
 897	mHasCubeMap = FALSE;
 898	mHasOcclusionQuery = FALSE;
 899	mHasPointParameters = FALSE;
 900	mHasShaderObjects = FALSE;
 901	mHasVertexShader = FALSE;
 902	mHasFragmentShader = FALSE;
 903	mHasTextureRectangle = FALSE;
 904#else // LL_MESA_HEADLESS //important, gGLHExts.mSysExts is uninitialized until after glh_init_extensions is called
 905	mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
 906	mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts);
 907	mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
 908	mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap");
 909	mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color");
 910	mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic");
 911	glh_init_extensions("GL_ARB_texture_cube_map");
 912	mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts);
 913	mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts);
 914	mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression");
 915	mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
 916	mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts);
 917	mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
 918	mHasVertexArrayObject = ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts);
 919	mHasSync = ExtensionExists("GL_ARB_sync", gGLHExts.mSysExts);
 920	mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts);
 921	mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts);
 922	mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts);
 923	// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
 924#ifdef GL_ARB_framebuffer_object
 925	mHasFramebufferObject = ExtensionExists("GL_ARB_framebuffer_object", gGLHExts.mSysExts);
 926#else
 927	mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts) &&
 928							ExtensionExists("GL_EXT_framebuffer_blit", gGLHExts.mSysExts) &&
 929							ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts) &&
 930							ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
 931#endif
 932	
 933	mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
 934	mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
 935	mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
 936	mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
 937	mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
 938#if !LL_DARWIN
 939	mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
 940#endif
 941	mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
 942	mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts)
 943		&& (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
 944	mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
 945#endif
 946
 947#if LL_LINUX || LL_SOLARIS
 948	llinfos << "initExtensions() checking shell variables to adjust features..." << llendl;
 949	// Our extension support for the Linux Client is very young with some
 950	// potential driver gotchas, so offer a semi-secret way to turn it off.
 951	if (getenv("LL_GL_NOEXT"))
 952	{
 953		//mHasMultitexture = FALSE; // NEEDED!
 954		mHasDepthClamp = FALSE;
 955		mHasARBEnvCombine = FALSE;
 956		mHasCompressedTextures = FALSE;
 957		mHasVertexBufferObject = FALSE;
 958		mHasFramebufferObject = FALSE;
 959		mHasDrawBuffers = FALSE;
 960		mHasBlendFuncSeparate = FALSE;
 961		mHasMipMapGeneration = FALSE;
 962		mHasSeparateSpecularColor = FALSE;
 963		mHasAnisotropic = FALSE;
 964		mHasCubeMap = FALSE;
 965		mHasOcclusionQuery = FALSE;
 966		mHasPointParameters = FALSE;
 967		mHasShaderObjects = FALSE;
 968		mHasVertexShader = FALSE;
 969		mHasFragmentShader = FALSE;
 970		LL_WARNS("RenderInit") << "GL extension support DISABLED via LL_GL_NOEXT" << LL_ENDL;
 971	}
 972	else if (getenv("LL_GL_BASICEXT"))	/* Flawfinder: ignore */
 973	{
 974		// This switch attempts to turn off all support for exotic
 975		// extensions which I believe correspond to fatal driver
 976		// bug reports.  This should be the default until we get a
 977		// proper blacklist/whitelist on Linux.
 978		mHasMipMapGeneration = FALSE;
 979		mHasAnisotropic = FALSE;
 980		//mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar
 981		//mHasOcclusionQuery = FALSE; // source of many ATI system hangs
 982		mHasShaderObjects = FALSE;
 983		mHasVertexShader = FALSE;
 984		mHasFragmentShader = FALSE;
 985		mHasBlendFuncSeparate = FALSE;
 986		LL_WARNS("RenderInit") << "GL extension support forced to SIMPLE level via LL_GL_BASICEXT" << LL_ENDL;
 987	}
 988	if (getenv("LL_GL_BLACKLIST"))	/* Flawfinder: ignore */
 989	{
 990		// This lets advanced troubleshooters disable specific
 991		// GL extensions to isolate problems with their hardware.
 992		// SL-28126
 993		const char *const blacklist = getenv("LL_GL_BLACKLIST");	/* Flawfinder: ignore */
 994		LL_WARNS("RenderInit") << "GL extension support partially disabled via LL_GL_BLACKLIST: " << blacklist << LL_ENDL;
 995		if (strchr(blacklist,'a')) mHasARBEnvCombine = FALSE;
 996		if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE;
 997		if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE;
 998		if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S
 999// 		if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S
1000// 		if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S
1001		if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE;
1002		if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S
1003		if (strchr(blacklist,'j')) mHasCubeMap = FALSE;//S
1004// 		if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S
1005		if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE;
1006		if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S
1007		if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S
1008		if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S
1009		if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S
1010		if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S
1011		if (strchr(blacklist,'r')) mHasDrawBuffers = FALSE;//S
1012		if (strchr(blacklist,'s')) mHasTextureRectangle = FALSE;
1013		if (strchr(blacklist,'t')) mHasBlendFuncSeparate = FALSE;//S
1014		if (strchr(blacklist,'u')) mHasDepthClamp = FALSE;
1015		
1016	}
1017#endif // LL_LINUX || LL_SOLARIS
1018	
1019	if (!mHasMultitexture)
1020	{
1021		LL_INFOS("RenderInit") << "Couldn't initialize multitexturing" << LL_ENDL;
1022	}
1023	if (!mHasMipMapGeneration)
1024	{
1025		LL_INFOS("RenderInit") << "Couldn't initialize mipmap generation" << LL_ENDL;
1026	}
1027	if (!mHasARBEnvCombine)
1028	{
1029		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_env_combine" << LL_ENDL;
1030	}
1031	if (!mHasSeparateSpecularColor)
1032	{
1033		LL_INFOS("RenderInit") << "Couldn't initialize separate specular color" << LL_ENDL;
1034	}
1035	if (!mHasAnisotropic)
1036	{
1037		LL_INFOS("RenderInit") << "Couldn't initialize anisotropic filtering" << LL_ENDL;
1038	}
1039	if (!mHasCompressedTextures)
1040	{
1041		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_compression" << LL_ENDL;
1042	}
1043	if (!mHasOcclusionQuery)
1044	{
1045		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_occlusion_query" << LL_ENDL;
1046	}
1047	if (!mHasOcclusionQuery2)
1048	{
1049		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_occlusion_query2" << LL_ENDL;
1050	}
1051	if (!mHasPointParameters)
1052	{
1053		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_point_parameters" << LL_ENDL;
1054	}
1055	if (!mHasShaderObjects)
1056	{
1057		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_shader_objects" << LL_ENDL;
1058	}
1059	if (!mHasVertexShader)
1060	{
1061		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_vertex_shader" << LL_ENDL;
1062	}
1063	if (!mHasFragmentShader)
1064	{
1065		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_fragment_shader" << LL_ENDL;
1066	}
1067	if (!mHasBlendFuncSeparate)
1068	{
1069		LL_INFOS("RenderInit") << "Couldn't initialize GL_EXT_blend_func_separate" << LL_ENDL;
1070	}
1071	if (!mHasDrawBuffers)
1072	{
1073		LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_draw_buffers" << LL_ENDL;
1074	}
1075
1076	// Disable certain things due to known bugs
1077	if (mIsIntel && mHasMipMapGeneration)
1078	{
1079		LL_INFOS("RenderInit") << "Disabling mip-map generation for Intel GPUs" << LL_ENDL;
1080		mHasMipMapGeneration = FALSE;
1081	}
1082#if !LL_DARWIN
1083	if (mIsATI && mHasMipMapGeneration)
1084	{
1085		LL_INFOS("RenderInit") << "Disabling mip-map generation for ATI GPUs (performance opt)" << LL_ENDL;
1086		mHasMipMapGeneration = FALSE;
1087	}
1088#endif
1089	
1090	// Misc
1091	glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange);
1092	glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);
1093	
1094#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
1095	LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
1096	if (mHasVertexBufferObject)
1097	{
1098		glBindBufferARB = (PFNGLBINDBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindBufferARB");
1099		if (glBindBufferARB)
1100		{
1101			glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteBuffersARB");
1102			glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenBuffersARB");
1103			glIsBufferARB = (PFNGLISBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsBufferARB");
1104			glBufferDataARB = (PFNGLBUFFERDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferDataARB");
1105			glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferSubDataARB");
1106			glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferSubDataARB");
1107			glMapBufferARB = (PFNGLMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMapBufferARB");
1108			glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glUnmapBufferARB");
1109			glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferParameterivARB");
1110			glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferPointervARB");
1111		}
1112		else
1113		{
1114			mHasVertexBufferObject = FALSE;
1115		}
1116	}
1117	if (mHasVertexArrayObject)
1118	{
1119		glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) GLH_EXT_GET_PROC_ADDRESS("glBindVertexArray");
1120		glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteVertexArrays");
1121		glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) GLH_EXT_GET_PROC_ADDRESS("glGenVertexArrays");
1122		glIsVertexArray = (PFNGLISVERTEXARRAYPROC) GLH_EXT_GET_PROC_ADDRESS("glIsVertexArray");
1123	}
1124	if (mHasSync)
1125	{
1126		glFenceSync = (PFNGLFENCESYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glFenceSync");
1127		glIsSync = (PFNGLISSYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glIsSync");
1128		glDeleteSync = (PFNGLDELETESYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteSync");
1129		glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glClientWaitSync");
1130		glWaitSync = (PFNGLWAITSYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glWaitSync");
1131		glGetInteger64v = (PFNGLGETINTEGER64VPROC) GLH_EXT_GET_PROC_ADDRESS("glGetInteger64v");
1132		glGetSynciv = (PFNGLGETSYNCIVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetSynciv");
1133	}
1134	if (mHasMapBufferRange)
1135	{
1136		glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) GLH_EXT_GET_PROC_ADDRESS("glMapBufferRange");
1137		glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) GLH_EXT_GET_PROC_ADDRESS("glFlushMappedBufferRange");
1138	}
1139	if (mHasFramebufferObject)
1140	{
1141		llinfos << "initExtensions() FramebufferObject-related procs..." << llendl;
1142		glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbuffer");
1143		glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbuffer");
1144		glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffers");
1145		glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) GLH_EXT_GET_PROC_ADDRESS("glGenRenderbuffers");
1146		glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorage");
1147		glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetRenderbufferParameteriv");
1148		glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glIsFramebuffer");
1149		glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glBindFramebuffer");
1150		glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteFramebuffers");
1151		glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) GLH_EXT_GET_PROC_ADDRESS("glGenFramebuffers");
1152		glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) GLH_EXT_GET_PROC_ADDRESS("glCheckFramebufferStatus");
1153		glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture1D");
1154		glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture2D");
1155		glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture3D");
1156		glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferRenderbuffer");
1157		glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetFramebufferAttachmentParameteriv");
1158		glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) GLH_EXT_GET_PROC_ADDRESS("glGenerateMipmap");
1159		glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glBlitFramebuffer");
1160		glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorageMultisample");
1161		glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTextureLayer");
1162	}
1163	if (mHasDrawBuffers)
1164	{
1165		glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDrawBuffersARB");
1166	}
1167	if (mHasBlendFuncSeparate)
1168	{
1169		glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT");
1170	}
1171	if (mHasTextureMultisample)
1172	{
1173		glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage2DMultisample");
1174		glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage3DMultisample");
1175		glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
1176		glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski");
1177	}	
1178	if (mHasDebugOutput)
1179	{
1180		glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageControlARB");
1181		glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageInsertARB");
1182		glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB");
1183		glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB");
1184	}
1185#if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS
1186	// This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah
1187	glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
1188	if (!glDrawRangeElements)
1189	{
1190		mGLMaxVertexRange = 0;
1191		mGLMaxIndexRange = 0;
1192	}
1193#endif // !LL_LINUX || LL_LINUX_NV_GL_HEADERS
1194#if LL_LINUX_NV_GL_HEADERS
1195	// nvidia headers are critically different from mesa-esque
1196 	glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glActiveTextureARB");
1197 	glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glClientActiveTextureARB");
1198#endif // LL_LINUX_NV_GL_HEADERS
1199
1200	if (mHasOcclusionQuery)
1201	{
1202		llinfos << "initExtensions() OcclusionQuery-related procs..." << llendl;
1203		glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB");
1204		glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB");
1205		glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB");
1206		glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBeginQueryARB");
1207		glEndQueryARB = (PFNGLENDQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glEndQueryARB");
1208		glGetQueryivARB = (PFNGLGETQUERYIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryivARB");
1209		glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectivARB");
1210		glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectuivARB");
1211	}
1212	if (mHasPointParameters)
1213	{
1214		llinfos << "initExtensions() PointParameters-related procs..." << llendl;
1215		glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB");
1216		glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB");
1217	}
1218	if (mHasShaderObjects)
1219	{
1220		glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteObjectARB");
1221		glGetHandleARB = (PFNGLGETHANDLEARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetHandleARB");
1222		glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDetachObjectARB");
1223		glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glCreateShaderObjectARB");
1224		glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) GLH_EXT_GET_PROC_ADDRESS("glShaderSourceARB");
1225		glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) GLH_EXT_GET_PROC_ADDRESS("glCompileShaderARB");
1226		glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glCreateProgramObjectARB");
1227		glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glAttachObjectARB");
1228		glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glLinkProgramARB");
1229		glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUseProgramObjectARB");
1230		glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glValidateProgramARB");
1231		glUniform1fARB = (PFNGLUNIFORM1FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1fARB");
1232		glUniform2fARB = (PFNGLUNIFORM2FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2fARB");
1233		glUniform3fARB = (PFNGLUNIFORM3FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3fARB");
1234		glUniform4fARB = (PFNGLUNIFORM4FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4fARB");
1235		glUniform1iARB = (PFNGLUNIFORM1IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1iARB");
1236		glUniform2iARB = (PFNGLUNIFORM2IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2iARB");
1237		glUniform3iARB = (PFNGLUNIFORM3IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3iARB");
1238		glUniform4iARB = (PFNGLUNIFORM4IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4iARB");
1239		glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1fvARB");
1240		glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2fvARB");
1241		glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3fvARB");
1242		glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4fvARB");
1243		glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1ivARB");
1244		glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2ivARB");
1245		glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3ivARB");
1246		glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4ivARB");
1247		glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniformMatrix2fvARB");
1248		glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniformMatrix3fvARB");
1249		glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniformMatrix4fvARB");
1250		glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetObjectParameterfvARB");
1251		glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetObjectParameterivARB");
1252		glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetInfoLogARB");
1253		glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttachedObjectsARB");
1254		glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetUniformLocationARB");
1255		glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveUniformARB");
1256		glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetUniformfvARB");
1257		glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetUniformivARB");
1258		glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetShaderSourceARB");
1259	}
1260	if (mHasVertexShader)
1261	{
1262		llinfos << "initExtensions() Ver…

Large files files are truncated, but you can click here to view the full file