@@ -7102,9 +7102,9 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst, bool gamma_co
7102
7102
LLGLSLShader* shader = nullptr ;
7103
7103
if (gamma_correct)
7104
7104
{
7105
- shader = no_post ? &gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping)
7105
+ shader = no_post ? &gDeferredPostGammaCorrectProgram : // no post (no legacy gamma adjustment , no exposure, no tonemapping, still srgb corrected )
7106
7106
psky->getReflectionProbeAmbiance (should_auto_adjust) == 0 .f ? &gLegacyPostGammaCorrectProgram :
7107
- &gDeferredPostGammaCorrectProgram ;
7107
+ &gDeferredPostTonemapGammaCorrectProgram ;
7108
7108
}
7109
7109
else
7110
7110
{
@@ -7145,6 +7145,34 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst, bool gamma_co
7145
7145
}
7146
7146
}
7147
7147
7148
+ void LLPipeline::gammaCorrect (LLRenderTarget* src, LLRenderTarget* dst)
7149
+ {
7150
+ LL_PROFILE_GPU_ZONE (" gamma correct" );
7151
+ dst->bindTarget ();
7152
+ // gamma correct lighting
7153
+ {
7154
+ LLGLDepthTest depth (GL_FALSE, GL_FALSE);
7155
+
7156
+ static LLCachedControl<bool > buildNoPost (gSavedSettings , " RenderDisablePostProcessing" , false );
7157
+ static LLCachedControl<bool > should_auto_adjust (gSavedSettings , " RenderSkyAutoAdjustLegacy" , true );
7158
+
7159
+ bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools ->isAvailable ());
7160
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance ().getCurrentSky ();
7161
+ LLGLSLShader& shader = psky->getReflectionProbeAmbiance (should_auto_adjust) == 0 .f && !no_post ? gLegacyPostGammaCorrectProgram :
7162
+ gDeferredPostGammaCorrectProgram ;
7163
+
7164
+ shader.bind ();
7165
+ shader.bindTexture (LLShaderMgr::DEFERRED_DIFFUSE, src, false , LLTexUnit::TFO_POINT);
7166
+ shader.uniform2f (LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)src->getWidth (), (GLfloat)src->getHeight ());
7167
+
7168
+ mScreenTriangleVB ->setBuffer ();
7169
+ mScreenTriangleVB ->drawArrays (LLRender::TRIANGLES, 0 , 3 );
7170
+
7171
+ shader.unbind ();
7172
+ }
7173
+ dst->flush ();
7174
+ }
7175
+
7148
7176
void LLPipeline::copyScreenSpaceReflections (LLRenderTarget* src, LLRenderTarget* dst)
7149
7177
{
7150
7178
if (RenderScreenSpaceReflections && !gCubeSnapshot )
@@ -7285,11 +7313,13 @@ void LLPipeline::applyCAS(LLRenderTarget* src, LLRenderTarget* dst)
7285
7313
{
7286
7314
static LLCachedControl<F32> cas_sharpness (gSavedSettings , " RenderCASSharpness" , 0 .4f );
7287
7315
static LLCachedControl<bool > should_auto_adjust (gSavedSettings , " RenderSkyAutoAdjustLegacy" , true );
7316
+ static LLCachedControl<bool > buildNoPost (gSavedSettings , " RenderDisablePostProcessing" , false );
7288
7317
7289
7318
LL_PROFILE_GPU_ZONE (" cas" );
7290
7319
7320
+ bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools ->isAvailable ());
7291
7321
LLSettingsSky::ptr_t psky = LLEnvironment::instance ().getCurrentSky ();
7292
- LLGLSLShader* sharpen_shader = psky->getReflectionProbeAmbiance (should_auto_adjust) == 0 .f ? &gCASLegacyGammaProgram : &gCASProgram ;
7322
+ LLGLSLShader* sharpen_shader = psky->getReflectionProbeAmbiance (should_auto_adjust) == 0 .f && !no_post ? &gCASLegacyGammaProgram : &gCASProgram ;
7293
7323
7294
7324
// Bind setup:
7295
7325
dst->bindTarget ();
@@ -7847,12 +7877,8 @@ void LLPipeline::renderFinalize()
7847
7877
gGL .setColorMask (true , true );
7848
7878
glClearColor (0 , 0 , 0 , 0 );
7849
7879
7850
- LLRenderTarget* src = &mPostPingMap ;
7851
- LLRenderTarget* dest = &mPostPongMap ;
7852
-
7853
7880
static LLCachedControl<bool > render_hdr (gSavedSettings , " RenderHDREnabled" , true );
7854
7881
bool hdr = gGLManager .mGLVersion > 4 .05f && render_hdr;
7855
-
7856
7882
if (hdr)
7857
7883
{
7858
7884
copyScreenSpaceReflections (&mRT ->screen , &mSceneMap );
@@ -7866,16 +7892,21 @@ void LLPipeline::renderFinalize()
7866
7892
{
7867
7893
tonemap (&mRT ->screen , &mRT ->deferredLight , false ); // Must output to 16F buffer when passing to CAS or banding occurs
7868
7894
7869
- applyCAS (&mRT ->deferredLight , dest); // Gamma corrects after sharpening
7870
- std::swap (src, dest);
7895
+ applyCAS (&mRT ->deferredLight , &mPostPingMap ); // Gamma corrects after sharpening
7871
7896
}
7872
7897
else
7873
7898
{
7874
- tonemap (&mRT ->screen , dest );
7875
- std::swap (src, dest);
7899
+ tonemap (&mRT ->screen , & mPostPingMap );
7900
+ }
7876
7901
}
7902
+ else
7903
+ {
7904
+ gammaCorrect (&mRT ->screen , &mPostPingMap );
7877
7905
}
7878
7906
7907
+ LLRenderTarget* src = &mPostPingMap ;
7908
+ LLRenderTarget* dest = &mPostPongMap ;
7909
+
7879
7910
LLVertexBuffer::unbind ();
7880
7911
7881
7912
generateGlow (src);
0 commit comments