summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye <rye@lindenlab.com>2025-01-09 20:43:45 -0500
committerRye <rye@lindenlab.com>2025-01-09 20:43:45 -0500
commitc883c7f2d97787c8db0050b1cfac9c22cb5e2309 (patch)
tree2eb13ce2f042f325c193ad4b7ae5c40082acb95c
parent8d57388a9ec67c6fb4dc2a17c0317f71ea294681 (diff)
Drop reflection probes and mirrors to RGBA8 when hdr is disabled to minimize vram usage and chance of probe nans (#2558)
-rw-r--r--indra/llrender/llcubemaparray.cpp6
-rw-r--r--indra/llrender/llcubemaparray.h2
-rw-r--r--indra/newview/llheroprobemanager.cpp10
-rw-r--r--indra/newview/llreflectionmapmanager.cpp12
-rw-r--r--indra/newview/llviewercontrol.cpp6
5 files changed, 25 insertions, 11 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp
index 4f5e13765a..635f079581 100644
--- a/indra/llrender/llcubemaparray.cpp
+++ b/indra/llrender/llcubemaparray.cpp
@@ -109,7 +109,7 @@ LLCubeMapArray::~LLCubeMapArray()
{
}
-void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips)
+void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips, bool hdr)
{
U32 texname = 0;
mWidth = resolution;
@@ -128,6 +128,10 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
free_cur_tex_image();
U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F;
+ if (!hdr)
+ {
+ format = components == 4 ? GL_RGBA8 : GL_RGB8;
+ }
U32 mip = 0;
U32 mip_resolution = resolution;
while (mip_resolution >= 1)
diff --git a/indra/llrender/llcubemaparray.h b/indra/llrender/llcubemaparray.h
index 675aaaf07c..bfc72a321d 100644
--- a/indra/llrender/llcubemaparray.h
+++ b/indra/llrender/llcubemaparray.h
@@ -52,7 +52,7 @@ public:
// components - number of components per pixel
// count - number of cube maps in the array
// use_mips - if true, mipmaps will be allocated for this cube map array and anisotropic filtering will be used
- void allocate(U32 res, U32 components, U32 count, bool use_mips = true);
+ void allocate(U32 res, U32 components, U32 count, bool use_mips = true, bool hdr = true);
void bind(S32 stage);
void unbind();
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index ce419498cf..aa6371eff4 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -89,9 +89,11 @@ void LLHeroProbeManager::update()
initReflectionMaps();
+ static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
+
if (!mRenderTarget.isComplete())
{
- U32 color_fmt = GL_RGBA16F;
+ U32 color_fmt = render_hdr ? GL_RGBA16F : GL_RGBA8;
mRenderTarget.allocate(mProbeResolution, mProbeResolution, color_fmt, true);
}
@@ -103,7 +105,7 @@ void LLHeroProbeManager::update()
mMipChain.resize(count);
for (U32 i = 0; i < count; ++i)
{
- mMipChain[i].allocate(res, res, GL_RGBA16F);
+ mMipChain[i].allocate(res, res, render_hdr ? GL_RGBA16F : GL_RGBA8);
res /= 2;
}
}
@@ -537,8 +539,10 @@ void LLHeroProbeManager::initReflectionMaps()
mTexture = new LLCubeMapArray();
+ static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
+
// store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation source)
- mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2);
+ mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2, true, render_hdr);
if (mDefaultProbe.isNull())
{
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 4a2ecee694..4760ab376e 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -223,9 +223,11 @@ void LLReflectionMapManager::update()
initReflectionMaps();
+ static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
+
if (!mRenderTarget.isComplete())
{
- U32 color_fmt = GL_RGB16F;
+ U32 color_fmt = render_hdr ? GL_RGBA16F : GL_RGBA8;
U32 targetRes = mProbeResolution * 4; // super sample
mRenderTarget.allocate(targetRes, targetRes, color_fmt, true);
}
@@ -238,7 +240,7 @@ void LLReflectionMapManager::update()
mMipChain.resize(count);
for (U32 i = 0; i < count; ++i)
{
- mMipChain[i].allocate(res, res, GL_RGB16F);
+ mMipChain[i].allocate(res, res, render_hdr ? GL_RGB16F : GL_RGB8);
res /= 2;
}
}
@@ -1415,11 +1417,13 @@ void LLReflectionMapManager::initReflectionMaps()
{
mTexture = new LLCubeMapArray();
+ static LLCachedControl<bool> render_hdr(gSavedSettings, "RenderHDREnabled", true);
+
// store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation source)
- mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2);
+ mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2, true, render_hdr);
mIrradianceMaps = new LLCubeMapArray();
- mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, false);
+ mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, false, render_hdr);
}
// reset probe state
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 18746e76fc..d4a033bd42 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -261,6 +261,8 @@ static bool handleDisableVintageMode(const LLSD& newvalue)
static bool handleEnableHDR(const LLSD& newvalue)
{
+ gPipeline.mReflectionMapManager.reset();
+ gPipeline.mHeroProbeManager.reset();
return handleReleaseGLBufferChanged(newvalue) && handleSetShaderChanged(newvalue);
}
@@ -448,11 +450,11 @@ static bool handleReflectionProbeDetailChanged(const LLSD& newvalue)
if (gPipeline.isInit())
{
LLPipeline::refreshCachedSettings();
+ gPipeline.mReflectionMapManager.reset();
+ gPipeline.mHeroProbeManager.reset();
gPipeline.releaseGLBuffers();
gPipeline.createGLBuffers();
LLViewerShaderMgr::instance()->setShaders();
- gPipeline.mReflectionMapManager.reset();
- gPipeline.mHeroProbeManager.reset();
}
return true;
}