diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llrender/llgl.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llrender/llgl.cpp')
-rw-r--r-- | linden/indra/llrender/llgl.cpp | 132 |
1 files changed, 107 insertions, 25 deletions
diff --git a/linden/indra/llrender/llgl.cpp b/linden/indra/llrender/llgl.cpp index a9cf073..61194c4 100644 --- a/linden/indra/llrender/llgl.cpp +++ b/linden/indra/llrender/llgl.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -64,7 +65,7 @@ LLMatrix4 gGLObliqueProjectionInverse; | |||
64 | 65 | ||
65 | LLGLNamePool::pool_list_t LLGLNamePool::sInstances; | 66 | LLGLNamePool::pool_list_t LLGLNamePool::sInstances; |
66 | 67 | ||
67 | #if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS | 68 | #if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS |
68 | // ATI prototypes | 69 | // ATI prototypes |
69 | // vertex blending prototypes | 70 | // vertex blending prototypes |
70 | PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL; | 71 | PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL; |
@@ -132,6 +133,15 @@ PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL; | |||
132 | PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL; | 133 | PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL; |
133 | PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL; | 134 | PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL; |
134 | 135 | ||
136 | // GL_EXT_framebuffer_multisample | ||
137 | PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT = NULL; | ||
138 | |||
139 | // GL_EXT_framebuffer_blit | ||
140 | PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT = NULL; | ||
141 | |||
142 | // GL_ARB_draw_buffers | ||
143 | PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB = NULL; | ||
144 | |||
135 | //shader object prototypes | 145 | //shader object prototypes |
136 | PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; | 146 | PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; |
137 | PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; | 147 | PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; |
@@ -174,7 +184,7 @@ PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL; | |||
174 | PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL; | 184 | PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL; |
175 | 185 | ||
176 | // vertex shader prototypes | 186 | // vertex shader prototypes |
177 | #if LL_LINUX | 187 | #if LL_LINUX || LL_SOLARIS |
178 | PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; | 188 | PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; |
179 | PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; | 189 | PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; |
180 | PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; | 190 | PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; |
@@ -193,7 +203,7 @@ PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL; | |||
193 | PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL; | 203 | PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL; |
194 | PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL; | 204 | PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL; |
195 | PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; | 205 | PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; |
196 | #endif // LL_LINUX | 206 | #endif // LL_LINUX || LL_SOLARIS |
197 | PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL; | 207 | PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL; |
198 | PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL; | 208 | PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL; |
199 | PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL; | 209 | PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL; |
@@ -201,7 +211,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL; | |||
201 | PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; | 211 | PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; |
202 | PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; | 212 | PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; |
203 | PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; | 213 | PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; |
204 | #if LL_LINUX | 214 | #if LL_LINUX || LL_SOLARIS |
205 | PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; | 215 | PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; |
206 | PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; | 216 | PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; |
207 | PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; | 217 | PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; |
@@ -239,7 +249,7 @@ PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL; | |||
239 | PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL; | 249 | PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL; |
240 | PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL; | 250 | PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL; |
241 | PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; | 251 | PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; |
242 | #endif // LL_LINUX | 252 | #endif // LL_LINUX || LL_SOLARIS |
243 | PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL; | 253 | PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL; |
244 | PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; | 254 | PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; |
245 | PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; | 255 | PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; |
@@ -248,10 +258,12 @@ PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; | |||
248 | PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; | 258 | PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; |
249 | #endif | 259 | #endif |
250 | 260 | ||
251 | #if LL_LINUX | 261 | #if LL_LINUX_NV_GL_HEADERS |
252 | PFNGLCOLORTABLEEXTPROC glColorTableEXT = NULL; | 262 | // linux nvidia headers. these define these differently to mesa's. ugh. |
253 | #endif // LL_LINUX | 263 | PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL; |
254 | 264 | PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL; | |
265 | PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = NULL; | ||
266 | #endif // LL_LINUX_NV_GL_HEADERS | ||
255 | #endif | 267 | #endif |
256 | 268 | ||
257 | LLGLManager gGLManager; | 269 | LLGLManager gGLManager; |
@@ -265,6 +277,7 @@ LLGLManager::LLGLManager() : | |||
265 | mHasMipMapGeneration(FALSE), | 277 | mHasMipMapGeneration(FALSE), |
266 | mHasCompressedTextures(FALSE), | 278 | mHasCompressedTextures(FALSE), |
267 | mHasFramebufferObject(FALSE), | 279 | mHasFramebufferObject(FALSE), |
280 | mHasFramebufferMultisample(FALSE), | ||
268 | 281 | ||
269 | mHasVertexBufferObject(FALSE), | 282 | mHasVertexBufferObject(FALSE), |
270 | mHasPBuffer(FALSE), | 283 | mHasPBuffer(FALSE), |
@@ -489,7 +502,7 @@ std::string LLGLManager::getGLInfoString() | |||
489 | info_str += std::string("GL_RENDERER ") + ll_safe_string((const char *)glGetString(GL_RENDERER)) + std::string("\n"); | 502 | info_str += std::string("GL_RENDERER ") + ll_safe_string((const char *)glGetString(GL_RENDERER)) + std::string("\n"); |
490 | info_str += std::string("GL_VERSION ") + ll_safe_string((const char *)glGetString(GL_VERSION)) + std::string("\n"); | 503 | info_str += std::string("GL_VERSION ") + ll_safe_string((const char *)glGetString(GL_VERSION)) + std::string("\n"); |
491 | 504 | ||
492 | #if !LL_MESA_HEADLESS | 505 | #if !LL_MESA_HEADLESS |
493 | all_exts = (const char *)gGLHExts.mSysExts; | 506 | all_exts = (const char *)gGLHExts.mSysExts; |
494 | LLStringUtil::replaceChar(all_exts, ' ', '\n'); | 507 | LLStringUtil::replaceChar(all_exts, ' ', '\n'); |
495 | info_str += std::string("GL_EXTENSIONS:\n") + all_exts + std::string("\n"); | 508 | info_str += std::string("GL_EXTENSIONS:\n") + all_exts + std::string("\n"); |
@@ -564,6 +577,16 @@ void LLGLManager::initExtensions() | |||
564 | # else | 577 | # else |
565 | mHasFramebufferObject = FALSE; | 578 | mHasFramebufferObject = FALSE; |
566 | # endif | 579 | # endif |
580 | # if GL_EXT_framebuffer_multisample | ||
581 | mHasFramebufferMultisample = TRUE; | ||
582 | # else | ||
583 | mHasFramebufferMultisample = FALSE; | ||
584 | # endif | ||
585 | # if GL_ARB_draw_buffers | ||
586 | mHasDrawBuffers = TRUE; | ||
587 | #else | ||
588 | mHasDrawBuffers = FALSE; | ||
589 | # endif | ||
567 | mHasMipMapGeneration = FALSE; | 590 | mHasMipMapGeneration = FALSE; |
568 | mHasSeparateSpecularColor = FALSE; | 591 | mHasSeparateSpecularColor = FALSE; |
569 | mHasAnisotropic = FALSE; | 592 | mHasAnisotropic = FALSE; |
@@ -587,6 +610,8 @@ void LLGLManager::initExtensions() | |||
587 | // mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad | 610 | // mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad |
588 | mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts) | 611 | mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts) |
589 | && ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts); | 612 | && ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts); |
613 | mHasFramebufferMultisample = mHasFramebufferObject && ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts); | ||
614 | mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts); | ||
590 | #if !LL_DARWIN | 615 | #if !LL_DARWIN |
591 | mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); | 616 | mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); |
592 | #endif | 617 | #endif |
@@ -596,7 +621,8 @@ void LLGLManager::initExtensions() | |||
596 | mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); | 621 | mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); |
597 | #endif | 622 | #endif |
598 | 623 | ||
599 | #if LL_LINUX | 624 | #if LL_LINUX || LL_SOLARIS |
625 | llinfos << "initExtensions() checking shell variables to adjust features..." << llendl; | ||
600 | // Our extension support for the Linux Client is very young with some | 626 | // Our extension support for the Linux Client is very young with some |
601 | // potential driver gotchas, so offer a semi-secret way to turn it off. | 627 | // potential driver gotchas, so offer a semi-secret way to turn it off. |
602 | if (getenv("LL_GL_NOEXT")) /* Flawfinder: ignore */ | 628 | if (getenv("LL_GL_NOEXT")) /* Flawfinder: ignore */ |
@@ -606,6 +632,8 @@ void LLGLManager::initExtensions() | |||
606 | mHasCompressedTextures = FALSE; | 632 | mHasCompressedTextures = FALSE; |
607 | mHasVertexBufferObject = FALSE; | 633 | mHasVertexBufferObject = FALSE; |
608 | mHasFramebufferObject = FALSE; | 634 | mHasFramebufferObject = FALSE; |
635 | mHasFramebufferMultisample = FALSE; | ||
636 | mHasDrawBuffers = FALSE; | ||
609 | mHasMipMapGeneration = FALSE; | 637 | mHasMipMapGeneration = FALSE; |
610 | mHasSeparateSpecularColor = FALSE; | 638 | mHasSeparateSpecularColor = FALSE; |
611 | mHasAnisotropic = FALSE; | 639 | mHasAnisotropic = FALSE; |
@@ -655,8 +683,11 @@ void LLGLManager::initExtensions() | |||
655 | if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S | 683 | if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S |
656 | if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S | 684 | if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S |
657 | if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S | 685 | if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S |
686 | if (strchr(blacklist,'r')) mHasDrawBuffers = FALSE;//S | ||
687 | if (strchr(blacklist,'s')) mHasFramebufferMultisample = FALSE; | ||
688 | |||
658 | } | 689 | } |
659 | #endif // LL_LINUX | 690 | #endif // LL_LINUX || LL_SOLARIS |
660 | 691 | ||
661 | if (!mHasMultitexture) | 692 | if (!mHasMultitexture) |
662 | { | 693 | { |
@@ -719,7 +750,7 @@ void LLGLManager::initExtensions() | |||
719 | glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); | 750 | glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); |
720 | glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); | 751 | glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); |
721 | 752 | ||
722 | #if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS | 753 | #if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS |
723 | LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; | 754 | LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; |
724 | if (mHasVertexBufferObject) | 755 | if (mHasVertexBufferObject) |
725 | { | 756 | { |
@@ -744,6 +775,7 @@ void LLGLManager::initExtensions() | |||
744 | } | 775 | } |
745 | if (mHasFramebufferObject) | 776 | if (mHasFramebufferObject) |
746 | { | 777 | { |
778 | llinfos << "initExtensions() FramebufferObject-related procs..." << llendl; | ||
747 | glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbufferEXT"); | 779 | glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbufferEXT"); |
748 | glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbufferEXT"); | 780 | glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbufferEXT"); |
749 | glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffersEXT"); | 781 | glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffersEXT"); |
@@ -762,18 +794,33 @@ void LLGLManager::initExtensions() | |||
762 | glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetFramebufferAttachmentParameterivEXT"); | 794 | glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetFramebufferAttachmentParameterivEXT"); |
763 | glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenerateMipmapEXT"); | 795 | glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenerateMipmapEXT"); |
764 | } | 796 | } |
765 | #if !LL_LINUX | 797 | if (mHasFramebufferMultisample) |
766 | // This is expected to be a static symbol on Linux GL implementations | 798 | { |
799 | glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorageMultisampleEXT"); | ||
800 | glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlitFramebufferEXT"); | ||
801 | } | ||
802 | if (mHasDrawBuffers) | ||
803 | { | ||
804 | glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDrawBuffersARB"); | ||
805 | } | ||
806 | #if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS | ||
807 | // This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah | ||
767 | glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); | 808 | glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); |
768 | if (!glDrawRangeElements) | 809 | if (!glDrawRangeElements) |
769 | { | 810 | { |
770 | mGLMaxVertexRange = 0; | 811 | mGLMaxVertexRange = 0; |
771 | mGLMaxIndexRange = 0; | 812 | mGLMaxIndexRange = 0; |
772 | } | 813 | } |
773 | #endif // !LL_LINUX | 814 | #endif // !LL_LINUX || LL_LINUX_NV_GL_HEADERS |
815 | #if LL_LINUX_NV_GL_HEADERS | ||
816 | // nvidia headers are critically different from mesa-esque | ||
817 | glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glActiveTextureARB"); | ||
818 | glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glClientActiveTextureARB"); | ||
819 | #endif // LL_LINUX_NV_GL_HEADERS | ||
774 | 820 | ||
775 | if (mHasOcclusionQuery) | 821 | if (mHasOcclusionQuery) |
776 | { | 822 | { |
823 | llinfos << "initExtensions() OcclusionQuery-related procs..." << llendl; | ||
777 | glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB"); | 824 | glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB"); |
778 | glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB"); | 825 | glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB"); |
779 | glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB"); | 826 | glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB"); |
@@ -785,6 +832,7 @@ void LLGLManager::initExtensions() | |||
785 | } | 832 | } |
786 | if (mHasPointParameters) | 833 | if (mHasPointParameters) |
787 | { | 834 | { |
835 | llinfos << "initExtensions() PointParameters-related procs..." << llendl; | ||
788 | glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB"); | 836 | glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB"); |
789 | glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB"); | 837 | glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB"); |
790 | } | 838 | } |
@@ -832,6 +880,7 @@ void LLGLManager::initExtensions() | |||
832 | } | 880 | } |
833 | if (mHasVertexShader) | 881 | if (mHasVertexShader) |
834 | { | 882 | { |
883 | llinfos << "initExtensions() VertexShader-related procs..." << llendl; | ||
835 | glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); | 884 | glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); |
836 | glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); | 885 | glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); |
837 | glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); | 886 | glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); |
@@ -944,7 +993,7 @@ void assert_glerror() | |||
944 | { | 993 | { |
945 | // gluErrorString returns NULL for some extensions' error codes. | 994 | // gluErrorString returns NULL for some extensions' error codes. |
946 | // you'll probably have to grep for the number in glext.h. | 995 | // you'll probably have to grep for the number in glext.h. |
947 | LL_WARNS("RenderState") << "GL Error: UNKNOWN 0x" << std::hex << error << LL_ENDL; | 996 | LL_WARNS("RenderState") << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << LL_ENDL; |
948 | } | 997 | } |
949 | error = glGetError(); | 998 | error = glGetError(); |
950 | #endif | 999 | #endif |
@@ -980,12 +1029,14 @@ void LLGLState::initClass() | |||
980 | { | 1029 | { |
981 | sStateMap[GL_DITHER] = GL_TRUE; | 1030 | sStateMap[GL_DITHER] = GL_TRUE; |
982 | // sStateMap[GL_TEXTURE_2D] = GL_TRUE; | 1031 | // sStateMap[GL_TEXTURE_2D] = GL_TRUE; |
983 | 1032 | ||
984 | //make sure multisample defaults to disabled | 1033 | //make sure multisample defaults to disabled |
985 | sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; | 1034 | sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; |
986 | glDisable(GL_MULTISAMPLE_ARB); | 1035 | glDisable(GL_MULTISAMPLE_ARB); |
987 | 1036 | ||
988 | //default vertex arrays to enabled. | 1037 | sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; |
1038 | glDisable(GL_MULTISAMPLE_ARB); | ||
1039 | |||
989 | glEnableClientState(GL_VERTEX_ARRAY); | 1040 | glEnableClientState(GL_VERTEX_ARRAY); |
990 | } | 1041 | } |
991 | 1042 | ||
@@ -1038,7 +1089,7 @@ void LLGLState::checkStates(const std::string& msg) | |||
1038 | 1089 | ||
1039 | if (src != GL_SRC_ALPHA || dst != GL_ONE_MINUS_SRC_ALPHA) | 1090 | if (src != GL_SRC_ALPHA || dst != GL_ONE_MINUS_SRC_ALPHA) |
1040 | { | 1091 | { |
1041 | LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << LL_ENDL; | 1092 | LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << LL_ENDL; |
1042 | } | 1093 | } |
1043 | 1094 | ||
1044 | for (std::map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin(); | 1095 | for (std::map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin(); |
@@ -1077,7 +1128,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) | |||
1077 | if (tex_env_mode != GL_MODULATE) | 1128 | if (tex_env_mode != GL_MODULATE) |
1078 | { | 1129 | { |
1079 | error = TRUE; | 1130 | error = TRUE; |
1080 | LL_WARNS("RenderState") << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << LL_ENDL; | 1131 | LL_WARNS("RenderState") << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << std::dec << LL_ENDL; |
1081 | } | 1132 | } |
1082 | } | 1133 | } |
1083 | 1134 | ||
@@ -1093,7 +1144,8 @@ void LLGLState::checkTextureChannels(const std::string& msg) | |||
1093 | "GL_TEXTURE_GEN_S", | 1144 | "GL_TEXTURE_GEN_S", |
1094 | "GL_TEXTURE_GEN_T", | 1145 | "GL_TEXTURE_GEN_T", |
1095 | "GL_TEXTURE_GEN_Q", | 1146 | "GL_TEXTURE_GEN_Q", |
1096 | "GL_TEXTURE_GEN_R" | 1147 | "GL_TEXTURE_GEN_R", |
1148 | "GL_TEXTURE_RECTANGLE_ARB" | ||
1097 | }; | 1149 | }; |
1098 | 1150 | ||
1099 | static GLint value[] = | 1151 | static GLint value[] = |
@@ -1105,7 +1157,8 @@ void LLGLState::checkTextureChannels(const std::string& msg) | |||
1105 | GL_TEXTURE_GEN_S, | 1157 | GL_TEXTURE_GEN_S, |
1106 | GL_TEXTURE_GEN_T, | 1158 | GL_TEXTURE_GEN_T, |
1107 | GL_TEXTURE_GEN_Q, | 1159 | GL_TEXTURE_GEN_Q, |
1108 | GL_TEXTURE_GEN_R | 1160 | GL_TEXTURE_GEN_R, |
1161 | GL_TEXTURE_RECTANGLE_ARB | ||
1109 | }; | 1162 | }; |
1110 | 1163 | ||
1111 | GLint stackDepth = 0; | 1164 | GLint stackDepth = 0; |
@@ -1133,7 +1186,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) | |||
1133 | LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL; | 1186 | LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL; |
1134 | } | 1187 | } |
1135 | 1188 | ||
1136 | for (S32 j = (i == 0 ? 1 : 0); j < 8; j++) | 1189 | for (S32 j = (i == 0 ? 1 : 0); j < 9; j++) |
1137 | { | 1190 | { |
1138 | if (glIsEnabled(value[j])) | 1191 | if (glIsEnabled(value[j])) |
1139 | { | 1192 | { |
@@ -1141,6 +1194,18 @@ void LLGLState::checkTextureChannels(const std::string& msg) | |||
1141 | LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL; | 1194 | LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL; |
1142 | } | 1195 | } |
1143 | } | 1196 | } |
1197 | |||
1198 | glh::matrix4f mat; | ||
1199 | glh::matrix4f identity; | ||
1200 | identity.identity(); | ||
1201 | |||
1202 | glGetFloatv(GL_TEXTURE_MATRIX, mat.m); | ||
1203 | |||
1204 | if (mat != identity) | ||
1205 | { | ||
1206 | error = TRUE; | ||
1207 | LL_WARNS("RenderState") << "Texture matrix " << i << " is not identity." << LL_ENDL; | ||
1208 | } | ||
1144 | } | 1209 | } |
1145 | 1210 | ||
1146 | gGL.getTexUnit(0)->activate(); | 1211 | gGL.getTexUnit(0)->activate(); |
@@ -1262,6 +1327,22 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) | |||
1262 | glClientActiveTextureARB(GL_TEXTURE0_ARB); | 1327 | glClientActiveTextureARB(GL_TEXTURE0_ARB); |
1263 | gGL.getTexUnit(0)->activate(); | 1328 | gGL.getTexUnit(0)->activate(); |
1264 | 1329 | ||
1330 | if (gGLManager.mHasVertexShader) | ||
1331 | { //make sure vertex attribs are all disabled | ||
1332 | GLint count; | ||
1333 | glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &count); | ||
1334 | for (GLint i = 0; i < count; i++) | ||
1335 | { | ||
1336 | GLint enabled; | ||
1337 | glGetVertexAttribivARB((GLuint) i, GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB, &enabled); | ||
1338 | if (enabled) | ||
1339 | { | ||
1340 | error = TRUE; | ||
1341 | LL_WARNS("RenderState") << "GL still has vertex attrib array " << i << " enabled." << LL_ENDL; | ||
1342 | } | ||
1343 | } | ||
1344 | } | ||
1345 | |||
1265 | if (error) | 1346 | if (error) |
1266 | { | 1347 | { |
1267 | LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL; | 1348 | LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL; |
@@ -1647,6 +1728,7 @@ void LLGLNamePool::cleanupPools() | |||
1647 | LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, GLenum depth_func) | 1728 | LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, GLenum depth_func) |
1648 | : mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled) | 1729 | : mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled) |
1649 | { | 1730 | { |
1731 | stop_glerror(); | ||
1650 | if (depth_enabled != sDepthEnabled) | 1732 | if (depth_enabled != sDepthEnabled) |
1651 | { | 1733 | { |
1652 | gGL.flush(); | 1734 | gGL.flush(); |