From 88c0a4d7be265784aeb6010e42df8632dbf8f88b Mon Sep 17 00:00:00 2001
From: McCabe Maxsted
Date: Sat, 1 May 2010 03:32:22 -0700
Subject: Applied patch by Aleric Inglewood for VWR-12984: Water flickers and
disappears in patches, part 1
---
linden/indra/llrender/llgl.cpp | 30 ++-
linden/indra/llrender/llgl.h | 7 +-
linden/indra/llrender/llglheaders.h | 10 +
linden/indra/newview/app_settings/settings.xml | 11 +
linden/indra/newview/lldrawable.cpp | 2 +
linden/indra/newview/lldrawpool.cpp | 1 +
linden/indra/newview/lldrawpool.h | 1 +
linden/indra/newview/lldrawpoolground.cpp | 2 +-
linden/indra/newview/lldrawpoolsky.cpp | 2 +-
linden/indra/newview/lldrawpoolwater.cpp | 23 +-
linden/indra/newview/lldrawpoolwlsky.cpp | 2 +-
linden/indra/newview/llfloatergodtools.cpp | 18 +-
linden/indra/newview/llspatialpartition.cpp | 27 +-
linden/indra/newview/llspatialpartition.h | 8 +-
linden/indra/newview/llsurface.cpp | 5 +
linden/indra/newview/llviewerdisplay.cpp | 3 +-
linden/indra/newview/llviewerobject.cpp | 3 +
linden/indra/newview/llviewerobject.h | 19 +-
linden/indra/newview/llviewerregion.cpp | 1 +
linden/indra/newview/llviewerregion.h | 1 +
linden/indra/newview/llviewerwindow.cpp | 5 +
linden/indra/newview/llvosurfacepatch.cpp | 2 +-
linden/indra/newview/llvowater.cpp | 27 +-
linden/indra/newview/llvowater.h | 20 +-
linden/indra/newview/llworld.cpp | 355 +++++++++++++++++++------
linden/indra/newview/llworld.h | 1 +
linden/indra/newview/pipeline.cpp | 55 ++--
linden/indra/newview/pipeline.h | 3 +-
28 files changed, 477 insertions(+), 167 deletions(-)
(limited to 'linden')
diff --git a/linden/indra/llrender/llgl.cpp b/linden/indra/llrender/llgl.cpp
index 61194c4..c08ad0d 100644
--- a/linden/indra/llrender/llgl.cpp
+++ b/linden/indra/llrender/llgl.cpp
@@ -552,41 +552,46 @@ extern LLCPUInfo gSysCPU;
void LLGLManager::initExtensions()
{
#if LL_MESA_HEADLESS
-# if GL_ARB_multitexture
+# ifdef GL_ARB_multitexture
mHasMultitexture = TRUE;
# else
mHasMultitexture = FALSE;
# endif
-# if GL_ARB_texture_env_combine
- mHasARBEnvCombine = TRUE;
+# ifdef GL_ARB_texture_env_combine
+ mHasARBEnvCombine = TRUE;
# else
mHasARBEnvCombine = FALSE;
# endif
-# if GL_ARB_texture_compression
+# ifdef GL_ARB_texture_compression
mHasCompressedTextures = TRUE;
# else
mHasCompressedTextures = FALSE;
# endif
-# if GL_ARB_vertex_buffer_object
+# ifdef GL_ARB_vertex_buffer_object
mHasVertexBufferObject = TRUE;
# else
mHasVertexBufferObject = FALSE;
# endif
-# if GL_EXT_framebuffer_object
+# ifdef GL_EXT_framebuffer_object
mHasFramebufferObject = TRUE;
# else
mHasFramebufferObject = FALSE;
# endif
-# if GL_EXT_framebuffer_multisample
+# ifdef GL_EXT_framebuffer_multisample
mHasFramebufferMultisample = TRUE;
# else
mHasFramebufferMultisample = FALSE;
# endif
-# if GL_ARB_draw_buffers
+# ifdef GL_ARB_draw_buffers
mHasDrawBuffers = TRUE;
#else
mHasDrawBuffers = FALSE;
# endif
+# if defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
+ mHasDepthClamp = TRUE;
+#else
+ mHasDepthClamp = FALSE;
+#endif
mHasMipMapGeneration = FALSE;
mHasSeparateSpecularColor = FALSE;
mHasAnisotropic = FALSE;
@@ -612,6 +617,7 @@ void LLGLManager::initExtensions()
&& ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
mHasFramebufferMultisample = mHasFramebufferObject && ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts);
mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
+ mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts);
#if !LL_DARWIN
mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
#endif
@@ -634,6 +640,7 @@ void LLGLManager::initExtensions()
mHasFramebufferObject = FALSE;
mHasFramebufferMultisample = FALSE;
mHasDrawBuffers = FALSE;
+ mHasDepthClamp = FALSE;
mHasMipMapGeneration = FALSE;
mHasSeparateSpecularColor = FALSE;
mHasAnisotropic = FALSE;
@@ -685,10 +692,11 @@ void LLGLManager::initExtensions()
if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S
if (strchr(blacklist,'r')) mHasDrawBuffers = FALSE;//S
if (strchr(blacklist,'s')) mHasFramebufferMultisample = FALSE;
+ if (strchr(blacklist,'t')) mHasDepthClamp = FALSE;
}
#endif // LL_LINUX || LL_SOLARIS
-
+
if (!mHasMultitexture)
{
LL_INFOS("RenderInit") << "Couldn't initialize multitexturing" << LL_ENDL;
@@ -1773,7 +1781,7 @@ LLGLDepthTest::~LLGLDepthTest()
}
}
-LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P)
+LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P)
{
for (U32 i = 0; i < 4; i++)
{
@@ -1786,7 +1794,7 @@ LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P)
glMatrixMode(GL_MODELVIEW);
}
-LLGLClampToFarClip::~LLGLClampToFarClip()
+LLGLSquashToFarClip::~LLGLSquashToFarClip()
{
glMatrixMode(GL_PROJECTION);
glPopMatrix();
diff --git a/linden/indra/llrender/llgl.h b/linden/indra/llrender/llgl.h
index 00ff1e2..cc7ebff 100644
--- a/linden/indra/llrender/llgl.h
+++ b/linden/indra/llrender/llgl.h
@@ -88,6 +88,7 @@ public:
BOOL mHasOcclusionQuery;
BOOL mHasPointParameters;
BOOL mHasDrawBuffers;
+ BOOL mHasDepthClamp;
// Other extensions.
BOOL mHasAnisotropic;
@@ -306,11 +307,11 @@ private:
leaves this class.
Does not stack.
*/
-class LLGLClampToFarClip
+class LLGLSquashToFarClip
{
public:
- LLGLClampToFarClip(glh::matrix4f projection);
- ~LLGLClampToFarClip();
+ LLGLSquashToFarClip(glh::matrix4f projection);
+ ~LLGLSquashToFarClip();
};
/*
diff --git a/linden/indra/llrender/llglheaders.h b/linden/indra/llrender/llglheaders.h
index c7178a5..9e3ae9d 100644
--- a/linden/indra/llrender/llglheaders.h
+++ b/linden/indra/llrender/llglheaders.h
@@ -819,5 +819,15 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
#endif // LL_MESA / LL_WINDOWS / LL_DARWIN
+// Even when GL_ARB_depth_clamp is available in the driver, the (correct)
+// headers, and therefore GL_DEPTH_CLAMP might not be defined.
+// In that case GL_DEPTH_CLAMP_NV should be defined, but why not just
+// use the known numeric.
+//
+// To avoid #ifdef's in the code. Just define this here.
+#ifndef GL_DEPTH_CLAMP
+// Probably (still) called GL_DEPTH_CLAMP_NV.
+#define GL_DEPTH_CLAMP 0x864F
+#endif
#endif // LL_LLGLHEADERS_H
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index bd4e05c..966b1af 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -9840,6 +9840,17 @@
Value
0
+ RenderWaterVoidCulling
+
RotateRight