Skip to content

Commit a275157

Browse files
committed
#3311 RenderSkyAutoAdjustLegacy does not engage tonemapper
1 parent c88a7d1 commit a275157

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

indra/llinventory/llsettingssky.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,43 +2032,43 @@ F32 LLSettingsSky::getGamma() const
20322032
return mGamma;
20332033
}
20342034

2035-
F32 LLSettingsSky::getHDRMin() const
2035+
F32 LLSettingsSky::getHDRMin(bool auto_adjust) const
20362036
{
2037-
if (mCanAutoAdjust)
2037+
if (mCanAutoAdjust && !auto_adjust)
20382038
return 0.f;
20392039

20402040
return mHDRMin;
20412041
}
20422042

2043-
F32 LLSettingsSky::getHDRMax() const
2043+
F32 LLSettingsSky::getHDRMax(bool auto_adjust) const
20442044
{
2045-
if (mCanAutoAdjust)
2045+
if (mCanAutoAdjust && !auto_adjust)
20462046
return 0.f;
20472047

20482048
return mHDRMax;
20492049
}
20502050

2051-
F32 LLSettingsSky::getHDROffset() const
2051+
F32 LLSettingsSky::getHDROffset(bool auto_adjust) const
20522052
{
2053-
if (mCanAutoAdjust)
2053+
if (mCanAutoAdjust && !auto_adjust)
20542054
return 1.0f;
20552055

20562056
return mHDROffset;
20572057
}
20582058

2059-
F32 LLSettingsSky::getTonemapMix() const
2059+
F32 LLSettingsSky::getTonemapMix(bool auto_adjust) const
20602060
{
2061-
if (mCanAutoAdjust)
2061+
if (mCanAutoAdjust && !auto_adjust)
2062+
{
2063+
// legacy settings do not support tonemaping
20622064
return 0.0f;
2065+
}
20632066

20642067
return mTonemapMix;
20652068
}
20662069

20672070
void LLSettingsSky::setTonemapMix(F32 mix)
20682071
{
2069-
if (mCanAutoAdjust)
2070-
return;
2071-
20722072
mTonemapMix = mix;
20732073
}
20742074

indra/llinventory/llsettingssky.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ class LLSettingsSky: public LLSettingsBase
209209

210210
F32 getGamma() const;
211211

212-
F32 getHDRMin() const;
213-
F32 getHDRMax() const;
214-
F32 getHDROffset() const;
215-
F32 getTonemapMix() const;
212+
F32 getHDRMin(bool auto_adjust = false) const;
213+
F32 getHDRMax(bool auto_adjust = false) const;
214+
F32 getHDROffset(bool auto_adjust = false) const;
215+
F32 getTonemapMix(bool auto_adjust = false) const;
216216
void setTonemapMix(F32 mix);
217217

218218
void setGamma(F32 val);

indra/newview/llsettingsvo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
807807
static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f);
808808

809809
// sky is a "classic" sky following pre SL 7.0 shading
810-
bool classic_mode = psky->canAutoAdjust();
810+
bool classic_mode = psky->canAutoAdjust() && !should_auto_adjust();
811811

812812
if (!classic_mode)
813813
{

indra/newview/pipeline.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7076,7 +7076,7 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
70767076

70777077
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky();
70787078

7079-
F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust);
7079+
F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust());
70807080

70817081
F32 exp_min = 1.f;
70827082
F32 exp_max = 1.f;
@@ -7087,13 +7087,13 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
70877087
{
70887088
if (dynamic_exposure_enabled)
70897089
{
7090-
exp_min = sky->getHDROffset() - sky->getHDRMin();
7091-
exp_max = sky->getHDROffset() + sky->getHDRMax();
7090+
exp_min = sky->getHDROffset(should_auto_adjust()) - sky->getHDRMin(should_auto_adjust());
7091+
exp_max = sky->getHDROffset(should_auto_adjust()) + sky->getHDRMax(should_auto_adjust());
70927092
}
70937093
else
70947094
{
7095-
exp_min = sky->getHDROffset();
7096-
exp_max = sky->getHDROffset();
7095+
exp_min = sky->getHDROffset(should_auto_adjust());
7096+
exp_max = sky->getHDROffset(should_auto_adjust());
70977097
}
70987098
}
70997099
else if (dynamic_exposure_enabled)
@@ -7113,7 +7113,7 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
71137113
shader->uniform1f(dt, gFrameIntervalSeconds);
71147114
shader->uniform2f(noiseVec, ll_frand() * 2.0f - 1.0f, ll_frand() * 2.0f - 1.0f);
71157115
shader->uniform4f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max, dynamic_exposure_speed_error);
7116-
shader->uniform4f(dynamic_exposure_params2, sky->getHDROffset(), exp_min, exp_max, dynamic_exposure_speed_target);
7116+
shader->uniform4f(dynamic_exposure_params2, sky->getHDROffset(should_auto_adjust()), exp_min, exp_max, dynamic_exposure_speed_target);
71177117

71187118
mScreenTriangleVB->setBuffer();
71197119
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -7171,7 +7171,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
71717171

71727172
static LLCachedControl<U32> tonemap_type_setting(gSavedSettings, "RenderTonemapType", 0U);
71737173
shader.uniform1i(tonemap_type, tonemap_type_setting);
7174-
shader.uniform1f(tonemap_mix, psky->getTonemapMix());
7174+
shader.uniform1f(tonemap_mix, psky->getTonemapMix(should_auto_adjust()));
71757175

71767176
mScreenTriangleVB->setBuffer();
71777177
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);

0 commit comments

Comments
 (0)