diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake
index 4aa8aee7db287c4d7beb55962f39e6f5875440ca..654cc0419ba05a8b2752ab6b17346c5af8bf5498 100644
--- a/indra/cmake/LLPrimitive.cmake
+++ b/indra/cmake/LLPrimitive.cmake
@@ -6,7 +6,7 @@ include(Prebuilt)
 include(Boost)
 include(LibXML2)
 include(URIPARSER)
-include(ZLIB)
+include(ZLIBNG)
 
 use_prebuilt_binary(colladadom)
 use_prebuilt_binary(minizip-ng) # needed for colladadom
@@ -25,7 +25,7 @@ if (WINDOWS)
         ${LIBXML2_LIBRARIES}
         ${URIPARSER_LIBRARIES}
         ${MINIZIP_LIBRARIES}
-        ${ZLIB_LIBRARIES}
+        ${ZLIBNG_LIBRARIES}
         )
 elseif (DARWIN)
     set(LLPRIMITIVE_LIBRARIES 
@@ -37,7 +37,7 @@ elseif (DARWIN)
         ${LIBXML2_LIBRARIES}
         ${URIPARSER_LIBRARIES}
         ${MINIZIP_LIBRARIES}
-        ${ZLIB_LIBRARIES}
+        ${ZLIBNG_LIBRARIES}
         )
 elseif (LINUX)
     set(LLPRIMITIVE_LIBRARIES 
@@ -49,7 +49,7 @@ elseif (LINUX)
         ${LIBXML2_LIBRARIES}
         ${URIPARSER_LIBRARIES}
         ${MINIZIP_LIBRARIES}
-        ${ZLIB_LIBRARIES}
+        ${ZLIBNG_LIBRARIES}
         )
 endif (WINDOWS)
 
diff --git a/indra/cmake/Sentry.cmake b/indra/cmake/Sentry.cmake
index 8df371de2a83eefa73f353bce9f13ef712718abe..4cf0fce0bf31a56118e44c38534a7cc1dd36f440 100644
--- a/indra/cmake/Sentry.cmake
+++ b/indra/cmake/Sentry.cmake
@@ -13,14 +13,14 @@ if (USE_SENTRY)
             include(CURL)
             include(NGHTTP2)
             include(OpenSSL)
-            include(ZLIB)
+            include(ZLIBNG)
             set(SENTRY_LIBRARIES 
                 ${ARCH_PREBUILT_DIRS_RELEASE}/libsentry.a
                 ${ARCH_PREBUILT_DIRS_RELEASE}/libbreakpad_client.a
                 ${CURL_LIBRARIES}
                 ${NGHTTP2_LIBRARIES}
                 ${OPENSSL_LIBRARIES}
-                ${ZLIB_LIBRARIES})
+                ${ZLIBNG_LIBRARIES})
         endif ()
     else ()
         find_package(Sentry REQUIRED)
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 1b3bd4a5c3e9985da32c83626cb70d57b335bd50..3a28f521d5474a0d1e512befc6f0b501167f119c 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -40,7 +40,7 @@
 #ifdef LL_USESYSTEMLIBS
 # include <zlib.h>
 #else
-# include "zlib-ng/zlib.h"  // for davep's dirty little zip functions
+# include "zlib/zlib.h"  // for davep's dirty little zip functions
 #endif
 
 #if !LL_WINDOWS
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 94255960f526127b9d293213224558e750b8d99c..867db04d5392f6823c5fcbb087ffc529cd561038 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -32,7 +32,7 @@
 #ifdef LL_USESYSTEMLIBS
 # include <zlib.h>
 #else
-# include "zlib-ng/zlib.h"
+# include "zlib/zlib.h"
 #endif
 
 #include "llprocessor.h"
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 83a20c299c67b187bf03046bc0b365e641c67cfd..63b3b6d9b1e03c405f1c51d0353178e7052c45de 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -36,7 +36,7 @@
 #ifdef LL_USESYSTEMLIBS
 # include <zlib.h>
 #else
-# include "zlib-ng/zlib.h"
+# include "zlib/zlib.h"
 #endif
 
 std::string model_names[] =
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 1efb39fc0f39018923d9981eb80b2eb188421ce1..b8ad8c4cfb5207ad59a181fbe3385ae0d36760b6 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -169,6 +169,7 @@ LLGLManager::LLGLManager() :
 	mHasOcclusionQuery2(FALSE),
 	mHasPointParameters(FALSE),
 	mHasDrawBuffers(FALSE),
