summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp51
1 files changed, 23 insertions, 28 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 507c726e02..f908a015df 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -344,7 +344,9 @@ LLPipeline::LLPipeline() :
mWLSkyPool(NULL),
mLightMask(0),
mLightMovingMask(0),
- mLightingDetail(0)
+ mLightingDetail(0),
+ mScreenWidth(0),
+ mScreenHeight(0)
{
mNoiseMap = 0;
mTrueNoiseMap = 0;
@@ -512,22 +514,22 @@ void LLPipeline::resizeScreenTexture()
LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE);
if (gPipeline.canUseVertexShaders() && assertInitialized())
{
- GLuint resX = gViewerWindow->getWindowWidthRaw();
- GLuint resY = gViewerWindow->getWindowHeightRaw();
- GLuint view_width = gViewerWindow->getWorldViewWidthRaw();
- GLuint view_height = gViewerWindow->getWorldViewHeightRaw();
+ GLuint resX = gViewerWindow->getWorldViewWidthRaw();
+ GLuint resY = gViewerWindow->getWorldViewHeightRaw();
- allocateScreenBuffer(resX, resY, view_width, view_height);
-
- llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl;
+ allocateScreenBuffer(resX,resY);
}
}
-void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height)
+void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
{
+ // remember these dimensions
+ mScreenWidth = resX;
+ mScreenHeight = resY;
+
U32 samples = gSavedSettings.getU32("RenderFSAASamples");
-
U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor");
+
if (res_mod > 1 && res_mod < resX && res_mod < resY)
{
resX /= res_mod;
@@ -544,24 +546,21 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3
//allocate deferred rendering color buffers
mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
- mDeferredScreen.setViewport(viewport_width, viewport_height);
- mDeferredDepth.setViewport(viewport_width, viewport_height);
addDeferredAttachments(mDeferredScreen);
+
+ // always set viewport to desired size, since allocate resets the viewport
+
mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
mEdgeMap.allocate(resX, resY, GL_ALPHA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
- mScreen.setViewport(viewport_width, viewport_height);
- mEdgeMap.setViewport(viewport_width, viewport_height);
for (U32 i = 0; i < 3; i++)
{
mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE);
- mDeferredLight[i].setViewport(viewport_width, viewport_height);
}
for (U32 i = 0; i < 2; i++)
{
mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE);
- mGIMapPost[i].setViewport(viewport_width, viewport_height);
}
F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale");
@@ -569,7 +568,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3
for (U32 i = 0; i < 4; i++)
{
mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE);
- mShadow[i].setViewport(viewport_width, viewport_height);
}
@@ -579,7 +577,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3
for (U32 i = 4; i < 6; i++)
{
mShadow[i].allocate(width, height, 0, TRUE, FALSE);
- mShadow[i].setViewport(viewport_width, viewport_height);
}
@@ -587,27 +584,24 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3
width = nhpo2(resX)/2;
height = nhpo2(resY)/2;
mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE);
- mLuminanceMap.setViewport(viewport_width, viewport_height);
}
else
{
mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
- mScreen.setViewport(viewport_width, viewport_height);
}
if (gGLManager.mHasFramebufferMultisample && samples > 1)
{
mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples);
- mSampleBuffer.setViewport(viewport_width, viewport_height);
- mScreen.setSampleBuffer(&mSampleBuffer);
-
if (LLPipeline::sRenderDeferred)
{
addDeferredAttachments(mSampleBuffer);
mDeferredScreen.setSampleBuffer(&mSampleBuffer);
}
+ mScreen.setSampleBuffer(&mSampleBuffer);
+
stop_glerror();
}
@@ -711,10 +705,8 @@ void LLPipeline::createGLBuffers()
stop_glerror();
- GLuint resX = gViewerWindow->getWindowWidthRaw();
- GLuint resY = gViewerWindow->getWindowHeightRaw();
- GLuint viewport_width = gViewerWindow->getWorldViewWidthRaw();
- GLuint viewport_height = gViewerWindow->getWorldViewHeightRaw();
+ GLuint resX = gViewerWindow->getWorldViewWidthRaw();
+ GLuint resY = gViewerWindow->getWorldViewHeightRaw();
if (LLPipeline::sRenderGlow)
{ //screen space glow buffers
@@ -726,7 +718,10 @@ void LLPipeline::createGLBuffers()
mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE);
}
- allocateScreenBuffer(resX,resY, viewport_width, viewport_height);
+ allocateScreenBuffer(resX,resY);
+ mScreenWidth = 0;
+ mScreenHeight = 0;
+
}
if (sRenderDeferred)