summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl4
-rw-r--r--indra/newview/pipeline.cpp10
2 files changed, 13 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 404e284abb..2d6bce02c9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -36,9 +36,11 @@ uniform sampler2DRect diffuseRect;
uniform vec2 screen_res;
VARYING vec2 vary_fragcoord;
+uniform float texture_gamma;
+
void main()
{
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
- frag_color = pow(diff, vec4(0.454545, 0.454545, 0.454545, 1.0));
+ frag_color = pow(diff, vec4(texture_gamma, texture_gamma, texture_gamma, 1.0));
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index c02a51ef59..ca5adc6180 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7124,7 +7124,17 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
mScreen.bindTexture(0,channel);
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
}
+
gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mScreen.getWidth(), mScreen.getHeight());
+
+ F32 gamma = 1.0;
+ if (!LLViewerCamera::getInstance()->cameraUnderWater())
+ {
+ gamma = 1.0/2.2;
+ }
+
+ gDeferredPostGammaCorrectProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, gamma);
+
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
gGL.vertex2f(-1,-1);