+	mHasDepthClamp(FALSE),
 	mHasTextureRectangle(FALSE),
 	mHasTextureMultisample(FALSE),
 	mHasTransformFeedback(FALSE),
@@ -797,7 +798,7 @@ void LLGLManager::initExtensions()
 	mHasMapBufferRange = mGLVersion >= 3.0f || epoxy_has_gl_extension("GL_ARB_map_buffer_range");
 	mHasFlushBufferRange = epoxy_has_gl_extension("GL_APPLE_flush_buffer_range");
     // NOTE: Using extensions breaks reflections when Shadows are set to projector.  See: SL-16727
-	mHasDepthClamp = mGLVersion >= 3.2f || (epoxy_has_gl_extension("GL_ARB_depth_clamp") || epoxy_has_gl_extension("GL_NV_depth_clamp"));
+	//mHasDepthClamp = mGLVersion >= 3.2f || (epoxy_has_gl_extension("GL_ARB_depth_clamp") || epoxy_has_gl_extension("GL_NV_depth_clamp"));
 	// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
 #ifdef GL_ARB_framebuffer_object
 	mHasFramebufferObject = mGLVersion >= 3.0f || epoxy_has_gl_extension("GL_ARB_framebuffer_object");
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 5b03807e69d63c0ffb90fc538314093e8d2009d2..085e1835ba5f05bf661e3c12b471f3660ee41282 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -75,7 +75,7 @@ include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_BINARY_DIR}
     ${DBUSGLIB_INCLUDE_DIRS}
-    ${ZLIB_INCLUDE_DIRS}
+    ${ZLIBNG_INCLUDE_DIRS}
     ${LIBXML2_INCLUDE_DIRS}
     ${LLAUDIO_INCLUDE_DIRS}
     ${LLCHARACTER_INCLUDE_DIRS}
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 56c32733346b2d764e5777baf66463b860d6d8e1..6002e66552987888cc4c022e4c0a5b4455b6831d 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1613,16 +1613,10 @@ void LLEnvironment::update(const LLViewerCamera * cam)
         end_shaders = LLViewerShaderMgr::instance()->endShaders();
         for (shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
         {
-			if ((shaders_iter->mProgramObject != 0) &&
-				(shaders_iter->mFeatures.atmosphericHelpers
-					|| shaders_iter->mFeatures.calculatesAtmospherics
-					|| shaders_iter->mFeatures.hasAtmospherics
-					|| shaders_iter->mFeatures.hasGamma
-					|| shaders_iter->mFeatures.hasTransport
-					|| shaders_iter->mFeatures.hasWaterFog) &&
-				(gPipeline.canUseWindLightShaders()
-					|| shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER))
-			{
+            if ((shaders_iter->mProgramObject != 0)
+                && (gPipeline.canUseWindLightShaders()
+                || shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER))
+            {
                 shaders_iter->mUniformsDirty = TRUE;
             }
         }
@@ -2623,7 +2617,7 @@ void LLEnvironment::setExperienceEnvironment(LLUUID experience_id, LLSD data, F3
 
     if (!water.isUndefined())
     {
-        environment->injectWaterSettings(sky, experience_id, LLSettingsBase::Seconds(transition_time));
+        environment->injectWaterSettings(water, experience_id, LLSettingsBase::Seconds(transition_time));
     }
 
     if (updateenvironment)
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 39187a73886d4e121e17e7d8c71b5dc5688521fc..6e64cc5660ecefa86c016459683ed0a368934679 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -738,6 +738,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
     //F32 display_gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
 
     shader->uniform1f(LLShaderMgr::GAMMA, g);
+    //shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, display_gamma);
 }
 
 const LLSettingsSky::parammapping_t& LLSettingsVOSky::getParameterMap() const
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 78cf3f61055404d654ad7b0f3c78c74113d1d602..1564a3ba10a7bcaa944d3198affc545a2dbb8005 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -4222,7 +4222,6 @@ void handle_object_sit(LLViewerObject *object, const LLVector3 &offset)
 			gRlvHandler.setSitSource(gAgent.getPositionGlobal());
 		}
 // [/RLVa:KB]
-	{
 
 		gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
 		gMessageSystem->nextBlockFast(_PREHASH_AgentData);
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 9d6c473157444817b99f3de3f69d74bd900595e3..0d6b689e43554435713d021c3bde3ed41602fbb7 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -72,7 +72,7 @@
 #ifdef LL_USESYSTEMLIBS
 #include <zlib.h>
 #else
-#include "zlib-ng/zlib.h"
+#include "zlib/zlib.h"
 #endif
 #include "object_flags.h"
 
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 1fb4a9642df7ab78fc61ffe702f332afa5d3e7b7..0c11d68d92c61b7718544fb9f41415a820d9aa09 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -64,7 +64,7 @@ namespace
 	constexpr S32 NUM_TILES_X = 8;
 	constexpr S32 NUM_TILES_Y = 4;
 	constexpr S32 NUM_TILES = NUM_TILES_X * NUM_TILES_Y;
-	constexpr S32 NUM_CUBEMAP_FACES = 6; // See sResolution for face dimensions
+	constexpr S32 NUM_CUBEMAP_FACES = 6; // See SKYTEX_RESOLUTION for face dimensions
 	constexpr S32 TOTAL_TILES = NUM_CUBEMAP_FACES * NUM_TILES;
 	constexpr S32 MAX_TILES = TOTAL_TILES + 1;
 
@@ -75,9 +75,9 @@ namespace
 
 // Texture coordinates:
     const LLVector2 TEX00 = LLVector2(0.f, 0.f);
-	const LLVector2 TEX01 = LLVector2(0.f, 1.f);
-	const LLVector2 TEX10 = LLVector2(1.f, 0.f);
-	const LLVector2 TEX11 = LLVector2(1.f, 1.f);
+    const LLVector2 TEX01 = LLVector2(0.f, 1.f);
+    const LLVector2 TEX10 = LLVector2(1.f, 0.f);
+    const LLVector2 TEX11 = LLVector2(1.f, 1.f);
 
 	constexpr F32Seconds UPDATE_EXPRY(0.25f);
 
@@ -89,6 +89,7 @@ namespace
 
 S32 LLSkyTex::sCurrent = 0;
 
+
 LLSkyTex::LLSkyTex() :
 	mSkyData(NULL),
 	mSkyDirs(NULL),
@@ -567,11 +568,11 @@ void LLVOSky::restoreGL()
 
 	const LLSettingsSky::ptr_t& psky = LLEnvironment::instance().getCurrentSky();
 
-	if (psky)
+    if (psky)
 	{
-		setSunTextures(psky->getSunTextureId(), psky->getNextSunTextureId());
-		setMoonTextures(psky->getMoonTextureId(), psky->getNextMoonTextureId());
-	}
+        setSunTextures(psky->getSunTextureId(), psky->getNextSunTextureId());
+        setMoonTextures(psky->getMoonTextureId(), psky->getNextMoonTextureId());
+    }
 
 	updateDirections(psky);
 
@@ -580,7 +581,7 @@ void LLVOSky::restoreGL()
 		initCubeMap();
 	}
 
