summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-08-23 18:36:56 -0700
committerGraham Linden <graham@lindenlab.com>2019-08-23 18:36:56 -0700
commitd195a3b08d664a98c17a81ec43aa84707631a234 (patch)
treee4688d28ce8126fcb5a807deee48c541242772f6 /indra
parent2329beb3d3e3ad6501b6614578861012e4d9f4b0 (diff)
SL-11778
Make RenderShadowResolutionScale work again, also decoupling shadow buffer alloc/release/resize from screen buffer resize function.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewercontrol.cpp9
-rw-r--r--indra/newview/llviewerdisplay.cpp9
-rw-r--r--indra/newview/llviewerdisplay.h1
-rw-r--r--indra/newview/pipeline.cpp119
-rw-r--r--indra/newview/pipeline.h7
5 files changed, 94 insertions, 51 deletions
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index b1d47b7d75..e2da4f63fb 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -94,6 +94,7 @@ LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warning
std::string gLastRunVersion;
extern BOOL gResizeScreenTexture;
+extern BOOL gResizeShadowTexture;
extern BOOL gDebugGL;
////////////////////////////////////////////////////////////////////////////
// Listeners
@@ -191,6 +192,12 @@ bool handleRenderTransparentWaterChanged(const LLSD& newvalue)
}
+static bool handleShadowsResized(const LLSD& newvalue)
+{
+ gPipeline.requestResizeShadowTexture();
+ return true;
+}
+
static bool handleWindowResized(const LLSD& newvalue)
{
gPipeline.requestResizeScreenTexture();
@@ -623,7 +630,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2));
- gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleWindowResized, _2));
+ gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleShadowsResized, _2));
gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 0fb687aead..09b9d5f836 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -94,6 +94,7 @@ BOOL gForceRenderLandFence = FALSE;
BOOL gDisplaySwapBuffers = FALSE;
BOOL gDepthDirty = FALSE;
BOOL gResizeScreenTexture = FALSE;
+BOOL gResizeShadowTexture = FALSE;
BOOL gWindowResized = FALSE;
BOOL gSnapshot = FALSE;
BOOL gShaderProfileFrame = FALSE;
@@ -249,7 +250,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER);
- if (gWindowResized || gResizeScreenTexture)
+ if (gWindowResized)
{ //skip render on frames where window has been resized
LL_RECORD_BLOCK_TIME(FTM_RESIZE_WINDOW);
gGL.flush();
@@ -262,6 +263,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
return;
}
+ if (gResizeShadowTexture)
+ { //skip render on frames where window has been resized
+ gPipeline.resizeShadowTexture();
+ gResizeShadowTexture = FALSE;
+ }
+
if (LLPipeline::sRenderDeferred)
{ //hack to make sky show up in deferred snapshots
for_snapshot = FALSE;
diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h
index f6467d7f93..e8072193ea 100644
--- a/indra/newview/llviewerdisplay.h
+++ b/indra/newview/llviewerdisplay.h
@@ -40,6 +40,7 @@ extern BOOL gTeleportDisplay;
extern LLFrameTimer gTeleportDisplayTimer;
extern BOOL gForceRenderLandFence;
extern BOOL gResizeScreenTexture;
+extern BOOL gResizeShadowTexture;
extern BOOL gWindowResized;
#endif // LL_LLVIEWERDISPLAY_H
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 9b6bf9bfc3..7048b921b0 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -740,6 +740,18 @@ void LLPipeline::requestResizeScreenTexture()
gResizeScreenTexture = TRUE;
}
+void LLPipeline::requestResizeShadowTexture()
+{
+ gResizeShadowTexture = TRUE;
+}
+
+void LLPipeline::resizeShadowTexture()
+{
+ releaseShadowTargets();
+ allocateShadowBuffer(mScreenWidth, mScreenHeight);
+ gResizeShadowTexture = FALSE;
+}
+
void LLPipeline::resizeScreenTexture()
{
LL_RECORD_BLOCK_TIME(FTM_RESIZE_SCREEN_TEXTURE);
@@ -748,23 +760,12 @@ void LLPipeline::resizeScreenTexture()
GLuint resX = gViewerWindow->getWorldViewWidthRaw();
GLuint resY = gViewerWindow->getWorldViewHeightRaw();
- if ((resX != mScreen.getWidth()) || (resY != mScreen.getHeight()))
+ if (gResizeScreenTexture || (resX != mScreen.getWidth()) || (resY != mScreen.getHeight()))
{
releaseScreenBuffers();
- if (!allocateScreenBuffer(resX,resY))
- {
-#if PROBABLE_FALSE_DISABLES_OF_ALM_HERE
- //FAILSAFE: screen buffer allocation failed, disable deferred rendering if it's enabled
- //NOTE: if the session closes successfully after this call, deferred rendering will be
- // disabled on future sessions
- if (LLPipeline::sRenderDeferred)
- {
- gSavedSettings.setBOOL("RenderDeferred", FALSE);
- LLPipeline::refreshCachedSettings();
-
- }
-#endif
- }
+ releaseShadowTargets();
+ allocateScreenBuffer(resX,resY);
+ gResizeScreenTexture = FALSE;
}
}
}
@@ -869,9 +870,6 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
return ret;
}
- // must be even to avoid a stripe in the horizontal shadow blur
-inline U32 BlurHappySize(U32 x, U32 scale) { return (((x*scale)+1)&~1); }
-
bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
{
refreshCachedSettings();
@@ -939,6 +937,54 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mDeferredLight.release();
}
+ allocateShadowBuffer(resX, resY);
+
+ //HACK make screenbuffer allocations start failing after 30 seconds
+ if (gSavedSettings.getBOOL("SimulateFBOFailure"))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ mDeferredLight.release();
+
+ releaseShadowTargets();
+
+ mFXAABuffer.release();
+ mScreen.release();
+ mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
+ mDeferredDepth.release();
+ mOcclusionDepth.release();
+
+ if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
+ }
+
+ if (LLPipeline::sRenderDeferred)
+ { //share depth buffer between deferred targets
+ mDeferredScreen.shareDepthBuffer(mScreen);
+ }
+
+ gGL.getTexUnit(0)->disable();
+
+ stop_glerror();
+
+ return true;
+}
+
+// must be even to avoid a stripe in the horizontal shadow blur
+inline U32 BlurHappySize(U32 x, F32 scale) { return U32( x * scale + 16.0f) & ~0xF; }
+
+bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY)
+{
+ refreshCachedSettings();
+
+ if (LLPipeline::sRenderDeferred)
+ {
+ S32 shadow_detail = RenderShadowDetail;
+
+ const U32 occlusion_divisor = 3;
+
F32 scale = RenderShadowResolutionScale;
U32 sun_shadow_map_width = BlurHappySize(resX, scale);
U32 sun_shadow_map_height = BlurHappySize(resY, scale);
@@ -992,36 +1038,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
releaseShadowTarget(i);
}
}
-
- //HACK make screenbuffer allocations start failing after 30 seconds
- if (gSavedSettings.getBOOL("SimulateFBOFailure"))
- {
- return false;
- }
}
- else
- {
- mDeferredLight.release();
-
- releaseShadowTargets();
-
- mFXAABuffer.release();
- mScreen.release();
- mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
- mDeferredDepth.release();
- mOcclusionDepth.release();
-
- if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
- }
-
- if (LLPipeline::sRenderDeferred)
- { //share depth buffer between deferred targets
- mDeferredScreen.shareDepthBuffer(mScreen);
- }
-
- gGL.getTexUnit(0)->disable();
-
- stop_glerror();
return true;
}
@@ -1190,6 +1207,11 @@ void LLPipeline::releaseLUTBuffers()
}
}
+void LLPipeline::releaseShadowBuffers()
+{
+ releaseShadowTargets();
+}
+
void LLPipeline::releaseScreenBuffers()
{
mUIScreen.release();
@@ -1199,8 +1221,7 @@ void LLPipeline::releaseScreenBuffers()
mDeferredScreen.release();
mDeferredDepth.release();
mDeferredLight.release();
- mOcclusionDepth.release();
- releaseShadowTargets();
+ mOcclusionDepth.release();
}
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 44aa9d85fa..e75a09d753 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -101,10 +101,16 @@ public:
void resetVertexBuffers();
void doResetVertexBuffers(bool forced = false);
void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks...
+ void requestResizeShadowTexture(); // set flag only, no work, safer for callbacks...
+
void resizeScreenTexture();
+ void resizeShadowTexture();
+
void releaseGLBuffers();
void releaseLUTBuffers();
void releaseScreenBuffers();
+ void releaseShadowBuffers();
+
void createGLBuffers();
void createLUTBuffers();
@@ -126,6 +132,7 @@ public:
//attempt to allocate screen buffers at resX, resY
//returns true if allocation successful, false otherwise
bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples);
+ bool allocateShadowBuffer(U32 resX, U32 resY);
void allocatePhysicsBuffer();