summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llshadermgr.cpp2
-rw-r--r--indra/llrender/llshadermgr.h5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/skyF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/genSkyShF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/skyF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl3
-rw-r--r--indra/newview/llenvironment.cpp10
-rw-r--r--indra/newview/llsettingsvo.cpp10
-rw-r--r--indra/newview/pipeline.cpp14
19 files changed, 11 insertions, 60 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 026301d914..bce3720d3b 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1305,8 +1305,6 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("bloomMap");
mReservedUniforms.push_back("projectionMap");
mReservedUniforms.push_back("norm_mat");
-
- mReservedUniforms.push_back("global_gamma");
mReservedUniforms.push_back("texture_gamma");
mReservedUniforms.push_back("specular_color");
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 98caa9295e..127b5ce5b6 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -173,10 +173,7 @@ public:
DEFERRED_BLOOM,
DEFERRED_PROJECTION,
DEFERRED_NORM_MATRIX,
-
- GLOBAL_GAMMA,
- TEXTURE_GAMMA,
-
+ TEXTURE_GAMMA,
SPECULAR_COLOR,
ENVIRONMENT_INTENSITY,
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 0c4707098b..546a502ee1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -37,10 +37,7 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-uniform float display_gamma;
-uniform vec4 gamma;
uniform mat3 env_mat;
-
uniform vec3 sun_dir;
uniform vec3 moon_dir;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index f6694aae2a..ae1ac5de7f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -43,7 +43,6 @@ uniform sampler2D cloud_noise_texture_next;
uniform float blend_factor;
uniform vec4 cloud_pos_density1;
uniform vec4 cloud_pos_density2;
-uniform vec4 gamma;
uniform float cloud_scale;
uniform float cloud_variance;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 38792601f6..a13c8de43e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -31,7 +31,6 @@
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
uniform float emissive_brightness;
-uniform float display_gamma;
uniform int sun_up_factor;
#ifdef WATER_FOG
@@ -64,8 +63,6 @@ uniform sampler2D lightFunc;
// Inputs
uniform vec4 morphFactor;
uniform vec3 camPosLocal;
-//uniform vec4 camPosWorld;
-uniform vec4 gamma;
uniform mat3 env_mat;
uniform vec3 sun_dir;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 058e939ec8..9f519708a2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -37,7 +37,6 @@ uniform sampler2DRect diffuseRect;
uniform vec2 screen_res;
VARYING vec2 vary_fragcoord;
-
uniform float display_gamma;
vec3 linear_to_srgb(vec3 cl);
@@ -45,7 +44,7 @@ vec3 linear_to_srgb(vec3 cl);
void main()
{
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
- diff.rgb = linear_to_srgb(diff.rgb);
+ diff.rgb = pow(diff.rgb, vec3(display_gamma));
frag_color = diff;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 65e4fdf17f..331249dc33 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -37,8 +37,6 @@ out vec4 frag_data[3];
VARYING vec4 vary_HazeColor;
-uniform vec4 gamma;
-
/// Soft clips the light with a gamma correction
vec3 scaleSoftClip(vec3 light);
vec3 srgb_to_linear(vec3 c);
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 0607ea8bc5..4460ef905b 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -22,7 +22,6 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-uniform vec4 gamma;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
uniform vec4 moonlight_color;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
index 346634af33..fc51e81177 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
@@ -24,7 +24,6 @@
*/
uniform int no_atmo;
-uniform vec4 gamma;
vec3 scaleSoftClipFrag(vec3 light)
{
diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
index b826cff304..1dce85a83b 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
@@ -64,7 +64,6 @@ VARYING vec3 pos;
// The fragment shader for the sky
/////////////////////////////////////////////////////////////////////////
-uniform vec4 gamma;
uniform sampler2D rainbow_map;
uniform sampler2D halo_map;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
index 3ac0fc224b..75bf8730df 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
@@ -44,7 +44,6 @@ uniform sampler2D cloud_noise_texture_next;
uniform float blend_factor;
uniform vec4 cloud_pos_density1;
uniform vec4 cloud_pos_density2;
-uniform vec4 gamma;
uniform float cloud_scale;
uniform float cloud_variance;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index 5c339f9663..68db7fcbb1 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -22,10 +22,7 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-
-
-uniform vec4 gamma;
+uniform float gamma;
uniform int no_atmo;
vec3 getAtmosAttenuation();
@@ -39,7 +36,7 @@ vec3 scaleSoftClipFrag(vec3 light)
}
//soft clip effect:
light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
+ light = 1. - pow(light, vec3(gamma)); // s/b inverted already CPU-side
return light;
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
index de6fb276aa..7146349453 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
@@ -35,8 +35,6 @@ out vec4 frag_color;
VARYING vec4 vary_HazeColor;
-uniform vec4 gamma;
-
/// Soft clips the light with a gamma correction
vec3 scaleSoftClip(vec3 light);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/genSkyShF.glsl b/indra/newview/app_settings/shaders/class3/deferred/genSkyShF.glsl
index c02e6d1e57..d5d91c88f0 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/genSkyShF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/genSkyShF.glsl
@@ -37,7 +37,6 @@ uniform sampler2D transmittance_texture;
uniform sampler3D scattering_texture;
uniform sampler3D single_mie_scattering_texture;
uniform sampler2D irradiance_texture;
-uniform vec4 gamma;
vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
index d0514f7d23..6de01cb667 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
@@ -44,7 +44,6 @@ uniform sampler3D single_mie_scattering_texture;
uniform sampler2D irradiance_texture;
uniform sampler2D rainbow_map;
uniform sampler2D halo_map;
-uniform vec4 gamma;
uniform float moisture_level;
uniform float droplet_radius;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 82a899ad65..978c25b86a 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -50,7 +50,6 @@ uniform vec3 camPosLocal;
uniform float cloud_shadow;
uniform float max_y;
uniform vec4 glow;
-uniform float global_gamma;
uniform mat3 env_mat;
uniform vec4 shadow_clip;
@@ -94,7 +93,6 @@ void main()
norm.xyz = getNorm(tc);
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
- da = pow(da, global_gamma + 0.3);
vec4 diffuse = texture2DRect(diffuseRect, tc); // linear
@@ -106,7 +104,6 @@ void main()
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
-// scol_ambocc = pow(scol_ambocc, vec3(global_gamma + 0.3));
float scol = max(scol_ambocc.r, diffuse.a);
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index d20c05fe67..daff4b7186 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1596,16 +1596,6 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
psetting->applySpecial(shader);
-
- if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender && !LLPipeline::sUnderWaterRender)
- {
- shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2);
- }
- else
- {
- shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0);
- }
-
}
void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader)
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index cc70f651cf..5b336f0870 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -706,11 +706,15 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV);
}
- F32 g = getGamma();
+
shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength);
- shader->uniform4f(LLShaderMgr::GAMMA, g, 0.0, 0.0, 1.0);
- shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, g);
+
+ F32 g = getGamma();
+ F32 display_gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
+
+ shader->uniform1f(LLShaderMgr::GAMMA, g);
+ shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, display_gamma);
}
LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index eb1ffc91f7..448b65272b 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7913,13 +7913,6 @@ 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);
- }
-
shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
shader->uniform1f(LLShaderMgr::DOF_WIDTH, dof_width-1);
@@ -7961,13 +7954,6 @@ 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]);
gGL.vertex2f(-1,-1);