-	forceSkyUpdate();
+    forceSkyUpdate();
 
 	if (mDrawable)
 	{
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 7275e19f9f45d37a51f5a711fac2755f268a17c1..b04ceff9107490ebc068103a8ed3272acca9d9e3 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -6822,7 +6822,7 @@ void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& verte
 
         if (drawablep->isAnimating())
         { //fall back to stream draw for animating verts
-            usage = GL_STREAM_DRAW_ARB;
+            usage = GL_STREAM_DRAW;
         }
     }
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 87946345ca86030922c7de1192e1ec43a9338911..0096af875c0750c1ff7b0d03b03320c6b31c5547 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4704,7 +4704,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 			}
 		}
 
-		LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
+		LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
 
 		LLVertexBuffer::unbind();
 
@@ -11192,11 +11192,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar)
 			for(auto attachment_iter = avatar->mAttachedObjectsVector.begin(), attachment_end = avatar->mAttachedObjectsVector.end();
 				attachment_iter != attachment_end;++attachment_iter)
 			{{
-				LLViewerObject* attached_object = attachment_iter->first
+				LLViewerObject* attached_object = attachment_iter->first;
 #endif
                     if (attached_object && attached_object->isRiggedMesh())
                     {
-                        markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera);
+                        markVisible(attached_object->mDrawable->getSpatialBridge(), viewer_camera);
                     }
                 }
             }
@@ -11216,7 +11216,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar)
                     LLViewerObject* attached_object = attachment_iter->get();
                     if (attached_object)
                     {
-                        markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera);
+                        markVisible(attached_object->mDrawable->getSpatialBridge(), viewer_camera);
                     }
                 }
             }