From ccd04cd66c0a550694fefe41042ef47466780a92 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 18 Jun 2013 17:24:21 -0500 Subject: Occlusion culling overhaul. --- indra/llrender/llrendertarget.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'indra/llrender/llrendertarget.cpp') diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 5fb4fc8e52..752486fdde 100755 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -53,11 +53,23 @@ void check_framebuffer_status() bool LLRenderTarget::sUseFBO = false; U32 LLRenderTarget::sCurFBO = 0; + +extern S32 gGLViewport[4]; + +//HEY DAVE HOOK THESE UP +U32 LLRenderTarget::sCurResX = 0; +U32 LLRenderTarget::sCurResY = 0; + + +/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + LLRenderTarget::LLRenderTarget() : mResX(0), mResY(0), mFBO(0), mPreviousFBO(0), + mPreviousResX(0), + mPreviousResY(0), mDepth(0), mStencil(0), mUseDepth(false), @@ -390,13 +402,12 @@ void LLRenderTarget::bindTarget() { if (mFBO) { - mPreviousFBO = sCurFBO; - stop_glerror(); + mPreviousFBO = sCurFBO; glBindFramebuffer(GL_FRAMEBUFFER, mFBO); sCurFBO = mFBO; - + stop_glerror(); if (gGLManager.mHasDrawBuffers) { //setup multiple render targets @@ -418,7 +429,12 @@ void LLRenderTarget::bindTarget() stop_glerror(); } + mPreviousResX = sCurResX; + mPreviousResY = sCurResY; glViewport(0, 0, mResX, mResY); + sCurResX = mResX; + sCurResY = mResY; + sBoundTarget = this; } @@ -489,6 +505,20 @@ void LLRenderTarget::flush(bool fetch_depth) stop_glerror(); glBindFramebuffer(GL_FRAMEBUFFER, mPreviousFBO); sCurFBO = mPreviousFBO; + + if (mPreviousFBO) + { + glViewport(0, 0, mPreviousResX, mPreviousResY); + sCurResX = mPreviousResX; + sCurResY = mPreviousResY; + } + else + { + glViewport(gGLViewport[0],gGLViewport[1],gGLViewport[2],gGLViewport[3]); + sCurResX = gGLViewport[2]; + sCurResY = gGLViewport[3]; + } + stop_glerror(); } } -- cgit v1.2.3 From 45b1466de60dc1788353508debbb321b59875884 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 18 Jun 2013 19:51:02 -0500 Subject: Review cleanup --- indra/llrender/llrendertarget.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llrender/llrendertarget.cpp') diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 752486fdde..6e22712b94 100755 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -56,13 +56,9 @@ U32 LLRenderTarget::sCurFBO = 0; extern S32 gGLViewport[4]; -//HEY DAVE HOOK THESE UP U32 LLRenderTarget::sCurResX = 0; U32 LLRenderTarget::sCurResY = 0; - -/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - LLRenderTarget::LLRenderTarget() : mResX(0), mResY(0), -- cgit v1.2.3