summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-06-27 09:10:38 -0700
committerGraham Linden <graham@lindenlab.com>2019-06-27 09:10:38 -0700
commit8ba159fed90fc221003e85c5d2d3b82ec30d81bf (patch)
tree06c9e605db034a0e44c64fece4a6f69763c95d38
parentcfdcd0fc8ce969ca7df4e88608ee6d3bc923954d (diff)
SL-11151, SL-11504
Remove update threshold logic causing hiccups and rework sky updates. Make deferred water do double transport again to match non-ALM rendering more closely.
-rw-r--r--indra/llinventory/llsettingsbase.cpp8
-rw-r--r--indra/llinventory/llsettingsbase.h21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl2
-rw-r--r--indra/newview/llenvironment.cpp2
-rw-r--r--indra/newview/lllegacyatmospherics.cpp1
-rw-r--r--indra/newview/lllegacyatmospherics.h1
-rw-r--r--indra/newview/llvosky.cpp212
-rw-r--r--indra/newview/llvosky.h4
8 files changed, 90 insertions, 161 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index c051563714..e8fdd017e3 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -727,22 +727,14 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS
bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta)
{
mTimeSpent += timedelta;
- mTimeDeltaPassed += timedelta;
if (mTimeSpent > mBlendSpan)
{
- mIgnoreTimeDelta = false;
triggerComplete();
return false;
}
- if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta))
- {
- return false;
- }
-
LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan);
- mTimeDeltaPassed = LLSettingsBase::Seconds(0.0);
if (fabs(mLastBlendF - blendf) < mBlendFMinDelta)
{
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 592ae3478a..afb5014409 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -477,9 +477,6 @@ public:
mBlendSpan(blend_span),
mLastUpdate(0.0f),
mTimeSpent(0.0f),
- mTimeDeltaThreshold(0.0f),
- mTimeDeltaPassed(0.0f),
- mIgnoreTimeDelta(false),
mBlendFMinDelta(MIN_BLEND_DELTA),
mLastBlendF(-1.0f)
{
@@ -499,26 +496,11 @@ public:
mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch());
mLastUpdate = mTimeStart;
mTimeSpent = LLSettingsBase::Seconds(0.0f);
- mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f);
mLastBlendF = LLSettingsBase::BlendFactor(-1.0f);
}
virtual bool applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE;
- inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time)
- {
- mTimeDeltaThreshold = time;
- mTimeDeltaPassed = time + LLSettingsBase::Seconds(1.0); // take the next update call.
- }
-
- inline LLSettingsBase::Seconds getTimeDeltaThreshold() const
- {
- return mTimeDeltaThreshold;
- }
-
- inline void setIgnoreTimeDeltaThreshold(bool val) { mIgnoreTimeDelta = val; }
- inline bool getIgnoreTimeDeltaThreshold() const { return mIgnoreTimeDelta; }
-
inline void setTimeSpent(LLSettingsBase::Seconds time) { mTimeSpent = time; }
protected:
LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const;
@@ -527,9 +509,6 @@ protected:
LLSettingsBase::Seconds mLastUpdate;
LLSettingsBase::Seconds mTimeSpent;
LLSettingsBase::Seconds mTimeStart;
- LLSettingsBase::Seconds mTimeDeltaThreshold;
- LLSettingsBase::Seconds mTimeDeltaPassed;
- bool mIgnoreTimeDelta;
LLSettingsBase::BlendFactor mBlendFMinDelta;
LLSettingsBase::BlendFactor mLastBlendF;
};
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index fd5b6989eb..8554ebef0b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -164,7 +164,7 @@ void main()
color.rgb += spec * specular;
- //color.rgb = atmosTransport(color.rgb);
+ color.rgb = atmosTransport(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
color.a = spec * sunAngle2;
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 3373c8c3a4..d20c05fe67 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -196,7 +196,6 @@ namespace
mCycleLength(cyclelength),
mCycleOffset(cycleoffset)
{
- setTimeDeltaThreshold(updateThreshold);
// must happen prior to getBoundingEntries call...
mTrackNo = selectTrackNumber(trackno);
@@ -233,7 +232,6 @@ namespace
LLSettingsBase::BlendFactor blendf = calculateBlend(targetpos, targetspan);
pendsetting->blend((*bounds.second).second, blendf);
- setIgnoreTimeDeltaThreshold(true); // for the next span ignore the time delta threshold.
reset(pstartsetting, pendsetting, LLEnvironment::TRANSITION_ALTITUDE);
}
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index a09f54c303..b6c46b9ff9 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -181,7 +181,6 @@ LLAtmospherics::LLAtmospherics()
{
/// WL PARAMS
mInitialized = FALSE;
- mUpdateTimer.reset();
mAmbientScale = gSavedSettings.getF32("SkyAmbientScale");
mNightColorShift = gSavedSettings.getColor3("SkyNightColorShift");
mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f;
diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h
index f2900b4323..22ed37f830 100644
--- a/indra/newview/lllegacyatmospherics.h
+++ b/indra/newview/lllegacyatmospherics.h
@@ -277,7 +277,6 @@ protected:
LLColor4 mGLFogCol;
F32 mFogRatio;
F32 mWorldScale;
- LLFrameTimer mUpdateTimer;
};
#endif
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 7e0f377953..745278bf0c 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -424,7 +424,6 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mInitialized = FALSE;
mbCanSelect = FALSE;
- mUpdateTimer.reset();
mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
mForceUpdateThrottle.reset();
@@ -496,7 +495,8 @@ void LLVOSky::init()
for (S32 tile = 0; tile < NUM_TILES; ++tile)
{
initSkyTextureDirs(side, tile);
- createSkyTexture(m_atmosphericsVars, side, tile, false);
+ createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex);
+ createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex);
}
}
@@ -663,21 +663,9 @@ void LLVOSky::restoreGL()
updateDirections();
- if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap
- && LLCubeMap::sUseCubeMaps)
+ if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps)
{
- LLCubeMap* cube_map = getCubeMap();
-
- std::vector<LLPointer<LLImageRaw> > images;
- for (S32 side = 0; side < 6; side++)
- {
- images.push_back(mShinyTex[side].getImageRaw());
- }
-
- if(cube_map)
- {
- cube_map->init(images);
- }
+ initCubeMap();
}
mForceUpdate = TRUE;
@@ -721,7 +709,7 @@ void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile)
}
}
-void LLVOSky::createSkyTexture(AtmosphericsVars& vars, const S32 side, const S32 tile, bool skip_sky_tex)
+void LLVOSky::createSkyTexture(AtmosphericsVars& vars, const S32 side, const S32 tile, LLSkyTex* tex)
{
S32 tile_x = tile % NUM_TILES_X;
S32 tile_y = tile / NUM_TILES_X;
@@ -730,22 +718,11 @@ void LLVOSky::createSkyTexture(AtmosphericsVars& vars, const S32 side, const S32
S32 tile_y_pos = tile_y * sTileResY;
S32 x, y;
- if (!skip_sky_tex)
- {
- for (y = tile_y_pos; y < (tile_y_pos + sTileResY); ++y)
- {
- for (x = tile_x_pos; x < (tile_x_pos + sTileResX); ++x)
- {
- mSkyTex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(vars, mSkyTex[side].getDir(x, y)), x, y);
- }
- }
- }
-
for (y = tile_y_pos; y < (tile_y_pos + sTileResY); ++y)
{
for (x = tile_x_pos; x < (tile_x_pos + sTileResX); ++x)
{
- mShinyTex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(vars, mSkyTex[side].getDir(x, y), true), x, y);
+ tex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(vars, tex[side].getDir(x, y), true), x, y);
}
}
}
@@ -801,124 +778,109 @@ bool LLVOSky::updateSky()
const S32 total_no_tiles = 6 * NUM_TILES;
const S32 cycle_frame_no = total_no_tiles + 1;
- if (mUpdateTimer.getElapsedTimeF32() > 0.025f)
- {
- mUpdateTimer.reset();
- const S32 frame = next_frame;
-
- mForceUpdate = mForceUpdate || (total_no_tiles == frame);
+ const S32 frame = next_frame;
- ++next_frame;
- next_frame = next_frame % cycle_frame_no;
+ mForceUpdate = mForceUpdate || (total_no_tiles == frame);
- mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / cycle_frame_no;
- // sInterpVal = (F32)next_frame / cycle_frame_no;
- LLSkyTex::setInterpVal( mInterpVal );
- LLHeavenBody::setInterpVal( mInterpVal );
- updateDirections();
+ ++next_frame;
+ next_frame = next_frame % cycle_frame_no;
- LLVector3 direction = mSun.getDirection();
- direction.normalize();
- const F32 dot_sun = direction * mLastSunLightingDirection;
- const F32 dot_moon = direction * mLastMoonLightingDirection;
+ mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / cycle_frame_no;
+ // sInterpVal = (F32)next_frame / cycle_frame_no;
+ LLSkyTex::setInterpVal( mInterpVal );
+ LLHeavenBody::setInterpVal( mInterpVal );
+ updateDirections();
- LLColor3 delta_color;
- delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0],
- mLastTotalAmbient.mV[1] - total_ambient.mV[1],
- mLastTotalAmbient.mV[2] - total_ambient.mV[2]);
+ LLVector3 direction = mSun.getDirection();
+ direction.normalize();
+ const F32 dot_sun = direction * mLastSunLightingDirection;
+ const F32 dot_moon = direction * mLastMoonLightingDirection;
- bool sun_direction_changed = (dot_sun < LIGHT_DIRECTION_THRESHOLD);
- bool moon_direction_changed = (dot_moon < LIGHT_DIRECTION_THRESHOLD);
- bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD);
+ LLColor3 delta_color;
+ delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0],
+ mLastTotalAmbient.mV[1] - total_ambient.mV[1],
+ mLastTotalAmbient.mV[2] - total_ambient.mV[2]);
- mForceUpdate = mForceUpdate || sun_direction_changed;
- mForceUpdate = mForceUpdate || moon_direction_changed;
- mForceUpdate = mForceUpdate || color_changed;
- mForceUpdate = mForceUpdate || !mInitialized;
+ bool sun_direction_changed = (dot_sun < LIGHT_DIRECTION_THRESHOLD);
+ bool moon_direction_changed = (dot_moon < LIGHT_DIRECTION_THRESHOLD);
+ bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD);
- bool is_alm_wl_sky = gPipeline.canUseWindLightShaders();
+ mForceUpdate = mForceUpdate || sun_direction_changed;
+ mForceUpdate = mForceUpdate || moon_direction_changed;
+ mForceUpdate = mForceUpdate || color_changed;
+ mForceUpdate = mForceUpdate || !mInitialized;
+ mForceUpdate = mForceUpdate || mForceUpdateThrottle.hasExpired();
- calc();
+ calc();
- if (mForceUpdate && mForceUpdateThrottle.hasExpired())
- {
- LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED);
+ if (mForceUpdate)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED);
- mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
+ mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
- LLSkyTex::stepCurrent();
+ LLSkyTex::stepCurrent();
- if (!direction.isExactlyZero())
- {
- mLastTotalAmbient = total_ambient;
- mInitialized = TRUE;
+ if (!direction.isExactlyZero())
+ {
+ mInitialized = TRUE;
- if (mCubeMap)
- {
- updateFog(LLViewerCamera::getInstance()->getFar());
+ updateFog(LLViewerCamera::getInstance()->getFar());
+ mLastTotalAmbient = total_ambient;
- for (int side = 0; side < 6; side++)
+ if (mCubeMap)
+ {
+ for (int side = 0; side < 6; side++)
+ {
+ for (int tile = 0; tile < NUM_TILES; tile++)
{
- for (int tile = 0; tile < NUM_TILES; tile++)
- {
- createSkyTexture(m_atmosphericsVars, side, tile, is_alm_wl_sky);
- }
+ createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex);
}
+ }
- int tex = mSkyTex[0].getWhich(TRUE);
+ int tex = mShinyTex[0].getWhich(TRUE);
+
+ for (int side = 0; side < 6; side++)
+ {
+ LLImageRaw* raw1 = nullptr;
+ LLImageRaw* raw2 = nullptr;
+ raw1 = mShinyTex[side].getImageRaw(TRUE);
+ raw2 = mShinyTex[side].getImageRaw(FALSE);
+ raw2->copy(raw1);
+ mShinyTex[side].createGLImage(tex);
+ mShinyTex[side].create(1.0f);
+ }
+ initCubeMap();
+ }
- for (int side = 0; side < 6; side++)
+ // if we're using a generated sky cubemap instead of rendered sky...
+ if (!gPipeline.canUseWindLightShaders())
+ {
+ for (int side = 0; side < 6; side++)
+ {
+ for (int tile = 0; tile < NUM_TILES; tile++)
{
- LLImageRaw* raw1 = nullptr;
- LLImageRaw* raw2 = nullptr;
-
- if (!is_alm_wl_sky)
- {
- raw1 = mSkyTex[side].getImageRaw(TRUE);
- raw2 = mSkyTex[side].getImageRaw(FALSE);
- raw2->copy(raw1);
- mSkyTex[side].createGLImage(tex);
- }
-
- raw1 = mShinyTex[side].getImageRaw(TRUE);
- raw2 = mShinyTex[side].getImageRaw(FALSE);
- raw2->copy(raw1);
- mShinyTex[side].createGLImage(tex);
+ createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex);
}
- next_frame = 0;
-
- // update the sky texture
- if (!is_alm_wl_sky)
- {
- for (S32 i = 0; i < 6; ++i)
- {
- mSkyTex[i].create(1.0f);
- }
- }
-
- for (S32 i = 0; i < 6; ++i)
- {
- mShinyTex[i].create(1.0f);
- }
-
- // update the environment map
- if (mCubeMap)
- {
- std::vector<LLPointer<LLImageRaw> > images;
- images.reserve(6);
- for (S32 side = 0; side < 6; side++)
- {
- images.push_back(mShinyTex[side].getImageRaw(TRUE));
- }
- mCubeMap->init(images);
- gGL.getTexUnit(0)->disable();
- }
}
- }
- gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
- mForceUpdate = FALSE;
- }
+ int tex = mSkyTex[0].getWhich(TRUE);
+
+ for (int side = 0; side < 6; side++)
+ {
+ LLImageRaw* raw1 = nullptr;
+ LLImageRaw* raw2 = nullptr;
+ raw1 = mSkyTex[side].getImageRaw(TRUE);
+ raw2 = mSkyTex[side].getImageRaw(FALSE);
+ raw2->copy(raw1);
+ mSkyTex[side].createGLImage(tex);
+ mSkyTex[side].create(1.0f);
+ }
+ }
+ }
+
+ gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
+ mForceUpdate = FALSE;
}
if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer())
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index a9ef5474b6..e118cc7200 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -303,7 +303,7 @@ protected:
void updateDirections(void);
void initSkyTextureDirs(const S32 side, const S32 tile);
- void createSkyTexture(AtmosphericsVars& vars, const S32 side, const S32 tile, bool skip_sky_tex);
+ void createSkyTexture(AtmosphericsVars& vars, const S32 side, const S32 tile, LLSkyTex* tex);
LLPointer<LLViewerFetchedTexture> mSunTexturep[2];
LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
@@ -350,11 +350,11 @@ protected:
LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment
S32 mDrawRefl;
- LLFrameTimer mUpdateTimer;
LLTimer mForceUpdateThrottle;
bool mHeavenlyBodyUpdated ;
AtmosphericsVars m_atmosphericsVars;
+ AtmosphericsVars m_lastAtmosphericsVars;
LLAtmospherics m_legacyAtmospherics;
};