summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-08-29 18:03:22 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-08-29 18:03:22 -0700
commit302bf29242ef1acd6ef984d78c918a6f4b092a0a (patch)
treeb90abaad5fb69e66c2661c53961040d0c592ccb3 /indra/newview
parente81b149c4a24a8ade827e34fa600207cfa86fc7f (diff)
parentd49e311a3729a955f5a249440efd8d76221d6b9a (diff)
Merge branch 'DRTVWR-559' of bitbucket.org:lindenlab/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/featuretable.txt6
-rw-r--r--indra/newview/llreflectionmapmanager.cpp47
-rw-r--r--indra/newview/llreflectionmapmanager.h10
4 files changed, 51 insertions, 23 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8a86faa18d..0d1870903b 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10313,6 +10313,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>RenderReflectionProbeCount</key>
+ <map>
+ <key>Comment</key>
+ <string>Number of reflection probes (maximum is 256, requires restart)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>256</integer>
+ </map>
<key>RenderReflectionProbeDrawDistance</key>
<map>
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index ec8605aa5c..3269158903 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -1,4 +1,4 @@
-version 35
+version 36
// The version number above should be incremented IF AND ONLY IF some
// change has been made that is sufficiently important to justify
// resetting the graphics preferences of all users to the recommended
@@ -64,6 +64,7 @@ RenderTextureMemoryMultiple 1 1.0
RenderCompressTextures 1 1
RenderShaderLightingMaxLevel 1 3
RenderPBR 1 1
+RenderReflectionProbeCount 1 256
RenderDeferred 1 1
RenderDeferredSSAO 1 1
RenderUseAdvancedAtmospherics 1 0
@@ -291,8 +292,11 @@ RenderGLContextCoreProfile 1 0
// AMD cards generally perform better when not using VBOs for streaming data
// AMD cards also prefer an OpenGL Compatibility Profile Context
+// HACK: Current AMD drivers have bugged cubemap arrays, limit number of reflection probes to 16
list AMD
RenderUseStreamVBO 1 0
RenderGLContextCoreProfile 1 0
+RenderReflectionProbeCount 1 16
+
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 583c6de77b..b285cc531e 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -40,7 +40,7 @@ extern BOOL gTeleportDisplay;
LLReflectionMapManager::LLReflectionMapManager()
{
- for (int i = 0; i < LL_REFLECTION_PROBE_COUNT; ++i)
+ for (int i = 0; i < LL_MAX_REFLECTION_PROBE_COUNT; ++i)
{
mCubeFree[i] = true;
}
@@ -76,16 +76,7 @@ void LLReflectionMapManager::update()
}
// =============== TODO -- move to an init function =================
-
- if (mTexture.isNull())
- {
- mTexture = new LLCubeMapArray();
- // store LL_REFLECTION_PROBE_COUNT+2 cube maps, final two cube maps are used for render target and radiance map generation source)
- mTexture->allocate(LL_REFLECTION_PROBE_RESOLUTION, 3, LL_REFLECTION_PROBE_COUNT+2);
-
- mIrradianceMaps = new LLCubeMapArray();
- mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, LL_REFLECTION_PROBE_COUNT);
- }
+ initReflectionMaps();
if (!mRenderTarget.isComplete())
{
@@ -167,7 +158,7 @@ void LLReflectionMapManager::update()
LLVector4a d;
if (!did_update &&
- i < LL_REFLECTION_PROBE_COUNT &&
+ i < mReflectionProbeCount &&
(oldestProbe == nullptr || probe->mLastUpdateTime < oldestProbe->mLastUpdateTime))
{
oldestProbe = probe;
@@ -317,7 +308,7 @@ LLReflectionMap* LLReflectionMapManager::registerViewerObject(LLViewerObject* vo
S32 LLReflectionMapManager::allocateCubeIndex()
{
- for (int i = 0; i < LL_REFLECTION_PROBE_COUNT; ++i)
+ for (int i = 0; i < mReflectionProbeCount; ++i)
{
if (mCubeFree[i])
{
@@ -327,7 +318,7 @@ S32 LLReflectionMapManager::allocateCubeIndex()
}
// no cubemaps free, steal one from the back of the probe list
- for (int i = mProbes.size() - 1; i >= LL_REFLECTION_PROBE_COUNT; --i)
+ for (int i = mProbes.size() - 1; i >= mReflectionProbeCount; --i)
{
if (mProbes[i]->mCubeIndex != -1)
{
@@ -392,7 +383,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
gPipeline.mRT = &gPipeline.mMainRT;
mRenderTarget.flush();
- S32 targetIdx = LL_REFLECTION_PROBE_COUNT;
+ S32 targetIdx = mReflectionProbeCount;
if (probe != mUpdatingProbe)
{ // this is the "realtime" probe that's updating every frame, use the secondary scratch space channel
@@ -625,15 +616,15 @@ void LLReflectionMapManager::updateUniforms()
// see class3/deferred/reflectionProbeF.glsl
struct ReflectionProbeData
{
- LLMatrix4 refBox[LL_REFLECTION_PROBE_COUNT]; // object bounding box as needed
- LLVector4 refSphere[LL_REFLECTION_PROBE_COUNT]; //origin and radius of refmaps in clip space
- LLVector4 refParams[LL_REFLECTION_PROBE_COUNT]; //extra parameters (currently only ambiance)
- GLint refIndex[LL_REFLECTION_PROBE_COUNT][4];
+ LLMatrix4 refBox[LL_MAX_REFLECTION_PROBE_COUNT]; // object bounding box as needed
+ LLVector4 refSphere[LL_MAX_REFLECTION_PROBE_COUNT]; //origin and radius of refmaps in clip space
+ LLVector4 refParams[LL_MAX_REFLECTION_PROBE_COUNT]; //extra parameters (currently only ambiance)
+ GLint refIndex[LL_MAX_REFLECTION_PROBE_COUNT][4];
GLint refNeighbor[4096];
GLint refmapCount;
};
- mReflectionMaps.resize(LL_REFLECTION_PROBE_COUNT);
+ mReflectionMaps.resize(mReflectionProbeCount);
getReflectionMaps(mReflectionMaps);
ReflectionProbeData rpd;
@@ -830,3 +821,19 @@ void LLReflectionMapManager::renderDebug()
gDebugProgram.unbind();
}
+
+void LLReflectionMapManager::initReflectionMaps()
+{
+ if (mTexture.isNull())
+ {
+ mReflectionProbeCount = llclamp(gSavedSettings.getS32("RenderReflectionProbeCount"), 1, LL_MAX_REFLECTION_PROBE_COUNT);
+
+ mTexture = new LLCubeMapArray();
+
+ // store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation source)
+ mTexture->allocate(LL_REFLECTION_PROBE_RESOLUTION, 3, mReflectionProbeCount + 2);
+
+ mIrradianceMaps = new LLCubeMapArray();
+ mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount);
+ }
+}
diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h
index 5f0b11ec17..29a9ece2f8 100644
--- a/indra/newview/llreflectionmapmanager.h
+++ b/indra/newview/llreflectionmapmanager.h
@@ -35,7 +35,7 @@ class LLSpatialGroup;
class LLViewerObject;
// number of reflection probes to keep in vram
-#define LL_REFLECTION_PROBE_COUNT 256
+#define LL_MAX_REFLECTION_PROBE_COUNT 256
// reflection probe resolution
#define LL_REFLECTION_PROBE_RESOLUTION 256
@@ -88,6 +88,9 @@ public:
// probe debug display is active
void renderDebug();
+ // call once at startup to allocate cubemap arrays
+ void initReflectionMaps();
+
private:
friend class LLPipeline;
@@ -120,7 +123,7 @@ private:
LLPointer<LLCubeMapArray> mIrradianceMaps;
// array indicating if a particular cubemap is free
- bool mCubeFree[LL_REFLECTION_PROBE_COUNT];
+ bool mCubeFree[LL_MAX_REFLECTION_PROBE_COUNT];
// start tracking the given spatial group
void trackGroup(LLSpatialGroup* group);
@@ -148,5 +151,8 @@ private:
LLReflectionMap* mUpdatingProbe = nullptr;
U32 mUpdatingFace = 0;
+
+ // number of reflection probes to use for rendering (based on saved setting RenderReflectionProbeCount)
+ U32 mReflectionProbeCount;
};