summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.hgtags3
-rw-r--r--indra/llmessage/llavatarnamecache.cpp7
-rw-r--r--indra/llprimitive/lltextureentry.h2
-rw-r--r--indra/llrender/llgl.cpp9
-rw-r--r--indra/llrender/llgl.h2
-rw-r--r--indra/llrender/llshadermgr.cpp3
-rw-r--r--indra/llrender/llshadermgr.h4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl8
-rw-r--r--indra/newview/lldrawpoolalpha.cpp17
-rw-r--r--indra/newview/lldrawpoolbump.cpp2
-rw-r--r--indra/newview/lldrawpoolwater.cpp4
-rw-r--r--indra/newview/llviewerdisplay.cpp2
-rw-r--r--indra/newview/llwlparamset.cpp8
-rw-r--r--indra/newview/pipeline.cpp29
-rw-r--r--indra/newview/pipeline.h3
29 files changed, 140 insertions, 32 deletions
diff --git a/.hgtags b/.hgtags
index 1413f35640..7d6926d967 100755
--- a/.hgtags
+++ b/.hgtags
@@ -391,3 +391,6 @@ cd39255bd23330fd30c04105f2811e941d8524fe 3.4.4-beta2
2c4011bbc2b15b82198fd8b51f3a9fe765a08c4d DRTVWR-271
2f8a3ef687bc55828abcb17ac1ad7cde70536d7e 3.4.4-beta3
35cfd4cf5b895fa776592f2e630e330be7f0604e DRTVWR-273
+c374035d459af3c03dea2dd90880dfc25de64706 DRTVWR-275
+05d9f1dd7a954069af2a33abedb7713fa36a04cb 3.4.4-beta4
+e1bb1ae7d8b12faeb37933a737c199cc9b9f89cc 3.4.4-release
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 700525e1fa..a6e2c89ba4 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -348,7 +348,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
while(!sAskQueue.empty())
{
it = sAskQueue.begin();
- const LLUUID& agent_id = *it;
+ LLUUID agent_id = *it;
sAskQueue.erase(it);
if (url.empty())
@@ -416,7 +416,7 @@ void LLAvatarNameCache::requestNamesViaLegacy()
for (S32 requests = 0; !sAskQueue.empty() && requests < MAX_REQUESTS; ++requests)
{
it = sAskQueue.begin();
- const LLUUID& agent_id = *it;
+ LLUUID agent_id = *it;
sAskQueue.erase(it);
// Mark as pending first, just in case the callback is immediately
@@ -563,8 +563,7 @@ void LLAvatarNameCache::eraseUnrefreshed()
const LLAvatarName& av_name = it->second;
if (av_name.mExpires < max_unrefreshed)
{
- const LLUUID& agent_id = it->first;
- LL_DEBUGS("AvNameCache") << agent_id
+ LL_DEBUGS("AvNameCache") << it->first
<< " user '" << av_name.mUsername << "' "
<< "expired " << now - av_name.mExpires << " secs ago"
<< LL_ENDL;
diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h
index b681ce8ca7..ff1cc65bba 100644
--- a/indra/llprimitive/lltextureentry.h
+++ b/indra/llprimitive/lltextureentry.h
@@ -31,6 +31,7 @@
#include "v4color.h"
#include "llsd.h"
#include "llmaterialid.h"
+#include "llmaterial.h"
// These bits are used while unpacking TEM messages to tell which aspects of
// the texture entry changed.
@@ -197,6 +198,7 @@ protected:
U8 mMediaFlags; // replace with web page, movie, etc.
F32 mGlow;
LLMaterialID mMaterialID;
+ LLMaterialPtr mMaterial;
// Note the media data is not sent via the same message structure as the rest of the TE
LLMediaEntry* mMediaEntry; // The media data for the face
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 0b56b3889c..ab6310f545 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -969,6 +969,15 @@ void LLGLManager::initExtensions()
ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts) &&
ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
#endif
+#ifdef GL_EXT_texture_sRGB
+ mHassRGBTexture = ExtensionExists("GL_EXT_texture_sRGB", gGLHExts.mSysExts);
+#endif
+
+#ifdef GL_ARB_framebuffer_sRGB
+ mHassRGBFramebuffer = ExtensionExists("GL_ARB_framebuffer_sRGB", gGLHExts.mSysExts);
+#else
+ mHassRGBFramebuffer = ExtensionExists("GL_EXT_framebuffer_sRGB", gGLHExts.mSysExts);
+#endif
mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f;
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index d70e764769..1e921d1e97 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -115,6 +115,8 @@ public:
BOOL mHasARBEnvCombine;
BOOL mHasCubeMap;
BOOL mHasDebugOutput;
+ BOOL mHassRGBTexture;
+ BOOL mHassRGBFramebuffer;
// Vendor-specific extensions
BOOL mIsATI;
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 3b1ec281c9..e52411ebe5 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1121,6 +1121,9 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("lightMap");
mReservedUniforms.push_back("bloomMap");
mReservedUniforms.push_back("projectionMap");
+
+ mReservedUniforms.push_back("global_gamma");
+ mReservedUniforms.push_back("texture_gamma");
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 4b93aae735..a711a64919 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -164,6 +164,10 @@ public:
DEFERRED_LIGHT,
DEFERRED_BLOOM,
DEFERRED_PROJECTION,
+
+ GLOBAL_GAMMA,
+ TEXTURE_GAMMA,
+
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index dd87ddb330..ef04ef5ce6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -59,6 +59,7 @@ void main()
vec4 pos = vec4(vary_position, 1.0);
vec4 diff= diffuseLookup(vary_texcoord0.xy);
+ diff.rgb = pow(diff.rgb, vec3(2.2));
vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
vec4 color = diff * col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 36433a5827..b6a9417fe7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -43,6 +43,7 @@ void main()
float shadow = 1.0;
vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
+ color.rgb = pow(color.rgb, vec3(2.2));
color.rgb = fullbrightAtmosTransport(color.rgb);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index bff87cb6aa..53e5a228fa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -70,6 +70,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
@@ -85,6 +87,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
@@ -102,6 +106,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float d = dot(dist,dist);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 6e5ac8317b..fa1572e692 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -108,6 +108,7 @@ void main()
if (spec.a > 0.0)
{
float sa = dot(normalize(lv-normalize(pos)),norm);
+ spec.rgb += pow(1 - dot(-normalize(pos), norm), 2) * da * 3;
if (sa > 0.0)
{
sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index bf362e21a4..3f57b006cd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -37,6 +37,7 @@ uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform float max_cof;
uniform float res_scale;
+uniform float global_gamma;
VARYING vec2 vary_fragcoord;
@@ -123,6 +124,6 @@ void main()
diff /= w;
}
-
+ diff.rgb = pow(diff.rgb, vec3(1.0/global_gamma));
frag_color = diff;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index eb5beeef39..c891c4e445 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -35,12 +35,13 @@ uniform sampler2DRect diffuseRect;
uniform sampler2D bloomMap;
uniform vec2 screen_res;
+uniform float global_gamma;
VARYING vec2 vary_fragcoord;
void main()
{
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
-
+ diff.rgb = pow(diff.rgb, vec3(1.0/global_gamma));
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
frag_color = diff + bloom;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 14eaafeb68..87cdf1026f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -77,6 +77,11 @@ vec3 vary_AtmosAttenuation;
uniform mat4 inv_proj;
uniform vec2 screen_res;
+vec3 samplesRGB(vec3 color)
+{
+ return pow(color, vec3(2.2));
+}
+
vec4 getPosition_d(vec2 pos_screen, float depth)
{
vec2 sc = pos_screen.xy*2.0;
@@ -101,22 +106,21 @@ vec3 getPositionEye()
}
vec3 getSunlitColor()
{
- return vary_SunlitColor;
+ return samplesRGB(vary_SunlitColor) * 4.4;
}
vec3 getAmblitColor()
{
- return vary_AmblitColor;
+ return samplesRGB((vary_AmblitColor)) * 2.2;
}
vec3 getAdditiveColor()
{
- return vary_AdditiveColor;
+ return samplesRGB(vary_AdditiveColor) * 2.2;
}
vec3 getAtmosAttenuation()
{
return vary_AtmosAttenuation;
}
-
void setPositionEye(vec3 v)
{
vary_PositionEye = v;
@@ -310,7 +314,7 @@ void main()
//add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
+ col = mix(col.rgb, samplesRGB(textureCube(environmentMap, env_vec).rgb) * 2.2,
max(spec.a-diffuse.a*2.0, 0.0));
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index cca63872de..9bdf87678f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -72,6 +72,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
@@ -87,6 +89,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
@@ -104,6 +108,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float d = dot(dist,dist);
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
index 6c34643aab..9543be562b 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
@@ -37,6 +37,8 @@ vec3 fullbrightScaleSoftClip(vec3 light);
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
+uniform float texture_gamma;
+
void fullbright_lighting()
{
vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
@@ -45,7 +47,7 @@ void fullbright_lighting()
{
discard;
}
-
+ color.rgb = pow(color.rgb, vec3(texture_gamma));
color.rgb = fullbrightAtmosTransport(color.rgb);
color.rgb = fullbrightScaleSoftClip(color.rgb);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 12706f130b..359864556d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -149,6 +149,7 @@ void main()
}
vec4 diff = diffuseLookup(vary_texcoord0.xy);
+ diff.rgb = pow(diff.rgb, vec3(2.2));
vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a);
vec4 color = diff * col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 5621e47ab7..695887c5ff 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -71,6 +71,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
@@ -86,6 +88,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
@@ -103,6 +107,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float d = dot(dist,dist);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 457189b48e..bf4c476138 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -79,6 +79,11 @@ vec3 vary_AmblitColor;
vec3 vary_AdditiveColor;
vec3 vary_AtmosAttenuation;
+vec3 samplesRGB(vec3 color)
+{
+ return pow(color, vec3(2.2));
+}
+
vec4 getPosition_d(vec2 pos_screen, float depth)
{
vec2 sc = pos_screen.xy*2.0;
@@ -103,15 +108,15 @@ vec3 getPositionEye()
}
vec3 getSunlitColor()
{
- return vary_SunlitColor;
+ return samplesRGB(vary_SunlitColor) * 4.4;
}
vec3 getAmblitColor()
{
- return vary_AmblitColor;
+ return samplesRGB(vary_AmblitColor) * 2.2;
}
vec3 getAdditiveColor()
{
- return vary_AdditiveColor;
+ return samplesRGB(vary_AdditiveColor) * 2.2;
}
vec3 getAtmosAttenuation()
{
@@ -318,7 +323,7 @@ void main()
//add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
+ col = mix(col.rgb, samplesRGB(textureCube(environmentMap, env_vec).rgb) * 2.2,
max(spec.a-diffuse.a*2.0, 0.0));
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 6d6ad6d565..525dd32106 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -71,6 +71,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
@@ -86,6 +88,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
@@ -103,6 +107,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
+
vec2 dist = tc-vec2(0.5);
float d = dot(dist,dist);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
index 765b0927c3..dd7de9f123 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
@@ -27,7 +27,7 @@
VARYING vec3 vary_SunlitColor;
VARYING vec3 vary_AdditiveColor;
VARYING vec3 vary_AtmosAttenuation;
-
+uniform float global_gamma;
vec3 getSunlitColor()
{
return vec3(0,0,0);
@@ -38,7 +38,7 @@ vec3 getAmblitColor()
}
vec3 getAdditiveColor()
{
- return vary_AdditiveColor;
+ return pow(vary_AdditiveColor, vec3(global_gamma)) * global_gamma;
}
vec3 getAtmosAttenuation()
{
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
index 99dbee15ee..61f3088648 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
@@ -33,18 +33,20 @@ vec3 sunlit_color;
vec3 amblit_color;
vec3 position_eye;
+uniform float global_gamma;
+
vec3 getSunlitColor()
{
- return sunlit_color;
+ return pow(sunlit_color, vec3(global_gamma)) * global_gamma;
}
vec3 getAmblitColor()
{
- return amblit_color;
+ return pow(amblit_color, vec3(global_gamma)) * global_gamma;
}
vec3 getAdditiveColor()
{
- return additive_color;
+ return pow(additive_color, vec3(global_gamma)) * global_gamma;
}
vec3 getAtmosAttenuation()
{
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 313b310e1e..33615eb075 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -240,6 +240,12 @@ void LLDrawPoolAlpha::render(S32 pass)
{
fullbright_shader->bind();
fullbright_shader->setMinimumAlpha(0.33f);
+ if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred)
+ {
+ fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
+ } else {
+ fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
+ }
}
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
//LLGLSLShader::bindNoShader();
@@ -423,6 +429,17 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
if (use_shaders)
{
target_shader = fullbright_shader;
+ if (LLPipeline::sRenderDeferred)
+ {
+ if (params.mFace->getViewerObject()->isHUDAttachment())
+ {
+ target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0);
+ } else {
+ target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2);
+ }
+ } else {
+ target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0);
+ }
}
else
{
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index a264eae302..718133ba29 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -153,7 +153,7 @@ void LLStandardBumpmap::addstandard()
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage =
LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP);
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ;
LLStandardBumpmap::sStandardBumpmapCount++;
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 4f6eaa5a5b..9dfd69583e 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -80,7 +80,7 @@ LLDrawPoolWater::LLDrawPoolWater() :
mWaterImagep->setNoDelete();
mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE);
llassert(mOpaqueWaterImagep);
- mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL);
+ mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, TRUE, LLViewerTexture::BOOST_BUMP);
mWaterNormp->setNoDelete();
restoreGL();
@@ -563,7 +563,7 @@ void LLDrawPoolWater::shade()
// change mWaterNormp if needed
if (mWaterNormp->getID() != param_mgr->getNormalMapID())
{
- mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID());
+ mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID(), TRUE, LLViewerTexture::BOOST_BUMP);
}
mWaterNormp->addTextureStats(1024.f*1024.f);
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index d58ee05fb6..feceee5709 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1051,6 +1051,7 @@ void render_hud_attachments()
if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
{
+ LLPipeline::sRenderingHUDs = TRUE;
LLCamera hud_cam = *LLViewerCamera::getInstance();
LLVector3 origin = hud_cam.getOrigin();
hud_cam.setOrigin(-1.f,0,0);
@@ -1124,6 +1125,7 @@ void render_hud_attachments()
gPipeline.toggleRenderDebugFeature((void*) LLPipeline::RENDER_DEBUG_FEATURE_UI);
}
LLPipeline::sUseOcclusion = use_occlusion;
+ LLPipeline::sRenderingHUDs = FALSE;
}
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp
index b04d30db55..0b5e0235ee 100644
--- a/indra/newview/llwlparamset.cpp
+++ b/indra/newview/llwlparamset.cpp
@@ -33,6 +33,7 @@
#include "llglslshader.h"
#include "lluictrlfactory.h"
#include "llsliderctrl.h"
+#include "pipeline.h"
#include <llgl.h>
@@ -127,6 +128,13 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
}
}
}
+
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender)
+ {
+ shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2);
+ } else {
+ shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0);
+ }
}
void LLWLParamSet::set(const std::string& paramName, float x)
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 24144382dc..205598060a 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -377,6 +377,7 @@ BOOL LLPipeline::sRenderDeferred = FALSE;
BOOL LLPipeline::sMemAllocationThrottled = FALSE;
S32 LLPipeline::sVisibleLightCount = 0;
F32 LLPipeline::sMinRenderSize = 0.f;
+BOOL LLPipeline::sRenderingHUDs;
static LLCullResult* sCull = NULL;
@@ -396,7 +397,7 @@ void validate_framebuffer_object();
bool addDeferredAttachments(LLRenderTarget& target)
{
- return target.addColorAttachment(GL_RGBA) && //specular
+ return target.addColorAttachment(GL_SRGB_ALPHA) && //specular
target.addColorAttachment(GL_RGB10_A2); //normal+z
}
@@ -898,11 +899,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
BOOL ssao = RenderDeferredSSAO;
//allocate deferred rendering color buffers
- if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!mDeferredScreen.allocate(resX, resY, GL_SRGB8_ALPHA8, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (!addDeferredAttachments(mDeferredScreen)) return false;
- if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!mScreen.allocate(resX, resY, GL_RGBA12, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (samples > 0)
{
if (!mFXAABuffer.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false;
@@ -3602,8 +3603,8 @@ void LLPipeline::postSort(LLCamera& camera)
for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
{
LLSpatialGroup* group = *i;
- if (sUseOcclusion &&
- group->isOcclusionState(LLSpatialGroup::OCCLUDED) ||
+ if ((sUseOcclusion &&
+ group->isOcclusionState(LLSpatialGroup::OCCLUDED)) ||
(RenderAutoHideSurfaceAreaLimit > 0.f &&
group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit*llmax(group->mObjectBoxSize, 10.f)))
{
@@ -5034,8 +5035,8 @@ void LLPipeline::renderDebug()
LLSpatialPartition* part = region->getSpatialPartition(i);
if (part)
{
- if ( hud_only && (part->mDrawableType == RENDER_TYPE_HUD || part->mDrawableType == RENDER_TYPE_HUD_PARTICLES) ||
- !hud_only && hasRenderType(part->mDrawableType) )
+ if ( (hud_only && (part->mDrawableType == RENDER_TYPE_HUD || part->mDrawableType == RENDER_TYPE_HUD_PARTICLES)) ||
+ (!hud_only && hasRenderType(part->mDrawableType)) )
{
part->renderDebug();
}
@@ -7382,6 +7383,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
mScreen.bindTexture(0, channel);
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
}
+
+ if (!LLViewerCamera::getInstance()->cameraUnderWater())
+ {
+ shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2);
+ } else {
+ shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0);
+ }
shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
@@ -7423,6 +7431,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
{
mScreen.bindTexture(0, channel);
}
+
+ if (!LLViewerCamera::getInstance()->cameraUnderWater())
+ {
+ shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2);
+ } else {
+ shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0);
+ }
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 36abeca295..e264081910 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -554,7 +554,8 @@ public:
static BOOL sRenderDeferred;
static BOOL sMemAllocationThrottled;
static S32 sVisibleLightCount;
- static F32 sMinRenderSize;
+ static F32 sMinRenderSize;
+ static BOOL sRenderingHUDs;
//screen texture
U32 mScreenWidth;