diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-12-01 12:52:21 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-12-01 12:52:21 -0500 |
commit | 27351b8bf59c3b2cfc31c27947397055a40b52d7 (patch) | |
tree | 6720e5dc77c8fee7f7fdecb46f220fb30247efb0 /indra/newview/pipeline.cpp | |
parent | c361ee133761412acf766f6680b14e29e60f8a1e (diff) | |
parent | 677938e6531209ca9ccd29146454af67f1c743c7 (diff) |
automated merge for viewer-2.0 -> avp.
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 118 |
1 files changed, 29 insertions, 89 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 5aad87630d..f908a015df 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -346,10 +346,7 @@ LLPipeline::LLPipeline() : mLightMovingMask(0), mLightingDetail(0), mScreenWidth(0), - mScreenHeight(0), - mViewportWidth(0), - mViewportHeight(0) - + mScreenHeight(0) { mNoiseMap = 0; mTrueNoiseMap = 0; @@ -517,46 +514,29 @@ 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); + allocateScreenBuffer(resX,resY); } } -void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height) +void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { - bool screen_size_changed = resX != mScreenWidth || resY != mScreenHeight; - bool viewport_size_changed = viewport_width != mViewportWidth || viewport_height != mViewportHeight; - - if (!screen_size_changed - && !viewport_size_changed) - { - // nothing to do - return; - } - // remember these dimensions mScreenWidth = resX; mScreenHeight = resY; - mViewportWidth = viewport_width; - mViewportHeight = viewport_height; - - llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl; - + U32 samples = gSavedSettings.getU32("RenderFSAASamples"); - U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); + if (res_mod > 1 && res_mod < resX && res_mod < resY) { resX /= res_mod; resY /= res_mod; } - if (gSavedSettings.getBOOL("RenderUIBuffer") - && screen_size_changed) + if (gSavedSettings.getBOOL("RenderUIBuffer")) { mUIScreen.allocate(resX,resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); } @@ -564,51 +544,30 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3 if (LLPipeline::sRenderDeferred) { //allocate deferred rendering color buffers - if (screen_size_changed) - { - 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); - addDeferredAttachments(mDeferredScreen); - } + 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); + addDeferredAttachments(mDeferredScreen); + // always set viewport to desired size, since allocate resets the viewport - mDeferredScreen.setViewport(viewport_width, viewport_height); - mDeferredDepth.setViewport(viewport_width, viewport_height); - if (screen_size_changed) - { - 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); + 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); for (U32 i = 0; i < 3; i++) { - if (screen_size_changed) - { - mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); - } - mDeferredLight[i].setViewport(viewport_width, viewport_height); + mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); } for (U32 i = 0; i < 2; i++) { - if (screen_size_changed) - { - mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); - } - mGIMapPost[i].setViewport(viewport_width, viewport_height); + mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); } F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale"); for (U32 i = 0; i < 4; i++) { - if (screen_size_changed) - { - mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE); - } - mShadow[i].setViewport(viewport_width, viewport_height); + mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE); } @@ -617,52 +576,36 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3 for (U32 i = 4; i < 6; i++) { - if (screen_size_changed) - { - mShadow[i].allocate(width, height, 0, TRUE, FALSE); - } - mShadow[i].setViewport(viewport_width, viewport_height); + mShadow[i].allocate(width, height, 0, TRUE, FALSE); } width = nhpo2(resX)/2; height = nhpo2(resY)/2; - if (screen_size_changed) - { - mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE); - } - mLuminanceMap.setViewport(viewport_width, viewport_height); + mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE); } else { - if (screen_size_changed) - { - mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); - } - mScreen.setViewport(viewport_width, viewport_height); + mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); } if (gGLManager.mHasFramebufferMultisample && samples > 1) { - if (screen_size_changed) + mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); + if (LLPipeline::sRenderDeferred) { - mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); - if (LLPipeline::sRenderDeferred) - { - addDeferredAttachments(mSampleBuffer); - mDeferredScreen.setSampleBuffer(&mSampleBuffer); - } + addDeferredAttachments(mSampleBuffer); + mDeferredScreen.setSampleBuffer(&mSampleBuffer); } - mSampleBuffer.setViewport(viewport_width, viewport_height); + mScreen.setSampleBuffer(&mSampleBuffer); stop_glerror(); } - if (LLPipeline::sRenderDeferred - && screen_size_changed) + if (LLPipeline::sRenderDeferred) { //share depth buffer between deferred targets mDeferredScreen.shareDepthBuffer(mScreen); for (U32 i = 0; i < 3; i++) @@ -762,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 @@ -777,11 +718,10 @@ void LLPipeline::createGLBuffers() mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); } - // force reallocation of buffers by clearing known dimensions + allocateScreenBuffer(resX,resY); mScreenWidth = 0; mScreenHeight = 0; - allocateScreenBuffer(resX,resY, viewport_width, viewport_height); } if (sRenderDeferred) |