diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 54a41c9d23c0af759d00e1d514de480dc8160216..d18512f6133e437256ffb735ec11d1ca3d0e3868 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -999,6 +999,12 @@ void LLGLManager::initExtensions()
 	mHassRGBFramebuffer = ExtensionExists("GL_EXT_framebuffer_sRGB", gGLHExts.mSysExts);
 #endif
 	
+#ifdef GL_EXT_texture_sRGB_decode
+    mHasTexturesRGBDecode = ExtensionExists("GL_EXT_texture_sRGB_decode", gGLHExts.mSysExts);
+#else
+    mHasTexturesRGBDecode = ExtensionExists("GL_ARB_texture_sRGB_decode", gGLHExts.mSysExts);
+#endif
+
 	mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f;
 
 	mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 362fda5fb1050ddfa57d3a7784a02dacf727baf1..a7faea7d3315396f5e875e192fa0364f7ae99b90 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -118,6 +118,7 @@ class LLGLManager
 	BOOL mHasDebugOutput;
 	BOOL mHassRGBTexture;
 	BOOL mHassRGBFramebuffer;
+    BOOL mHasTexturesRGBDecode;
 
 	// Vendor-specific extensions
 	BOOL mIsATI;
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 8f3a56e1cf1b1be53db72ce541df6640459c1059..f8b5dd0559a2129b0a5a32216fd5d6881db8c032 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -974,7 +974,7 @@ S32 LLGLSLShader::unbindTexture(S32 uniform, LLTexUnit::eTextureType mode)
     return uniform;
 }
 
-S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
+S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode, LLTexUnit::eTextureColorSpace space)
 {
     if (uniform < 0 || uniform >= (S32)mTexture.size())
     {
@@ -986,11 +986,12 @@ S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
     {
         gGL.getTexUnit(index)->activate();
         gGL.getTexUnit(index)->enable(mode);
+        gGL.getTexUnit(index)->setTextureColorSpace(space);
     }
     return index;
 }
 
-S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode)
+S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode, LLTexUnit::eTextureColorSpace space)
 {
     if (uniform < 0 || uniform >= (S32)mTexture.size())
     {
@@ -1000,7 +1001,7 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode)
     S32 index = mTexture[uniform];
     if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE)
     {
-        if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode)
+        if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode && gGL.getTexUnit(index)->getCurrColorSpace() != space)
         {
             if (gDebugSession)
             {
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index c1ce3d3aad8588816b4ce0d93a9887923f907dfb..974d0ea005cff2f697f343a0fd4f6539b4f4efca 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -153,8 +153,8 @@ class LLGLSLShader
 	//if given texture uniform is active in the shader, 
 	//the corresponding channel will be active upon return
 	//returns channel texture is enabled in from [0-MAX)
-	S32 enableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
-	S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
+	S32 enableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE, LLTexUnit::eTextureColorSpace space = LLTexUnit::TCS_LINEAR);
+    S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE, LLTexUnit::eTextureColorSpace space = LLTexUnit::TCS_LINEAR);
 	
 	// bindTexture returns the texture unit we've bound the texture to.
 	// You can reuse the return value to unbind a texture when required.
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 2d526a211310558d45686fc825640c231e98746d..2f1f702d2c5979af8ad699dcf273e93322cd51e1 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1370,33 +1370,45 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
 
 	if( !mHasExplicitFormat )
 	{
-		switch (mComponents)
-		{
-			case 1:
-			// Use luminance alpha (for fonts)
-			mFormatInternal = GL_LUMINANCE8;
-			mFormatPrimary = GL_LUMINANCE;
-			mFormatType = GL_UNSIGNED_BYTE;
-			break;
-			case 2:
-			// Use luminance alpha (for fonts)
-			mFormatInternal = GL_LUMINANCE8_ALPHA8;
-			mFormatPrimary = GL_LUMINANCE_ALPHA;
-			mFormatType = GL_UNSIGNED_BYTE;
-			break;
-			case 3:
-			mFormatInternal = GL_RGB8;
-			mFormatPrimary = GL_RGB;
-			mFormatType = GL_UNSIGNED_BYTE;
-			break;
-			case 4:
-			mFormatInternal = GL_RGBA8;
-			mFormatPrimary = GL_RGBA;
-			mFormatType = GL_UNSIGNED_BYTE;
-			break;
-			default:
-			LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL;
-		}
+        switch (mComponents)
+        {
+        case 1:
+            // Use luminance alpha (for fonts)
+            mFormatInternal = GL_LUMINANCE8;
+            mFormatPrimary = GL_LUMINANCE;
+            mFormatType = GL_UNSIGNED_BYTE;
+            break;
+        case 2:
+            // Use luminance alpha (for fonts)
+            mFormatInternal = GL_LUMINANCE8_ALPHA8;
+            mFormatPrimary = GL_LUMINANCE_ALPHA;
+            mFormatType = GL_UNSIGNED_BYTE;
+            break;
+        case 3:
+            if (gGLManager.mHasTexturesRGBDecode)
+            {
+                mFormatInternal = GL_SRGB8;
+            }
+            else {
+                mFormatInternal = GL_RGB8;
+            }
+            mFormatPrimary = GL_RGB;
+            mFormatType = GL_UNSIGNED_BYTE;
+            break;
+        case 4:
+            if (gGLManager.mHasTexturesRGBDecode)
+            {
+                mFormatInternal = GL_SRGB8_ALPHA8;
+            }
+            else {
+                mFormatInternal = GL_RGBA8;
+            }
+            mFormatPrimary = GL_RGBA;
+            mFormatType = GL_UNSIGNED_BYTE;
+            break;
+        default:
+            LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL;
+        }
 
 		calcAlphaChannelOffsetAndStride() ;
 	}
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 2bf7ad9902e7bd31f8823d7206368264b1f50d74..5dc61d0e8f997bfed1e707b2252b23c262b9f33e 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -105,7 +105,7 @@ LLTexUnit::LLTexUnit(S32 index)
 	mCurrColorOp(TBO_MULT), mCurrAlphaOp(TBO_MULT),
 	mCurrColorSrc1(TBS_TEX_COLOR), mCurrColorSrc2(TBS_PREV_COLOR),
 	mCurrAlphaSrc1(TBS_TEX_ALPHA), mCurrAlphaSrc2(TBS_PREV_ALPHA),
