aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llrender/llgl.cpp66
1 files changed, 8 insertions, 58 deletions
diff --git a/linden/indra/llrender/llgl.cpp b/linden/indra/llrender/llgl.cpp
index 2cb7adc..a9cf073 100644
--- a/linden/indra/llrender/llgl.cpp
+++ b/linden/indra/llrender/llgl.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2001-2008, Linden Research, Inc. 7 * Copyright (c) 2001-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -263,7 +263,6 @@ LLGLManager::LLGLManager() :
263 mHasMultitexture(FALSE), 263 mHasMultitexture(FALSE),
264 mNumTextureUnits(1), 264 mNumTextureUnits(1),
265 mHasMipMapGeneration(FALSE), 265 mHasMipMapGeneration(FALSE),
266 mHasPalettedTextures(FALSE),
267 mHasCompressedTextures(FALSE), 266 mHasCompressedTextures(FALSE),
268 mHasFramebufferObject(FALSE), 267 mHasFramebufferObject(FALSE),
269 268
@@ -566,7 +565,6 @@ void LLGLManager::initExtensions()
566 mHasFramebufferObject = FALSE; 565 mHasFramebufferObject = FALSE;
567# endif 566# endif
568 mHasMipMapGeneration = FALSE; 567 mHasMipMapGeneration = FALSE;
569 mHasPalettedTextures = FALSE;
570 mHasSeparateSpecularColor = FALSE; 568 mHasSeparateSpecularColor = FALSE;
571 mHasAnisotropic = FALSE; 569 mHasAnisotropic = FALSE;
572 mHasCubeMap = FALSE; 570 mHasCubeMap = FALSE;
@@ -578,7 +576,6 @@ void LLGLManager::initExtensions()
578#else // LL_MESA_HEADLESS 576#else // LL_MESA_HEADLESS
579 mHasMultitexture = glh_init_extensions("GL_ARB_multitexture"); 577 mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
580 mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap"); 578 mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap");
581 mHasPalettedTextures = glh_init_extensions("GL_EXT_paletted_texture");
582 mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color"); 579 mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color");
583 mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic"); 580 mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic");
584 glh_init_extensions("GL_ARB_texture_cube_map"); 581 glh_init_extensions("GL_ARB_texture_cube_map");
@@ -610,7 +607,6 @@ void LLGLManager::initExtensions()
610 mHasVertexBufferObject = FALSE; 607 mHasVertexBufferObject = FALSE;
611 mHasFramebufferObject = FALSE; 608 mHasFramebufferObject = FALSE;
612 mHasMipMapGeneration = FALSE; 609 mHasMipMapGeneration = FALSE;
613 mHasPalettedTextures = FALSE;
614 mHasSeparateSpecularColor = FALSE; 610 mHasSeparateSpecularColor = FALSE;
615 mHasAnisotropic = FALSE; 611 mHasAnisotropic = FALSE;
616 mHasCubeMap = FALSE; 612 mHasCubeMap = FALSE;
@@ -628,7 +624,6 @@ void LLGLManager::initExtensions()
628 // bug reports. This should be the default until we get a 624 // bug reports. This should be the default until we get a
629 // proper blacklist/whitelist on Linux. 625 // proper blacklist/whitelist on Linux.
630 mHasMipMapGeneration = FALSE; 626 mHasMipMapGeneration = FALSE;
631 mHasPalettedTextures = FALSE;
632 mHasAnisotropic = FALSE; 627 mHasAnisotropic = FALSE;
633 //mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar 628 //mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar
634 //mHasOcclusionQuery = FALSE; // source of many ATI system hangs 629 //mHasOcclusionQuery = FALSE; // source of many ATI system hangs
@@ -648,7 +643,6 @@ void LLGLManager::initExtensions()
648 if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE; 643 if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE;
649 if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE; 644 if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE;
650 if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S 645 if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S
651 if (strchr(blacklist,'e')) mHasPalettedTextures = FALSE;//S
652// if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S 646// if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S
653// if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S 647// if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S
654 if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE; 648 if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE;
@@ -663,13 +657,6 @@ void LLGLManager::initExtensions()
663 if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S 657 if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S
664 } 658 }
665#endif // LL_LINUX 659#endif // LL_LINUX
666
667#if LL_DARWIN || LL_LINUX
668 // MBW -- 12/4/2003 -- Using paletted textures causes a bunch of avatar rendering problems on the Mac.
669 // Not sure if this is due to driver problems or incorrect use of the extension, but I'm disabling it for now.
670 // Tofu - 2006-10-03 -- Same problem on Linux.
671 mHasPalettedTextures = false;
672#endif
673 660
674 if (!mHasMultitexture) 661 if (!mHasMultitexture)
675 { 662 {
@@ -683,10 +670,6 @@ void LLGLManager::initExtensions()
683 { 670 {
684 LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_env_combine" << LL_ENDL; 671 LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_env_combine" << LL_ENDL;
685 } 672 }
686 if (!mHasPalettedTextures)
687 {
688 LL_INFOS("RenderInit") << "Couldn't initialize GL_EXT_paletted_texture" << LL_ENDL;
689 }
690 if (!mHasSeparateSpecularColor) 673 if (!mHasSeparateSpecularColor)
691 { 674 {
692 LL_INFOS("RenderInit") << "Couldn't initialize separate specular color" << LL_ENDL; 675 LL_INFOS("RenderInit") << "Couldn't initialize separate specular color" << LL_ENDL;
@@ -788,13 +771,7 @@ void LLGLManager::initExtensions()
788 mGLMaxIndexRange = 0; 771 mGLMaxIndexRange = 0;
789 } 772 }
790#endif // !LL_LINUX 773#endif // !LL_LINUX
791#if LL_LINUX 774
792 // On Linux we need to get glColorTableEXT dynamically.
793 if (mHasPalettedTextures)
794 {
795 glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableEXT");
796 }
797#endif // LL_LINUX
798 if (mHasOcclusionQuery) 775 if (mHasOcclusionQuery)
799 { 776 {
800 glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB"); 777 glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB");
@@ -960,7 +937,8 @@ void assert_glerror()
960 GLubyte const * gl_error_msg = gluErrorString(error); 937 GLubyte const * gl_error_msg = gluErrorString(error);
961 if (NULL != gl_error_msg) 938 if (NULL != gl_error_msg)
962 { 939 {
963 LL_WARNS("RenderState") << "GL Error:" << gl_error_msg << LL_ENDL; 940 LL_WARNS("RenderState") << "GL Error:" << error<< LL_ENDL;
941 LL_WARNS("RenderState") << "GL Error String:" << gl_error_msg << LL_ENDL;
964 } 942 }
965 else 943 else
966 { 944 {
@@ -1001,7 +979,7 @@ GLboolean LLGLDepthTest::sWriteEnabled = GL_TRUE; // OpenGL default
1001void LLGLState::initClass() 979void LLGLState::initClass()
1002{ 980{
1003 sStateMap[GL_DITHER] = GL_TRUE; 981 sStateMap[GL_DITHER] = GL_TRUE;
1004 sStateMap[GL_TEXTURE_2D] = GL_TRUE; 982 // sStateMap[GL_TEXTURE_2D] = GL_TRUE;
1005 983
1006 //make sure multisample defaults to disabled 984 //make sure multisample defaults to disabled
1007 sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; 985 sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
@@ -1030,7 +1008,7 @@ void LLGLState::resetTextureStates()
1030 { 1008 {
1031 gGL.getTexUnit(j)->activate(); 1009 gGL.getTexUnit(j)->activate();
1032 glClientActiveTextureARB(GL_TEXTURE0_ARB+j); 1010 glClientActiveTextureARB(GL_TEXTURE0_ARB+j);
1033 j == 0 ? glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D); 1011 j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable();
1034 } 1012 }
1035} 1013}
1036 1014
@@ -1053,14 +1031,6 @@ void LLGLState::checkStates(const std::string& msg)
1053 1031
1054 stop_glerror(); 1032 stop_glerror();
1055 1033
1056 GLint activeTexture;
1057 glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture);
1058
1059 if (activeTexture != GL_TEXTURE0_ARB)
1060 {
1061 LL_GL_ERRS << "Texture channel corrupted. " << LL_ENDL;
1062 }
1063
1064 GLint src; 1034 GLint src;
1065 GLint dst; 1035 GLint dst;
1066 glGetIntegerv(GL_BLEND_SRC, &src); 1036 glGetIntegerv(GL_BLEND_SRC, &src);
@@ -1099,17 +1069,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
1099 1069
1100 BOOL error = FALSE; 1070 BOOL error = FALSE;
1101 1071
1102 if (activeTexture != GL_TEXTURE0_ARB) 1072 if (activeTexture == GL_TEXTURE0_ARB)
1103 {
1104 error = TRUE;
1105 LL_WARNS("RenderState") << "Active texture channel corrupted. " << LL_ENDL;
1106 }
1107 else if (!glIsEnabled(GL_TEXTURE_2D))
1108 {
1109 error = TRUE;
1110 LL_WARNS("RenderState") << "GL_TEXTURE_2D not enabled on texture channel 0." << LL_ENDL;
1111 }
1112 else
1113 { 1073 {
1114 GLint tex_env_mode = 0; 1074 GLint tex_env_mode = 0;
1115 1075
@@ -1152,7 +1112,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
1152 LLMatrix4 identity; 1112 LLMatrix4 identity;
1153 LLMatrix4 matrix; 1113 LLMatrix4 matrix;
1154 1114
1155 for (GLint i = 0; i < maxTextureUnits; i++) 1115 for (GLint i = 1; i < maxTextureUnits; i++)
1156 { 1116 {
1157 gGL.getTexUnit(i)->activate(); 1117 gGL.getTexUnit(i)->activate();
1158 glClientActiveTextureARB(GL_TEXTURE0_ARB+i); 1118 glClientActiveTextureARB(GL_TEXTURE0_ARB+i);
@@ -1459,16 +1419,6 @@ void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals)
1459#endif 1419#endif
1460} 1420}
1461 1421
1462
1463void set_palette(U8 *palette_data)
1464{
1465 if (gGLManager.mHasPalettedTextures)
1466 {
1467 glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, palette_data);
1468 }
1469}
1470
1471
1472void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific ) 1422void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific )
1473{ 1423{
1474 // GL_VERSION returns a null-terminated string with the format: 1424 // GL_VERSION returns a null-terminated string with the format: