summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-08-19 20:15:47 +0300
committerGitHub <noreply@github.com>2024-08-19 20:15:47 +0300
commit6dd8dcb9ce5d6b5293f44da2ef6231ec967e23db (patch)
treecab66da8892fc7a888661778135355b1b6441748 /indra/newview
parentf929c4f0fdf8f3036dee2a7b9b4e0ad38c8de070 (diff)
parent54fd466b3b036116ca20b6b7ee856c99b1646f53 (diff)
Merge pull request #2329 from RyeMutt/probe-fixes
Various fixes to probe memory usage
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llheroprobemanager.cpp4
-rw-r--r--indra/newview/llheroprobemanager.h7
-rw-r--r--indra/newview/llreflectionmapmanager.cpp12
-rw-r--r--indra/newview/llviewerdisplay.cpp6
-rw-r--r--indra/newview/pipeline.cpp98
-rw-r--r--indra/newview/pipeline.h9
6 files changed, 74 insertions, 62 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 91051f8235..ce419498cf 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -586,7 +586,6 @@ void LLHeroProbeManager::cleanup()
{
mVertexBuffer = nullptr;
mRenderTarget.release();
- mHeroRenderTarget.release();
mMipChain.clear();
@@ -594,10 +593,7 @@ void LLHeroProbeManager::cleanup()
mProbes.clear();
- mReflectionMaps.clear();
-
mDefaultProbe = nullptr;
- mUpdatingProbe = nullptr;
}
void LLHeroProbeManager::doOcclusion()
diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h
index 28852770c3..58a94a3de8 100644
--- a/indra/newview/llheroprobemanager.h
+++ b/indra/newview/llheroprobemanager.h
@@ -104,8 +104,6 @@ private:
// used to generate mipmaps without doing a copy-to-texture
LLRenderTarget mRenderTarget;
- LLRenderTarget mHeroRenderTarget;
-
std::vector<LLRenderTarget> mMipChain;
// storage for reflection probe radiance maps (plus two scratch space cubemaps)
@@ -124,11 +122,6 @@ private:
// list of active reflection maps
std::vector<LLPointer<LLReflectionMap>> mProbes;
- // list of maps being used for rendering
- std::vector<LLReflectionMap*> mReflectionMaps;
-
- LLReflectionMap* mUpdatingProbe = nullptr;
-
LLPointer<LLReflectionMap> mDefaultProbe; // default reflection probe to fall back to for pixels with no probe influences (should always be at cube index 0)
// number of reflection probes to use for rendering
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 1efe51c1aa..3526004071 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -1371,13 +1371,21 @@ void LLReflectionMapManager::initReflectionMaps()
{
U32 count = LL_MAX_REFLECTION_PROBE_COUNT;
- if (mTexture.isNull() || mReflectionProbeCount != count || mReset)
+ static LLCachedControl<U32> ref_probe_res(gSavedSettings, "RenderReflectionProbeResolution", 128U);
+ U32 probe_resolution = nhpo2(llclamp(ref_probe_res(), (U32)64, (U32)512));
+ if (mTexture.isNull() || mReflectionProbeCount != count || mProbeResolution != probe_resolution || mReset)
{
+ if(mProbeResolution != probe_resolution)
+ {
+ mRenderTarget.release();
+ mMipChain.clear();
+ }
+
gEXRImage = nullptr;
mReset = false;
mReflectionProbeCount = count;
- mProbeResolution = nhpo2(llclamp(gSavedSettings.getU32("RenderReflectionProbeResolution"), (U32)64, (U32)512));
+ mProbeResolution = probe_resolution;
mMaxProbeLOD = log2f((F32)mProbeResolution) - 1.f; // number of mips - 1
if (mTexture.isNull() ||
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index fbbcf9bd84..8c6a38876a 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1603,7 +1603,7 @@ void render_ui_2d()
LLView::sIsRectDirty = false;
LLRect t_rect;
- gPipeline.mRT->uiScreen.bindTarget();
+ gPipeline.mUIScreen.bindTarget();
gGL.setColorMask(true, true);
{
static const S32 pad = 8;
@@ -1635,7 +1635,7 @@ void render_ui_2d()
gViewerWindow->draw();
}
- gPipeline.mRT->uiScreen.flush();
+ gPipeline.mUIScreen.flush();
gGL.setColorMask(true, false);
LLView::sDirtyRect = t_rect;
@@ -1645,7 +1645,7 @@ void render_ui_2d()
LLGLDisable blend(GL_BLEND);
S32 width = gViewerWindow->getWindowWidthScaled();
S32 height = gViewerWindow->getWindowHeightScaled();
- gGL.getTexUnit(0)->bind(&gPipeline.mRT->uiScreen);
+ gGL.getTexUnit(0)->bind(&gPipeline.mUIScreen);
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.color4f(1.f,1.f,1.f,1.f);
gGL.texCoord2f(0.f, 0.f); gGL.vertex2i(0, 0);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index a5c7350fd8..98fdb68222 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -777,7 +777,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (mRT == &mMainRT)
{ // hacky -- allocate auxillary buffer
- gCubeSnapshot = TRUE;
+ gCubeSnapshot = true;
if (sReflectionProbesEnabled)
{
@@ -812,17 +812,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
resY /= res_mod;
}
- //water reflection texture (always needed as scratch space whether or not transparent water is enabled)
- mWaterDis.allocate(resX, resY, GL_RGBA16F, true);
-
- if (RenderUIBuffer)
- {
- if (!mRT->uiScreen.allocate(resX,resY, GL_RGBA))
- {
- return false;
- }
- }
-
S32 shadow_detail = RenderShadowDetail;
bool ssao = RenderDeferredSSAO;
@@ -836,15 +825,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mRT->deferredScreen.shareDepthBuffer(mRT->screen);
- if (samples > 0)
- {
- if (!mRT->fxaaBuffer.allocate(resX, resY, GL_RGBA)) return false;
- }
- else
- {
- mRT->fxaaBuffer.release();
- }
-
if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0)
{ //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa
if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false;
@@ -856,19 +836,45 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
allocateShadowBuffer(resX, resY);
- if (!gCubeSnapshot && RenderScreenSpaceReflections) // hack to not allocate mSceneMap for cube snapshots
+ if (!gCubeSnapshot) // hack to not re-allocate various targets for cube snapshots
{
- mSceneMap.allocate(resX, resY, GL_RGB, true);
- }
+ if (RenderUIBuffer)
+ {
+ if (!mUIScreen.allocate(resX, resY, GL_RGBA))
+ {
+ return false;
+ }
+ }
- const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR");
- const U32 post_color_fmt = post_hdr ? GL_RGBA16F : GL_RGBA;
- mPostMap.allocate(resX, resY, post_color_fmt);
+ if (samples > 0)
+ {
+ if (!mFXAAMap.allocate(resX, resY, GL_RGBA)) return false;
+ }
+ else
+ {
+ mFXAAMap.release();
+ }
- // used to scale down textures
- // See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
- mDownResMap.allocate(4, 4, GL_RGBA);
+ //water reflection texture (always needed as scratch space whether or not transparent water is enabled)
+ mWaterDis.allocate(resX, resY, GL_RGBA16F, true);
+ if(RenderScreenSpaceReflections)
+ {
+ mSceneMap.allocate(resX, resY, GL_RGB, true);
+ }
+ else
+ {
+ mSceneMap.release();
+ }
+
+ const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR");
+ const U32 post_color_fmt = post_hdr ? GL_RGBA16F : GL_RGBA;
+ mPostMap.allocate(resX, resY, post_color_fmt);
+
+ // used to scale down textures
+ // See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
+ mDownResMap.allocate(4, 4, GL_RGBA);
+ }
//HACK make screenbuffer allocations start failing after 30 seconds
if (gSavedSettings.getBOOL("SimulateFBOFailure"))
{
@@ -890,7 +896,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
S32 shadow_detail = RenderShadowDetail;
- F32 scale = llmax(0.f, RenderShadowResolutionScale);
+ F32 scale = gCubeSnapshot ? 1.0f : llmax(0.f, RenderShadowResolutionScale); // Don't scale probe shadow maps
U32 sun_shadow_map_width = BlurHappySize(resX, scale);
U32 sun_shadow_map_height = BlurHappySize(resY, scale);
@@ -1110,6 +1116,10 @@ void LLPipeline::releaseGLBuffers()
mPostMap.release();
+ mFXAAMap.release();
+
+ mUIScreen.release();
+
mDownResMap.release();
for (U32 i = 0; i < 3; i++)
@@ -1117,6 +1127,8 @@ void LLPipeline::releaseGLBuffers()
mGlow[i].release();
}
+ mHeroProbeManager.cleanup(); // release hero probes
+
releaseScreenBuffers();
gBumpImageList.destroyGL();
@@ -1147,15 +1159,15 @@ void LLPipeline::releaseShadowBuffers()
void LLPipeline::releaseScreenBuffers()
{
- mRT->uiScreen.release();
mRT->screen.release();
- mRT->fxaaBuffer.release();
mRT->deferredScreen.release();
mRT->deferredLight.release();
- mHeroProbeRT.uiScreen.release();
+ mAuxillaryRT.screen.release();
+ mAuxillaryRT.deferredScreen.release();
+ mAuxillaryRT.deferredLight.release();
+
mHeroProbeRT.screen.release();
- mHeroProbeRT.fxaaBuffer.release();
mHeroProbeRT.deferredScreen.release();
mHeroProbeRT.deferredLight.release();
}
@@ -7123,7 +7135,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
{
{
llassert(!gCubeSnapshot);
- bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete();
+ bool multisample = RenderFSAASamples > 1 && mFXAAMap.isComplete();
LLGLSLShader* shader = &gGlowCombineProgram;
S32 width = dst->getWidth();
@@ -7134,7 +7146,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
{
LL_PROFILE_GPU_ZONE("aa");
// bake out texture2D with RGBL for FXAA shader
- mRT->fxaaBuffer.bindTarget();
+ mFXAAMap.bindTarget();
shader = &gGlowCombineFXAAProgram;
shader->bind();
@@ -7154,16 +7166,16 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
shader->unbind();
- mRT->fxaaBuffer.flush();
+ mFXAAMap.flush();
dst->bindTarget();
shader = &gFXAAProgram;
shader->bind();
- channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mRT->fxaaBuffer.getUsage());
+ channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage());
if (channel > -1)
{
- mRT->fxaaBuffer.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
+ mFXAAMap.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
}
gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
@@ -7173,8 +7185,8 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
- F32 scale_x = (F32)width / mRT->fxaaBuffer.getWidth();
- F32 scale_y = (F32)height / mRT->fxaaBuffer.getHeight();
+ F32 scale_x = (F32)width / mFXAAMap.getWidth();
+ F32 scale_y = (F32)height / mFXAAMap.getHeight();
shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y);
shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y,
@@ -7408,7 +7420,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
{ // combine result based on alpha
dst->bindTarget();
- if (RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete())
+ if (RenderFSAASamples > 1 && mFXAAMap.isComplete())
{
glViewport(0, 0, dst->getWidth(), dst->getHeight());
}
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 4164474238..024303d5f0 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -687,10 +687,7 @@ public:
//screen texture
LLRenderTarget screen;
- LLRenderTarget uiScreen;
LLRenderTarget deferredScreen;
- LLRenderTarget fxaaBuffer;
- LLRenderTarget edgeMap;
LLRenderTarget deferredLight;
//sun shadow map
@@ -726,6 +723,12 @@ public:
// tonemapped and gamma corrected render ready for post
LLRenderTarget mPostMap;
+ // FXAA helper target
+ LLRenderTarget mFXAAMap;
+
+ // render ui to buffer target
+ LLRenderTarget mUIScreen;
+
// downres scratch space for GPU downscaling of textures
LLRenderTarget mDownResMap;