-	mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0),
+    mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), mTexColorSpace(TCS_LINEAR),
 	mHasMipMaps(false),
 	mIndex(index)
 {
@@ -162,6 +162,8 @@ void LLTexUnit::refreshState(void)
 		setTextureCombiner(mCurrColorOp, mCurrColorSrc1, mCurrColorSrc2, false);
 		setTextureCombiner(mCurrAlphaOp, mCurrAlphaSrc1, mCurrAlphaSrc2, true);
 	}
+
+    setTextureColorSpace(mTexColorSpace);
 }
 
 void LLTexUnit::activate(void)
@@ -191,7 +193,6 @@ void LLTexUnit::enable(eTextureType type)
 			stop_glerror();
 		}
 		mCurrTexType = type;
-
 		gGL.flush();
 		if (!LLGLSLShader::sNoFixedFunction && 
 			type != LLTexUnit::TT_MULTISAMPLE_TEXTURE &&
@@ -219,6 +220,8 @@ void LLTexUnit::disable(void)
 		{
 			glDisable(sGLTextureType[mCurrTexType]);
 		}
+
+        setTextureColorSpace(TCS_LINEAR);
 		
 		mCurrTexType = TT_NONE;
 	}
@@ -255,7 +258,8 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)
 						gl_tex->mTexOptionsDirty = false;
 						setTextureAddressMode(gl_tex->mAddressMode);
 						setTextureFilteringOption(gl_tex->mFilterOption);
-					}
+                    }
+                    setTextureColorSpace(mTexColorSpace);
 				}
 			}
 			else
@@ -330,6 +334,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
 			setTextureFilteringOption(texture->mFilterOption);
 			stop_glerror();
 		}
+        setTextureColorSpace(mTexColorSpace);
 	}
 
 	stop_glerror();
