diff options
Diffstat (limited to 'linden/indra/llwindow/llgl.cpp')
-rw-r--r-- | linden/indra/llwindow/llgl.cpp | 155 |
1 files changed, 122 insertions, 33 deletions
diff --git a/linden/indra/llwindow/llgl.cpp b/linden/indra/llwindow/llgl.cpp index ec22907..aabe9da 100644 --- a/linden/indra/llwindow/llgl.cpp +++ b/linden/indra/llwindow/llgl.cpp | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include "llglheaders.h" | 45 | #include "llglheaders.h" |
46 | 46 | ||
47 | #define LL_DEBUG_GL 1 | ||
47 | 48 | ||
48 | #if LL_LINUX && !LL_MESA_HEADLESS | 49 | #if LL_LINUX && !LL_MESA_HEADLESS |
49 | // The __APPLE__ hack is to make glh_extensions.h not symbol-clash horribly | 50 | // The __APPLE__ hack is to make glh_extensions.h not symbol-clash horribly |
@@ -118,6 +119,10 @@ PFNGLGETQUERYIVARBPROC glGetQueryivARB = NULL; | |||
118 | PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB = NULL; | 119 | PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB = NULL; |
119 | PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL; | 120 | PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL; |
120 | 121 | ||
122 | // GL_ARB_point_parameters | ||
123 | PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL; | ||
124 | PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL; | ||
125 | |||
121 | //shader object prototypes | 126 | //shader object prototypes |
122 | PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; | 127 | PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; |
123 | PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; | 128 | PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; |
@@ -267,6 +272,7 @@ LLGLManager::LLGLManager() | |||
267 | mHasVertexShader = FALSE; | 272 | mHasVertexShader = FALSE; |
268 | mHasFragmentShader = FALSE; | 273 | mHasFragmentShader = FALSE; |
269 | mHasShaderObjects = FALSE; | 274 | mHasShaderObjects = FALSE; |
275 | mHasPointParameters = FALSE; | ||
270 | 276 | ||
271 | #if LL_WINDOWS | 277 | #if LL_WINDOWS |
272 | mHasWGLARBPixelFormat = FALSE; | 278 | mHasWGLARBPixelFormat = FALSE; |
@@ -290,7 +296,6 @@ LLGLManager::LLGLManager() | |||
290 | mVRAM = 0; | 296 | mVRAM = 0; |
291 | mGLMaxVertexRange = 0; | 297 | mGLMaxVertexRange = 0; |
292 | mGLMaxIndexRange = 0; | 298 | mGLMaxIndexRange = 0; |
293 | mSoftwareBlendSSE = TRUE; | ||
294 | } | 299 | } |
295 | 300 | ||
296 | //--------------------------------------------------------------------- | 301 | //--------------------------------------------------------------------- |
@@ -506,8 +511,6 @@ extern LLCPUInfo gSysCPU; | |||
506 | 511 | ||
507 | void LLGLManager::initExtensions() | 512 | void LLGLManager::initExtensions() |
508 | { | 513 | { |
509 | mSoftwareBlendSSE = gSysCPU.hasSSE(); | ||
510 | |||
511 | #if LL_MESA_HEADLESS | 514 | #if LL_MESA_HEADLESS |
512 | # if GL_ARB_multitexture | 515 | # if GL_ARB_multitexture |
513 | mHasMultitexture = TRUE; | 516 | mHasMultitexture = TRUE; |
@@ -538,6 +541,7 @@ void LLGLManager::initExtensions() | |||
538 | mHasCubeMap = FALSE; | 541 | mHasCubeMap = FALSE; |
539 | mHasATIVAO = FALSE; | 542 | mHasATIVAO = FALSE; |
540 | mHasOcclusionQuery = FALSE; | 543 | mHasOcclusionQuery = FALSE; |
544 | mHasPointParameters = FALSE; | ||
541 | mHasShaderObjects = FALSE; | 545 | mHasShaderObjects = FALSE; |
542 | mHasVertexShader = FALSE; | 546 | mHasVertexShader = FALSE; |
543 | mHasFragmentShader = FALSE; | 547 | mHasFragmentShader = FALSE; |
@@ -553,9 +557,12 @@ void LLGLManager::initExtensions() | |||
553 | mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); | 557 | mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); |
554 | mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); | 558 | mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); |
555 | mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); | 559 | mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); |
556 | mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); | ||
557 | mHasATIVAO = ExtensionExists("GL_ATI_vertex_array_object", gGLHExts.mSysExts); | 560 | mHasATIVAO = ExtensionExists("GL_ATI_vertex_array_object", gGLHExts.mSysExts); |
558 | mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); | 561 | mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); |
562 | mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); | ||
563 | #if !LL_DARWIN | ||
564 | mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); | ||
565 | #endif | ||
559 | mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); | 566 | mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); |
560 | mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts) | 567 | mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts) |
561 | && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); | 568 | && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); |
@@ -565,7 +572,7 @@ void LLGLManager::initExtensions() | |||
565 | #if LL_LINUX | 572 | #if LL_LINUX |
566 | // Our extension support for the Linux Client is very young with some | 573 | // Our extension support for the Linux Client is very young with some |
567 | // potential driver gotchas, so offer a semi-secret way to turn it off. | 574 | // potential driver gotchas, so offer a semi-secret way to turn it off. |
568 | if (getenv("LL_GL_NOEXT")) | 575 | if (getenv("LL_GL_NOEXT")) /* Flawfinder: ignore */ |
569 | { | 576 | { |
570 | //mHasMultitexture = FALSE; // NEEDED! | 577 | //mHasMultitexture = FALSE; // NEEDED! |
571 | mHasARBEnvCombine = FALSE; | 578 | mHasARBEnvCombine = FALSE; |
@@ -580,13 +587,14 @@ void LLGLManager::initExtensions() | |||
580 | mHasCubeMap = FALSE; | 587 | mHasCubeMap = FALSE; |
581 | mHasATIVAO = FALSE; | 588 | mHasATIVAO = FALSE; |
582 | mHasOcclusionQuery = FALSE; | 589 | mHasOcclusionQuery = FALSE; |
590 | mHasPointParameters = FALSE; | ||
583 | mHasShaderObjects = FALSE; | 591 | mHasShaderObjects = FALSE; |
584 | mHasVertexShader = FALSE; | 592 | mHasVertexShader = FALSE; |
585 | mHasFragmentShader = FALSE; | 593 | mHasFragmentShader = FALSE; |
586 | llwarns << "GL extension support DISABLED via LL_GL_NOEXT" << | 594 | llwarns << "GL extension support DISABLED via LL_GL_NOEXT" << |
587 | llendl; | 595 | llendl; |
588 | } | 596 | } |
589 | else if (getenv("LL_GL_BASICEXT")) | 597 | else if (getenv("LL_GL_BASICEXT")) /* Flawfinder: ignore */ |
590 | { | 598 | { |
591 | // This switch attempts to turn off all support for exotic | 599 | // This switch attempts to turn off all support for exotic |
592 | // extensions which I believe correspond to fatal driver | 600 | // extensions which I believe correspond to fatal driver |
@@ -597,6 +605,7 @@ void LLGLManager::initExtensions() | |||
597 | mHasNVVertexArrayRange = FALSE; | 605 | mHasNVVertexArrayRange = FALSE; |
598 | mHasNVFence = FALSE; | 606 | mHasNVFence = FALSE; |
599 | mHasAnisotropic = FALSE; | 607 | mHasAnisotropic = FALSE; |
608 | mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar | ||
600 | mHasATIVAO = FALSE; | 609 | mHasATIVAO = FALSE; |
601 | mHasOcclusionQuery = FALSE; // source of many ATI system hangs | 610 | mHasOcclusionQuery = FALSE; // source of many ATI system hangs |
602 | mHasShaderObjects = FALSE; | 611 | mHasShaderObjects = FALSE; |
@@ -605,12 +614,12 @@ void LLGLManager::initExtensions() | |||
605 | llwarns << "GL extension support forced to SIMPLE level via LL_GL_BASICEXT" << | 614 | llwarns << "GL extension support forced to SIMPLE level via LL_GL_BASICEXT" << |
606 | llendl; | 615 | llendl; |
607 | } | 616 | } |
608 | if (getenv("LL_GL_BLACKLIST")) | 617 | if (getenv("LL_GL_BLACKLIST")) /* Flawfinder: ignore */ |
609 | { | 618 | { |
610 | // This lets advanced troubleshooters disable specific | 619 | // This lets advanced troubleshooters disable specific |
611 | // GL extensions to isolate problems with their hardware. | 620 | // GL extensions to isolate problems with their hardware. |
612 | // SL-28126 | 621 | // SL-28126 |
613 | const char *const blacklist = getenv("LL_GL_BLACKLIST"); | 622 | const char *const blacklist = getenv("LL_GL_BLACKLIST"); /* Flawfinder: ignore */ |
614 | llwarns << "GL extension support partially disabled via LL_GL_BLACKLIST: " << blacklist << llendl; | 623 | llwarns << "GL extension support partially disabled via LL_GL_BLACKLIST: " << blacklist << llendl; |
615 | if (strchr(blacklist,'a')) mHasARBEnvCombine = FALSE; | 624 | if (strchr(blacklist,'a')) mHasARBEnvCombine = FALSE; |
616 | if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE; | 625 | if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE; |
@@ -621,12 +630,13 @@ void LLGLManager::initExtensions() | |||
621 | if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S | 630 | if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S |
622 | if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE; | 631 | if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE; |
623 | if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S | 632 | if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S |
624 | if (strchr(blacklist,'j')) mHasCubeMap = FALSE; | 633 | if (strchr(blacklist,'j')) mHasCubeMap = FALSE;//S |
625 | if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S | 634 | if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S |
626 | if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE; | 635 | if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE; |
627 | if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S | 636 | if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S |
628 | if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S | 637 | if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S |
629 | if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S | 638 | if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S |
639 | if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S | ||
630 | } | 640 | } |
631 | #endif // LL_LINUX | 641 | #endif // LL_LINUX |
632 | 642 | ||
@@ -677,6 +687,10 @@ void LLGLManager::initExtensions() | |||
677 | { | 687 | { |
678 | llinfos << "Couldn't initialize GL_ARB_occlusion_query" << llendl; | 688 | llinfos << "Couldn't initialize GL_ARB_occlusion_query" << llendl; |
679 | } | 689 | } |
690 | if (!mHasPointParameters) | ||
691 | { | ||
692 | llinfos << "Couldn't initialize GL_ARB_point_parameters" << llendl; | ||
693 | } | ||
680 | if (!mHasShaderObjects) | 694 | if (!mHasShaderObjects) |
681 | { | 695 | { |
682 | llinfos << "Couldn't initialize GL_ARB_shader_objects" << llendl; | 696 | llinfos << "Couldn't initialize GL_ARB_shader_objects" << llendl; |
@@ -741,16 +755,23 @@ void LLGLManager::initExtensions() | |||
741 | if (mHasVertexBufferObject) | 755 | if (mHasVertexBufferObject) |
742 | { | 756 | { |
743 | glBindBufferARB = (PFNGLBINDBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindBufferARB"); | 757 | glBindBufferARB = (PFNGLBINDBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindBufferARB"); |
744 | glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteBuffersARB"); | 758 | if (glBindBufferARB) |
745 | glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenBuffersARB"); | 759 | { |
746 | glIsBufferARB = (PFNGLISBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsBufferARB"); | 760 | glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteBuffersARB"); |
747 | glBufferDataARB = (PFNGLBUFFERDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferDataARB"); | 761 | glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenBuffersARB"); |
748 | glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferSubDataARB"); | 762 | glIsBufferARB = (PFNGLISBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsBufferARB"); |
749 | glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferSubDataARB"); | 763 | glBufferDataARB = (PFNGLBUFFERDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferDataARB"); |
750 | glMapBufferARB = (PFNGLMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMapBufferARB"); | 764 | glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferSubDataARB"); |
751 | glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glUnmapBufferARB"); | 765 | glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferSubDataARB"); |
752 | glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferParameterivARB"); | 766 | glMapBufferARB = (PFNGLMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMapBufferARB"); |
753 | glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferPointervARB"); | 767 | glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glUnmapBufferARB"); |
768 | glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferParameterivARB"); | ||
769 | glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferPointervARB"); | ||
770 | } | ||
771 | else | ||
772 | { | ||
773 | mHasVertexBufferObject = FALSE; | ||
774 | } | ||
754 | } | 775 | } |
755 | if (mHasATIVAO) | 776 | if (mHasATIVAO) |
756 | { | 777 | { |
@@ -797,6 +818,11 @@ void LLGLManager::initExtensions() | |||
797 | glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectivARB"); | 818 | glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectivARB"); |
798 | glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectuivARB"); | 819 | glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectuivARB"); |
799 | } | 820 | } |
821 | if (mHasPointParameters) | ||
822 | { | ||
823 | glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB"); | ||
824 | glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB"); | ||
825 | } | ||
800 | if (mHasShaderObjects) | 826 | if (mHasShaderObjects) |
801 | { | 827 | { |
802 | glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteObjectARB"); | 828 | glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteObjectARB"); |
@@ -991,6 +1017,7 @@ void LLGLState::dumpStates() | |||
991 | 1017 | ||
992 | void LLGLState::checkStates() | 1018 | void LLGLState::checkStates() |
993 | { | 1019 | { |
1020 | #if LL_DEBUG_GL | ||
994 | stop_glerror(); | 1021 | stop_glerror(); |
995 | 1022 | ||
996 | GLint activeTexture; | 1023 | GLint activeTexture; |
@@ -1025,10 +1052,12 @@ void LLGLState::checkStates() | |||
1025 | } | 1052 | } |
1026 | 1053 | ||
1027 | stop_glerror(); | 1054 | stop_glerror(); |
1055 | #endif | ||
1028 | } | 1056 | } |
1029 | 1057 | ||
1030 | void LLGLState::checkTextureChannels() | 1058 | void LLGLState::checkTextureChannels() |
1031 | { | 1059 | { |
1060 | #if LL_DEBUG_GL | ||
1032 | GLint activeTexture; | 1061 | GLint activeTexture; |
1033 | glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture); | 1062 | glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture); |
1034 | 1063 | ||
@@ -1109,42 +1138,103 @@ void LLGLState::checkTextureChannels() | |||
1109 | { | 1138 | { |
1110 | LL_GL_ERRS << "GL texture state corruption detected." << llendl; | 1139 | LL_GL_ERRS << "GL texture state corruption detected." << llendl; |
1111 | } | 1140 | } |
1141 | #endif | ||
1112 | } | 1142 | } |
1113 | 1143 | ||
1114 | void LLGLState::checkClientArrays() | 1144 | void LLGLState::checkClientArrays(U32 data_mask) |
1115 | { | 1145 | { |
1146 | #if LL_DEBUG_GL | ||
1147 | stop_glerror(); | ||
1116 | BOOL error = FALSE; | 1148 | BOOL error = FALSE; |
1117 | static const char* label[] = | 1149 | static const char* label[] = |
1118 | { | 1150 | { |
1119 | //"GL_INDEX_ARRAY", | 1151 | "GL_VERTEX_ARRAY", |
1120 | "GL_NORMAL_ARRAY", | 1152 | "GL_NORMAL_ARRAY", |
1121 | //"GL_VERTEX_ARRAY", | ||
1122 | "GL_COLOR_ARRAY", | 1153 | "GL_COLOR_ARRAY", |
1123 | "GL_TEXTURE_COORD_ARRAY" | 1154 | "GL_TEXTURE_COORD_ARRAY" |
1124 | }; | 1155 | }; |
1125 | 1156 | ||
1126 | static GLint value[] = | 1157 | static GLint value[] = |
1127 | { | 1158 | { |
1128 | //GL_INDEX_ARRAY, | 1159 | GL_VERTEX_ARRAY, |
1129 | GL_NORMAL_ARRAY, | 1160 | GL_NORMAL_ARRAY, |
1130 | //GL_VERTEX_ARRAY, | ||
1131 | GL_COLOR_ARRAY, | 1161 | GL_COLOR_ARRAY, |
1132 | GL_TEXTURE_COORD_ARRAY | 1162 | GL_TEXTURE_COORD_ARRAY |
1163 | }; | ||
1164 | |||
1165 | U32 mask[] = | ||
1166 | { //copied from llvertexbuffer.h | ||
1167 | 0x0001, //MAP_VERTEX, | ||
1168 | 0x0002, //MAP_NORMAL, | ||
1169 | 0x0010, //MAP_COLOR, | ||
1170 | 0x0004, //MAP_TEXCOORD | ||
1133 | }; | 1171 | }; |
1134 | 1172 | ||
1135 | for (S32 j = 0; j < 3; j++) | 1173 | |
1174 | for (S32 j = 0; j < 4; j++) | ||
1136 | { | 1175 | { |
1137 | if (glIsEnabled(value[j])) | 1176 | if (glIsEnabled(value[j])) |
1138 | { | 1177 | { |
1178 | if (!(mask[j] & data_mask)) | ||
1179 | { | ||
1180 | error = TRUE; | ||
1181 | llwarns << "GL still has " << label[j] << " enabled." << llendl; | ||
1182 | } | ||
1183 | } | ||
1184 | else | ||
1185 | { | ||
1186 | if (mask[j] & data_mask) | ||
1187 | { | ||
1188 | error = TRUE; | ||
1189 | llwarns << "GL does not have " << label[j] << " enabled." << llendl; | ||
1190 | } | ||
1191 | } | ||
1192 | } | ||
1193 | |||
1194 | glClientActiveTextureARB(GL_TEXTURE1_ARB); | ||
1195 | glActiveTextureARB(GL_TEXTURE1_ARB); | ||
1196 | if (glIsEnabled(GL_TEXTURE_COORD_ARRAY)) | ||
1197 | { | ||
1198 | if (!(data_mask & 0x0008)) | ||
1199 | { | ||
1200 | error = TRUE; | ||
1201 | llwarns << "GL still has GL_TEXTURE_COORD_ARRAY enabled on channel 1." << llendl; | ||
1202 | } | ||
1203 | } | ||
1204 | else | ||
1205 | { | ||
1206 | if (data_mask & 0x0008) | ||
1207 | { | ||
1139 | error = TRUE; | 1208 | error = TRUE; |
1140 | llwarns << "GL still has " << label[j] << " enabled." << llendl; | 1209 | llwarns << "GL does not have GL_TEXTURE_COORD_ARRAY enabled on channel 1." << llendl; |
1141 | } | 1210 | } |
1142 | } | 1211 | } |
1143 | 1212 | ||
1213 | if (glIsEnabled(GL_TEXTURE_2D)) | ||
1214 | { | ||
1215 | if (!(data_mask & 0x0008)) | ||
1216 | { | ||
1217 | error = TRUE; | ||
1218 | llwarns << "GL still has GL_TEXTURE_2D enabled on channel 1." << llendl; | ||
1219 | } | ||
1220 | } | ||
1221 | else | ||
1222 | { | ||
1223 | if (data_mask & 0x0008) | ||
1224 | { | ||
1225 | error = TRUE; | ||
1226 | llwarns << "GL does not have GL_TEXTURE_2D enabled on channel 1." << llendl; | ||
1227 | } | ||
1228 | } | ||
1229 | |||
1230 | glClientActiveTextureARB(GL_TEXTURE0_ARB); | ||
1231 | glActiveTextureARB(GL_TEXTURE0_ARB); | ||
1232 | |||
1144 | if (error) | 1233 | if (error) |
1145 | { | 1234 | { |
1146 | LL_GL_ERRS << "GL client array corruption detected." << llendl; | 1235 | LL_GL_ERRS << "GL client array corruption detected." << llendl; |
1147 | } | 1236 | } |
1237 | #endif | ||
1148 | } | 1238 | } |
1149 | 1239 | ||
1150 | //============================================================================ | 1240 | //============================================================================ |
@@ -1190,9 +1280,8 @@ LLGLState::~LLGLState() | |||
1190 | stop_glerror(); | 1280 | stop_glerror(); |
1191 | if (mState) | 1281 | if (mState) |
1192 | { | 1282 | { |
1193 | #if LL_DEBUG | 1283 | #if LL_DEBUG_GL |
1194 | LLGLboolean cur_state = sStateMap[mState]; | 1284 | llassert(sStateMap[mState] == glIsEnabled(mState)); |
1195 | llassert(cur_state == glIsEnabled(mState)); | ||
1196 | #endif | 1285 | #endif |
1197 | if (mIsEnabled != mWasEnabled) | 1286 | if (mIsEnabled != mWasEnabled) |
1198 | { | 1287 | { |
@@ -1270,10 +1359,10 @@ void disable_cloth_weights(const S32 index) | |||
1270 | #endif | 1359 | #endif |
1271 | } | 1360 | } |
1272 | 1361 | ||
1273 | void set_vertex_weights(const S32 index, const F32 *weights) | 1362 | void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights) |
1274 | { | 1363 | { |
1275 | #if GL_ARB_vertex_program | 1364 | #if GL_ARB_vertex_program |
1276 | if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, 0, weights); | 1365 | if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, stride, weights); |
1277 | stop_glerror(); | 1366 | stop_glerror(); |
1278 | #endif | 1367 | #endif |
1279 | } | 1368 | } |
@@ -1321,7 +1410,7 @@ void parse_gl_version( S32* major, S32* minor, S32* release, LLString* vendor_sp | |||
1321 | } | 1410 | } |
1322 | 1411 | ||
1323 | LLString ver_copy( version ); | 1412 | LLString ver_copy( version ); |
1324 | S32 len = (S32)strlen( version ); | 1413 | S32 len = (S32)strlen( version ); /* Flawfinder: ignore */ |
1325 | S32 i = 0; | 1414 | S32 i = 0; |
1326 | S32 start; | 1415 | S32 start; |
1327 | // Find the major version | 1416 | // Find the major version |