Skip to content

Commit 4ff1cbf

Browse files
committed
#3316 Crash in LLReflectionMap::getIsDynamic()
1 parent 50740c7 commit 4ff1cbf

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

indra/newview/llheroprobemanager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void LLHeroProbeManager::renderProbes()
222222
static LLCachedControl<S32> sUpdateRate(gSavedSettings, "RenderHeroProbeUpdateRate", 0);
223223

224224
F32 near_clip = 0.01f;
225-
if (mNearestHero != nullptr &&
225+
if (mNearestHero != nullptr && !mNearestHero->isDead() &&
226226
!gTeleportDisplay && !gDisconnected && !LLAppViewer::instance()->logoutRequestSent())
227227
{
228228
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("hpmu - realtime");
@@ -251,12 +251,13 @@ void LLHeroProbeManager::renderProbes()
251251
LL_PROFILE_ZONE_NUM(gFrameCount % rate);
252252
LL_PROFILE_ZONE_NUM(rate);
253253

254+
bool dynamic = mNearestHero->getReflectionProbeIsDynamic() && sDetail() > 0;
254255
for (U32 i = 0; i < 6; ++i)
255256
{
256257
if ((gFrameCount % rate) == (i % rate))
257258
{ // update 6/rate faces per frame
258259
LL_PROFILE_ZONE_NUM(i);
259-
updateProbeFace(mProbes[0], i, mNearestHero->getReflectionProbeIsDynamic() && sDetail > 0, near_clip);
260+
updateProbeFace(mProbes[0], i, dynamic, near_clip);
260261
}
261262
}
262263
generateRadiance(mProbes[0]);

indra/newview/llreflectionmap.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n
6565
}
6666

6767
F32 clip = (near_clip > 0) ? near_clip : getNearClip();
68+
bool dynamic = force_dynamic || getIsDynamic();
6869

69-
gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, clip, getIsDynamic() || force_dynamic, useClipPlane, clipPlane);
70+
gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, clip, dynamic, useClipPlane, clipPlane);
7071
}
7172

7273
void LLReflectionMap::autoAdjustOrigin()
@@ -185,7 +186,7 @@ void LLReflectionMap::autoAdjustOrigin()
185186
}
186187
}
187188

188-
bool LLReflectionMap::intersects(LLReflectionMap* other)
189+
bool LLReflectionMap::intersects(LLReflectionMap* other) const
189190
{
190191
LLVector4a delta;
191192
delta.setSub(other->mOrigin, mOrigin);
@@ -201,24 +202,24 @@ bool LLReflectionMap::intersects(LLReflectionMap* other)
201202

202203
extern LLControlGroup gSavedSettings;
203204

204-
F32 LLReflectionMap::getAmbiance()
205+
F32 LLReflectionMap::getAmbiance() const
205206
{
206207
F32 ret = 0.f;
207-
if (mViewerObject && mViewerObject->getVolume())
208+
if (mViewerObject && mViewerObject->getVolumeConst())
208209
{
209-
ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeAmbiance();
210+
ret = mViewerObject->getReflectionProbeAmbiance();
210211
}
211212

212213
return ret;
213214
}
214215

215-
F32 LLReflectionMap::getNearClip()
216+
F32 LLReflectionMap::getNearClip() const
216217
{
217218
const F32 MINIMUM_NEAR_CLIP = 0.1f;
218219

219220
F32 ret = 0.f;
220221

221-
if (mViewerObject && mViewerObject->getVolume())
222+
if (mViewerObject && mViewerObject->getVolumeConst())
222223
{
223224
ret = mViewerObject->getReflectionProbeNearClip();
224225
}
@@ -234,11 +235,13 @@ F32 LLReflectionMap::getNearClip()
234235
return llmax(ret, MINIMUM_NEAR_CLIP);
235236
}
236237

237-
bool LLReflectionMap::getIsDynamic()
238+
bool LLReflectionMap::getIsDynamic() const
238239
{
239-
if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY &&
240+
static LLCachedControl<S32> detail(gSavedSettings, "RenderReflectionProbeDetail", 1);
241+
if (detail() > (S32)LLReflectionMapManager::DetailLevel::STATIC_ONLY &&
240242
mViewerObject &&
241-
mViewerObject->getVolume())
243+
!mViewerObject->isDead() &&
244+
mViewerObject->getVolumeConst())
242245
{
243246
return mViewerObject->getReflectionProbeIsDynamic();
244247
}
@@ -278,12 +281,12 @@ bool LLReflectionMap::getBox(LLMatrix4& box)
278281
return false;
279282
}
280283

281-
bool LLReflectionMap::isActive()
284+
bool LLReflectionMap::isActive() const
282285
{
283286
return mCubeIndex != -1;
284287
}
285288

286-
bool LLReflectionMap::isRelevant()
289+
bool LLReflectionMap::isRelevant() const
287290
{
288291
static LLCachedControl<S32> RenderReflectionProbeLevel(gSavedSettings, "RenderReflectionProbeLevel", 3);
289292

indra/newview/llreflectionmap.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ class alignas(16) LLReflectionMap : public LLRefCount
5858
void autoAdjustOrigin();
5959

6060
// return true if given Reflection Map's influence volume intersect's with this one's
61-
bool intersects(LLReflectionMap* other);
61+
bool intersects(LLReflectionMap* other) const;
6262

6363
// Get the ambiance value to use for this probe
64-
F32 getAmbiance();
64+
F32 getAmbiance() const;
6565

6666
// Get the near clip plane distance to use for this probe
67-
F32 getNearClip();
67+
F32 getNearClip() const;
6868

6969
// Return true if this probe should include avatars in its reflection map
70-
bool getIsDynamic();
70+
bool getIsDynamic() const;
7171

7272
// get the encoded bounding box of this probe's influence volume
7373
// will only return a box if this probe is associated with a VOVolume
@@ -76,13 +76,13 @@ class alignas(16) LLReflectionMap : public LLRefCount
7676
bool getBox(LLMatrix4& box);
7777

7878
// return true if this probe is active for rendering
79-
bool isActive();
79+
bool isActive() const;
8080

8181
// perform occlusion query/readback
8282
void doOcclusion(const LLVector4a& eye);
8383

8484
// return false if this probe isn't currently relevant (for example, disabled due to graphics preferences)
85-
bool isRelevant();
85+
bool isRelevant() const;
8686

8787
// point at which environment map was last generated from (in agent space)
8888
LLVector4a mOrigin;

0 commit comments

Comments
 (0)