summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-07-16 10:40:01 -0700
committerGraham Linden <graham@lindenlab.com>2019-07-16 10:40:01 -0700
commit00590defe4f525229c392b6f345695a09ac6b679 (patch)
treea7ea3fbc338d33b1b8171f2be486acab5f070fce
parent5bae46b357cd4d7700ed4289fc3b3ddf00860ec9 (diff)
SL-11605
Fix broken throttling of sky/envmap updates.
-rw-r--r--indra/llrender/llvertexbuffer.cpp2
-rw-r--r--indra/newview/llvosky.cpp92
-rw-r--r--indra/newview/llvosky.h1
3 files changed, 54 insertions, 41 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 2ac17127be..f498526367 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -761,8 +761,6 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
U16* idx = ((U16*) getIndicesPointer())+indices_offset;
- llassert(idx);
-
stop_glerror();
LLGLSLShader::startProfile();
glDrawRangeElements(sGLMode[mode], start, end, count, GL_UNSIGNED_SHORT,
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index cf3132447d..ad452659c6 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -424,6 +424,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mInitialized = FALSE;
mbCanSelect = FALSE;
+ mUpdateTimer.reset();
mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
mForceUpdateThrottle.reset();
@@ -706,6 +707,7 @@ bool LLVOSky::updateSky()
// It's dead. Don't update it.
return TRUE;
}
+
if (gGLManager.mIsDisabled)
{
return TRUE;
@@ -746,11 +748,12 @@ bool LLVOSky::updateSky()
mForceUpdate = mForceUpdate || moon_direction_changed;
mForceUpdate = mForceUpdate || color_changed;
mForceUpdate = mForceUpdate || !mInitialized;
- mForceUpdate = mForceUpdate || mForceUpdateThrottle.hasExpired();
+
+ bool is_alm_wl_sky = gPipeline.canUseWindLightShaders();
calc();
- if (mForceUpdate)
+ if (mForceUpdate && mForceUpdateThrottle.hasExpired())
{
LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED);
@@ -759,62 +762,73 @@ bool LLVOSky::updateSky()
LLSkyTex::stepCurrent();
if (!direction.isExactlyZero())
- {
- mInitialized = TRUE;
-
- updateFog(LLViewerCamera::getInstance()->getFar());
+ {
mLastTotalAmbient = total_ambient;
+ mInitialized = TRUE;
if (mCubeMap)
{
- for (int side = 0; side < 6; side++)
- {
- for (int tile = 0; tile < NUM_TILES; tile++)
- {
- createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, 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();
- }
+ updateFog(LLViewerCamera::getInstance()->getFar());
- // 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++)
{
createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex);
+ createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true);
}
}
+ }
- int tex = mSkyTex[0].getWhich(TRUE);
+ int tex = mSkyTex[0].getWhich(TRUE);
- for (int side = 0; side < 6; side++)
- {
- LLImageRaw* raw1 = nullptr;
- LLImageRaw* raw2 = nullptr;
+ for (int side = 0; side < 6; side++)
+ {
+ 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);
- mSkyTex[side].create(1.0f);
- }
+ }
+
+ raw1 = mShinyTex[side].getImageRaw(TRUE);
+ raw2 = mShinyTex[side].getImageRaw(FALSE);
+ raw2->copy(raw1);
+ mShinyTex[side].createGLImage(tex);
}
- }
+ 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;
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 67a7059b5a..8c2817e1ed 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -352,6 +352,7 @@ protected:
LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment
S32 mDrawRefl;
+ LLFrameTimer mUpdateTimer;
LLTimer mForceUpdateThrottle;
bool mHeavenlyBodyUpdated ;