diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2024-02-25 22:52:23 -0800 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2024-02-25 22:52:23 -0800 |
commit | 320258729757e9ef14e9509c22eca1ce6a0da856 (patch) | |
tree | 6383327b4b5c85134b315ab9ec7ac5c57e6ecb69 | |
parent | 0d38d1bbd659206454d261193857d6fbb91387fa (diff) |
#682 Add a low priority path for conservative probe face updates. This will update the "low priority" faces at half of the the probe update rate. Useful for less planar reflection geometry.
-rw-r--r-- | indra/newview/llheroprobemanager.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llheroprobemanager.h | 11 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 7 |
4 files changed, 36 insertions, 12 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index 0d9efb860a..f350b28bf5 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -114,7 +114,7 @@ void LLHeroProbeManager::update() for (auto vo : mHeroVOList) { - if (vo && !vo->isDead()) + if (vo && (!vo->isDead() || vo != nullptr)) { if (vo->mDrawable.notNull()) { @@ -135,7 +135,7 @@ void LLHeroProbeManager::update() unregisterViewerObject(vo); } } - + if (mNearestHero != nullptr && !mNearestHero->isDead() && mNearestHero->mDrawable.notNull()) { LLVector3 hero_pos = mNearestHero->getPositionAgent(); @@ -205,7 +205,16 @@ void LLHeroProbeManager::update() for (U32 i = 0; i < 6; ++i) { if (mFaceUpdateList[i]) + { updateProbeFace(mProbes[j], i, near_clip); + } + else + { + if (mLowPriorityFaceThrottle > 0 && mCurrentProbeUpdateFrame % mLowPriorityFaceThrottle == 0) { + updateProbeFace(mProbes[j], i, near_clip); + mCurrentProbeUpdateFrame = 0; + } + } } generateRadiance(mProbes[j]); } @@ -213,6 +222,8 @@ void LLHeroProbeManager::update() gPipeline.mReflectionMapManager.mRadiancePass = radiance_pass; } + + mCurrentProbeUpdateFrame++; } // Do the reflection map update render passes. @@ -568,21 +579,25 @@ void LLHeroProbeManager::doOcclusion() } } -void LLHeroProbeManager::registerViewerObject(LLVOVolume* drawablep) +bool LLHeroProbeManager::registerViewerObject(LLVOVolume* drawablep) { llassert(drawablep != nullptr); - if (mHeroVOList.find(drawablep) == mHeroVOList.end()) + if (std::find(mHeroVOList.begin(), mHeroVOList.end(), drawablep) == mHeroVOList.end()) { // Probe isn't in our list for consideration. Add it. - mHeroVOList.insert(drawablep); + mHeroVOList.push_back(drawablep); + return true; } + + return false; } void LLHeroProbeManager::unregisterViewerObject(LLVOVolume* drawablep) { - if (mHeroVOList.find(drawablep) != mHeroVOList.end()) + std::vector<LLVOVolume*>::iterator found_itr = std::find(mHeroVOList.begin(), mHeroVOList.end(), drawablep); + if (found_itr != mHeroVOList.end()) { - mHeroVOList.erase(drawablep); + mHeroVOList.erase(found_itr); } } diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h index 7cc7e3b144..b1907ef185 100644 --- a/indra/newview/llheroprobemanager.h +++ b/indra/newview/llheroprobemanager.h @@ -68,7 +68,7 @@ public: // perform occlusion culling on all active reflection probes void doOcclusion(); - void registerViewerObject(LLVOVolume *drawablep); + bool registerViewerObject(LLVOVolume *drawablep); void unregisterViewerObject(LLVOVolume* drawablep); bool isMirrorPass() const { return mRenderingMirror; } @@ -107,7 +107,7 @@ private: void generateRadiance(LLReflectionMap *probe); // list of active reflection maps - std::vector<LLPointer<LLReflectionMap> > mProbes; + std::vector<LLPointer<LLReflectionMap>> mProbes; // handle to UBO U32 mUBO = 0; @@ -137,7 +137,10 @@ private: bool mRenderingMirror = false; std::map<int, bool> mFaceUpdateList; - std::set<LLPointer<LLVOVolume>> mHeroVOList; - LLPointer<LLVOVolume> mNearestHero; + U32 mCurrentProbeUpdateFrame = 0; + U32 mLowPriorityFaceThrottle = 2; + + std::vector<LLVOVolume*> mHeroVOList; + LLVOVolume* mNearestHero; }; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 80da7b2f73..0c4d958aed 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -944,6 +944,7 @@ public: // reflection probe state bool mIsReflectionProbe = false; // if true, this object should register itself with LLReflectionProbeManager LLPointer<LLReflectionMap> mReflectionProbe = nullptr; // reflection probe coupled to this viewer object. If not null, should be deregistered when this object is destroyed + bool mIsHeroProbe = false; // This is a special case for mirrors and other high resolution probes. // the amount of GPU time (in ms) it took to render this object according to LLPipeline::profileAvatar // -1.f if no profile data available diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 27d2e6af71..149abaf573 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -296,6 +296,11 @@ void LLVOVolume::markDead() { mLightTexture->removeVolume(LLRender::LIGHT_TEX, this); } + + if (mIsHeroProbe) + { + gPipeline.mHeroProbeManager.unregisterViewerObject(this); + } } LLViewerObject::markDead(); @@ -4411,7 +4416,7 @@ void LLVOVolume::updateReflectionProbePtr() { // Geenz: This is a special case - what we want here is a hero probe. // What we want to do here is instantiate a hero probe from the hero probe manager. - gPipeline.mHeroProbeManager.registerViewerObject(this); + mIsHeroProbe = gPipeline.mHeroProbeManager.registerViewerObject(this); } } else if (mReflectionProbe.notNull() || getReflectionProbeIsMirror()) |