summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-08-17 19:14:40 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-08-17 19:14:40 -0400
commit0d9ddae0c6734f8ce76a5cdb40947f6da105c0b2 (patch)
tree02abf277b3658eda996914639326dffc59699136
parentd79ff40ee2bac1ddb9d721aa8a408a0f104d5a4d (diff)
Reduce number of full screen render targets
-rw-r--r--indra/newview/llviewerdisplay.cpp6
-rw-r--r--indra/newview/pipeline.cpp92
-rw-r--r--indra/newview/pipeline.h9
3 files changed, 60 insertions, 47 deletions
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 857af40601..2bafa6e3af 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -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"))
{
@@ -1110,6 +1116,10 @@ void LLPipeline::releaseGLBuffers()
mPostMap.release();
+ mFXAAMap.release();
+
+ mUIScreen.release();
+
mDownResMap.release();
for (U32 i = 0; i < 3; i++)
@@ -1149,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();
}
@@ -7125,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();
@@ -7136,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();
@@ -7156,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;
@@ -7175,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,
@@ -7410,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;