From 316052024958dde817a8d0809c77e29ec4cef64c Mon Sep 17 00:00:00 2001
From: "Jonathan \"Geenz\" Goodman" <geenz@geenzo.com>
Date: Thu, 24 Aug 2023 12:51:19 -0700
Subject: [PATCH] Fix the probe flashing, and avatars.

DRTVWR-583
---
 indra/newview/llheroprobemanager.cpp   | 9 ++++++++-
 indra/newview/llreflectionmap.cpp      | 5 +++--
 indra/newview/llreflectionmap.h        | 2 +-
 indra/newview/llreflectionmapmanager.h | 1 +
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 0d2e8da294f..729603e960f 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -157,6 +157,11 @@ void LLHeroProbeManager::update()
         LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("hpmu - realtime");
         // Probe 0 is always our mirror probe.
         mProbes[0]->mOrigin = probe_pos;
+        
+        bool radiance_pass = gPipeline.mReflectionMapManager.isRadiancePass();
+        
+        gPipeline.mReflectionMapManager.mRadiancePass = true;
+        
         for (U32 j = 0; j < mProbes.size(); j++)
         {
             for (U32 i = 0; i < 6; ++i)
@@ -164,6 +169,8 @@ void LLHeroProbeManager::update()
                 updateProbeFace(mProbes[j], i);
             }
         }
+        
+        gPipeline.mReflectionMapManager.mRadiancePass = radiance_pass;
     }
 }
 
@@ -180,7 +187,7 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face)
     // hacky hot-swap of camera specific render targets
     gPipeline.mRT = &gPipeline.mAuxillaryRT;
 
-    probe->update(mRenderTarget.getWidth(), face);
+    probe->update(mRenderTarget.getWidth(), face, true);
     
     gPipeline.mRT = &gPipeline.mMainRT;
 
diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp
index efaf068bd2d..022b7d11d8f 100644
--- a/indra/newview/llreflectionmap.cpp
+++ b/indra/newview/llreflectionmap.cpp
@@ -49,7 +49,7 @@ LLReflectionMap::~LLReflectionMap()
     }
 }
 
-void LLReflectionMap::update(U32 resolution, U32 face)
+void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic)
 {
     LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
     mLastUpdateTime = gFrameTimeSeconds;
@@ -63,7 +63,8 @@ void LLReflectionMap::update(U32 resolution, U32 face)
     {
         resolution /= 2;
     }
-    gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, getNearClip(), getIsDynamic());
+    
+    gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, getNearClip(), getIsDynamic() || force_dynamic);
 }
 
 void LLReflectionMap::autoAdjustOrigin()
diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h
index 831a6358eee..a23bdc3a984 100644
--- a/indra/newview/llreflectionmap.h
+++ b/indra/newview/llreflectionmap.h
@@ -52,7 +52,7 @@ class alignas(16) LLReflectionMap : public LLRefCount
 
     // update this environment map
     // resolution - size of cube map to generate
-    void update(U32 resolution, U32 face);
+    void update(U32 resolution, U32 face, bool force_dynamic = false);
 
     // for volume partition probes, try to place this probe in the best spot
     void autoAdjustOrigin();
diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h
index 7b171128143..4ef6c5fdff0 100644
--- a/indra/newview/llreflectionmapmanager.h
+++ b/indra/newview/llreflectionmapmanager.h
@@ -104,6 +104,7 @@ class alignas(16) LLReflectionMapManager
 
 private:
     friend class LLPipeline;
+    friend class LLHeroProbeManager;
 
     // initialize mCubeFree array to default values
     void initCubeFree();
-- 
GitLab