summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-06-17 14:05:18 -0500
committerDave Parks <davep@lindenlab.com>2022-06-17 14:05:18 -0500
commitfb5ff6a5388dc9622089e9937e8d81bc319cf3dd (patch)
treec11022867d250223ca098af6f0fc9cd82f04166c
parent18b0aa03717cd8209b6c239457bcf69f0d39ecf7 (diff)
SL-17287 Slightly less hacky and much less crash cube snapshot render target allocation.
-rw-r--r--indra/newview/llreflectionmapmanager.cpp19
-rw-r--r--indra/newview/pipeline.cpp15
-rw-r--r--indra/newview/pipeline.h7
3 files changed, 20 insertions, 21 deletions
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 48ed22d79f..752427f0fa 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -38,11 +38,6 @@
extern BOOL gCubeSnapshot;
extern BOOL gTeleportDisplay;
-//#pragma optimize("", off)
-
-// experimental pipeline render target override, if this works, do something less hacky
-LLPipeline::RenderTargetPack gProbeRT;
-
LLReflectionMapManager::LLReflectionMapManager()
{
for (int i = 0; i < LL_REFLECTION_PROBE_COUNT; ++i)
@@ -95,15 +90,6 @@ void LLReflectionMapManager::update()
const bool use_stencil_buffer = true;
U32 targetRes = LL_REFLECTION_PROBE_RESOLUTION * 2; // super sample
mRenderTarget.allocate(targetRes, targetRes, color_fmt, use_depth_buffer, use_stencil_buffer, LLTexUnit::TT_RECT_TEXTURE);
-
- // hack to allocate render targets using gPipeline code
- gCubeSnapshot = TRUE;
- auto* old_rt = gPipeline.mRT;
- gPipeline.mRT = &gProbeRT;
- gPipeline.allocateScreenBuffer(targetRes, targetRes);
- gPipeline.allocateShadowBuffer(targetRes, targetRes);
- gPipeline.mRT = old_rt;
- gCubeSnapshot = FALSE;
}
if (mMipChain.empty())
@@ -404,10 +390,9 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
{
mRenderTarget.bindTarget();
// hacky hot-swap of camera specific render targets
- auto* old_rt = gPipeline.mRT;
- gPipeline.mRT = &gProbeRT;
+ gPipeline.mRT = &gPipeline.mAuxillaryRT;
probe->update(mRenderTarget.getWidth(), face);
- gPipeline.mRT = old_rt;
+ gPipeline.mRT = &gPipeline.mMainRT;
mRenderTarget.flush();
// generate mipmaps
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 8bac5131cf..028a0db95c 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -436,7 +436,7 @@ void LLPipeline::init()
{
refreshCachedSettings();
- mRT = new RenderTargetPack();
+ mRT = &mMainRT;
gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize");
@@ -696,9 +696,6 @@ void LLPipeline::cleanup()
mDeferredVB = NULL;
mCubeVB = NULL;
-
- delete mRT;
- mRT = nullptr;
}
//============================================================================
@@ -840,6 +837,16 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
+ if (mRT == &mMainRT)
+ { // hacky -- allocate auxillary buffer
+ gCubeSnapshot = TRUE;
+ mRT = &mAuxillaryRT;
+ U32 res = LL_REFLECTION_PROBE_RESOLUTION * 2;
+ allocateScreenBuffer(res, res, 0);
+ mRT = &mMainRT;
+ gCubeSnapshot = FALSE;
+ }
+
// remember these dimensions
mRT->width = resX;
mRT->height = resY;
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index f05b7aec8e..c83d7c16eb 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -666,6 +666,13 @@ public:
LLRenderTarget shadowOcclusion[4];
};
+ // main full resoltuion render target
+ RenderTargetPack mMainRT;
+
+ // auxillary 512x512 render target pack
+ RenderTargetPack mAuxillaryRT;
+
+ // currently used render target pack
RenderTargetPack* mRT;
LLRenderTarget mSpotShadow[2];