summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2024-01-19 17:09:11 -0800
committerCosmic Linden <cosmic@lindenlab.com>2024-01-19 17:09:11 -0800
commit529d56ed9cc0b8399df79af40bea44431fc1def5 (patch)
treefd63903afbc157bb22daab2e409e5eac9dd71545 /indra
parent8a3d82dd5fb6a9c5003a60a67e1c8c204caa67ab (diff)
SL-20606: Fix cached probe flags for material preview potentially exceeding storage bounds
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llreflectionmapmanager.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 84f6dd7a4f..2b6985b214 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -28,7 +28,7 @@
#include "llreflectionmapmanager.h"
-#include <bitset>
+#include <vector>
#include "llviewercamera.h"
#include "llspatialpartition.h"
@@ -1389,14 +1389,16 @@ void LLReflectionMapManager::doOcclusion()
void LLReflectionMapManager::forceDefaultProbeAndUpdateUniforms(bool force)
{
- static std::bitset<LL_MAX_REFLECTION_PROBE_COUNT> mProbeWasOccluded;
+ static std::vector<bool> mProbeWasOccluded;
if (force)
{
+ llassert(mProbeWasOccluded.empty());
+
for (size_t i = 0; i < mProbes.size(); ++i)
{
auto& probe = mProbes[i];
- mProbeWasOccluded[i] = probe->mOccluded;
+ mProbeWasOccluded.push_back(probe->mOccluded);
if (probe != nullptr && probe != mDefaultProbe)
{
probe->mOccluded = true;
@@ -1407,11 +1409,16 @@ void LLReflectionMapManager::forceDefaultProbeAndUpdateUniforms(bool force)
}
else
{
- for (size_t i = 0; i < mProbes.size(); ++i)
+ llassert(mProbes.size() == mProbeWasOccluded.size());
+
+ const size_t n = llmin(mProbes.size(), mProbeWasOccluded.size());
+ for (size_t i = 0; i < n; ++i)
{
auto& probe = mProbes[i];
llassert(probe->mOccluded == (probe != mDefaultProbe));
probe->mOccluded = mProbeWasOccluded[i];
}
+ mProbeWasOccluded.clear();
+ mProbeWasOccluded.shrink_to_fit();
}
}