@@ -355,7 +360,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
 		{
 			activate();
 			enable(LLTexUnit::TT_CUBE_MAP);
-			mCurrTexture = cubeMap->mImages[0]->getTexName();
+            mCurrTexture = cubeMap->mImages[0]->getTexName();
 			glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture);
 			mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps;
 			cubeMap->mImages[0]->updateBindStats(cubeMap->mImages[0]->mTextureMemory);
@@ -364,7 +369,8 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
 				cubeMap->mImages[0]->mTexOptionsDirty = false;
 				setTextureAddressMode(cubeMap->mImages[0]->mAddressMode);
 				setTextureFilteringOption(cubeMap->mImages[0]->mFilterOption);
-			}
+            }
+            setTextureColorSpace(mTexColorSpace);
 			return true;
 		}
 		else
@@ -415,7 +421,8 @@ bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips)
 		enable(type);
 		mCurrTexture = texture;
 		glBindTexture(sGLTextureType[type], texture);
-		mHasMipMaps = hasMips;
+        mHasMipMaps = hasMips;
+        setTextureColorSpace(mTexColorSpace);
 	}
 	return true;
 }
@@ -435,6 +442,9 @@ void LLTexUnit::unbind(eTextureType type)
 	if (mCurrTexType == type)
 	{
 		mCurrTexture = 0;
+
+        // Always make sure our texture color space is reset to linear.  SRGB sampling should be opt-in in the vast majority of cases.  Also prevents color space "popping".
+        mTexColorSpace = TCS_LINEAR;
 		if (LLGLSLShader::sNoFixedFunction && type == LLTexUnit::TT_TEXTURE)
 		{
 			glBindTexture(sGLTextureType[type], sWhiteTexture);
@@ -838,6 +848,23 @@ void LLTexUnit::debugTextureUnit(void)
 	}
 }
 
+void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) {
+    mTexColorSpace = space;
+    if (gGLManager.mHasTexturesRGBDecode) {
+
+        if (space == TCS_SRGB) {
+            glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
+        }
+        else {
+            glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
+        }
+
+        if (gDebugGL) {
+            assert_glerror();
+        }
+    }
+}
+
 LLLightState::LLLightState(S32 index)
 : mIndex(index),
   mEnabled(false),
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index ad9cd11283d1a133bd835f8db9bd945e7f8563f5..41f4fe40176620087a214303dd732498ed7b0e06 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -131,6 +131,12 @@ class LLTexUnit
 		TBS_ONE_MINUS_CONST_ALPHA
 	} eTextureBlendSrc;
 
+    typedef enum
+    {
+        TCS_LINEAR = 0,
+        TCS_SRGB
+    } eTextureColorSpace;
+
 	LLTexUnit(S32 index);
 
 	// Refreshes renderer state of the texture unit to the cached values
@@ -153,7 +159,7 @@ class LLTexUnit
 	// Binds the LLImageGL to this texture unit 
 	// (automatically enables the unit for the LLImageGL's texture type)
 	bool bind(LLImageGL* texture, bool for_rendering = false, bool forceBind = false);
-	bool bind(LLTexture* texture, bool for_rendering = false, bool forceBind = false);
+    bool bind(LLTexture* texture, bool for_rendering = false, bool forceBind = false);
 
 	// Binds a cubemap to this texture unit 
 	// (automatically enables the texture unit for cubemaps)
@@ -198,6 +204,10 @@ class LLTexUnit
 
 	void setHasMipMaps(bool hasMips) { mHasMipMaps = hasMips; }
 
+    void setTextureColorSpace(eTextureColorSpace space);
+
+    eTextureColorSpace getCurrColorSpace() { return mTexColorSpace; }
+
 protected:
 	const S32			mIndex;
 	U32					mCurrTexture;
@@ -209,6 +219,7 @@ class LLTexUnit
 	eTextureBlendOp		mCurrAlphaOp;
 	eTextureBlendSrc	mCurrAlphaSrc1;
 	eTextureBlendSrc	mCurrAlphaSrc2;
+    eTextureColorSpace  mTexColorSpace;
 	S32					mCurrColorScale;
 	S32					mCurrAlphaScale;
 	bool				mHasMipMaps;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 57916eb3e5620cf3103e58b82f935a80208e8601..6489508c00726219b296d6ab9b6ff20415d3c68a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -78,7 +78,6 @@ vec3 linear_to_srgb(vec3 cl);
 vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
 {
 	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	ret.rgb = srgb_to_linear(ret.rgb);
 	
 	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
 	
@@ -98,7 +97,6 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
 vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
 {
 	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	ret.rgb = srgb_to_linear(ret.rgb);
 	
 	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
 	
@@ -116,7 +114,6 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
 vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
 {
 	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	ret.rgb = srgb_to_linear(ret.rgb);
 	
 	vec2 dist = tc-vec2(0.5);
 	
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 9e14c03a962a342ce763c242a3cbc96ff8f66d12..ab380f70e82c204c4bf93e674d8e0830ba8cd20a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -83,7 +83,6 @@ vec4 correctWithGamma(vec4 col)
 vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
 {
     vec4 ret = texture2DLod(projectionMap, tc, lod);
-    ret = correctWithGamma(ret);
     
     vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
     
@@ -103,7 +102,6 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
 vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
 {
     vec4 ret = texture2DLod(projectionMap, tc, lod);
-    ret = correctWithGamma(ret);
 
     vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
     
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 93b55ab9c17bea3344e2cc7b0e687080daa1cca7..a9482ea54c13bff175610e5b44ac5bbc6c038263 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -82,7 +82,6 @@ vec4 correctWithGamma(vec4 col)
 vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
 {
 	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	ret = correctWithGamma(ret);
 	
 	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
 	
@@ -102,7 +101,6 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
 vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
 {
 	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	ret = correctWithGamma(ret);
 	
 	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
 	
@@ -120,7 +118,6 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
 vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
 {
 	vec4 ret = texture2DLod(projectionMap, tc, lod);
-	ret = correctWithGamma(ret);
 	
 	vec2 dist = tc-vec2(0.5);
 	
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index f84cd594c953bbb66447eb16959d9fdb6450856c..313edca34527e37b33e76599c6d9e731584a7250 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8145,6 +8145,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
     {
         deferred_target->bindTexture(0,channel);
         gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+        gGL.getTexUnit(channel)->setTextureColorSpace(LLTexUnit::TCS_SRGB);
     }
 
     channel = shader.enableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage());
@@ -8152,6 +8153,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
     {
         deferred_target->bindTexture(1, channel);
         gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+        gGL.getTexUnit(channel)->setTextureColorSpace(LLTexUnit::TCS_SRGB);
     }
 
     channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage());
@@ -8159,6 +8161,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
     {
         deferred_target->bindTexture(2, channel);
         gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+        gGL.getTexUnit(channel)->setTextureColorSpace(LLTexUnit::TCS_LINEAR);
     }
 
     channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage());
@@ -8281,7 +8284,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
 
 	stop_glerror();
 
-	channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+	channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP, LLTexUnit::TCS_SRGB);
 	if (channel > -1)
 	{
 		LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
@@ -8779,7 +8782,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
 
                 mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 
-                gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+                gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB);
 
                 for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter)
                 {
@@ -8807,7 +8810,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
                                         
                     mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
                 }
-                gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+                gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB);
                 unbindDeferredShader(gDeferredSpotLightProgram);
             }
 
@@ -8863,7 +8866,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
                 
                 bindDeferredShader(gDeferredMultiSpotLightProgram);
 
-                gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+                gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB);
 
                 mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 
@@ -8894,7 +8897,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
                     mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
                 }
 
-                gDeferredMultiSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+                gDeferredMultiSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB);
                 unbindDeferredShader(gDeferredMultiSpotLightProgram);
 
                 gGL.popMatrix();
@@ -9139,7 +9142,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
 		img = LLViewerFetchedTexture::sWhiteImagep;
 	}
 
-	S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+	S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB);
 
 	if (channel > -1)
 	{
@@ -9191,7 +9194,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
     shader.disableTexture(LLShaderMgr::DEFERRED_NOISE);
     shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC);
 
-    S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+    S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP, LLTexUnit::TCS_SRGB);
     if (channel > -1)
     {
         LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;