From dc7aa170b80bb7d3f7725b5bddce08ff2da5a7a7 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 16 Jul 2019 14:12:37 -0700 Subject: SL-11610 Give bake its own RT to avoid issues with sharing the water distortion map. Use glFinish to insure RTs will be complete. --- indra/newview/lldynamictexture.cpp | 13 ++++++++----- indra/newview/pipeline.cpp | 8 +++++--- indra/newview/pipeline.h | 2 ++ 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index e1f41a9bd7..13d539b55f 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -129,7 +129,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth) llassert(mFullHeight <= 512); llassert(mFullWidth <= 512); - if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI) + if (gGLManager.mHasFramebufferObject && gPipeline.mBake.isComplete() && !gGLManager.mIsATI) { //using offscreen render target, just use the bottom left corner mOrigin.set(0, 0); } @@ -216,11 +216,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances() return FALSE; } - bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI; + bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mBake.isComplete() && !gGLManager.mIsATI; if (use_fbo) { - gPipeline.mWaterDis.bindTarget(); + gPipeline.mBake.bindTarget(); + gPipeline.mBake.clear(); } LLGLSLShader::bindNoShader(); @@ -240,7 +241,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() gDepthDirty = TRUE; gGL.color4f(1,1,1,1); - dynamicTexture->setBoundTarget(use_fbo ? &gPipeline.mWaterDis : nullptr); + dynamicTexture->setBoundTarget(use_fbo ? &gPipeline.mBake : nullptr); dynamicTexture->preRender(); // Must be called outside of startRender() result = FALSE; if (dynamicTexture->render()) @@ -257,9 +258,11 @@ BOOL LLViewerDynamicTexture::updateAllInstances() } } + glFinish(); + if (use_fbo) { - gPipeline.mWaterDis.flush(); + gPipeline.mBake.flush(); } gGL.flush(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 863785889f..eb1ffc91f7 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1162,6 +1162,7 @@ void LLPipeline::releaseGLBuffers() mWaterRef.release(); mWaterDis.release(); + mBake.release(); mHighlight.release(); for (U32 i = 0; i < 3; i++) @@ -1221,12 +1222,13 @@ void LLPipeline::createGLBuffers() if (LLPipeline::sWaterReflections) { //water reflection texture U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512); - mWaterRef.allocate(res,res,GL_RGBA,TRUE,FALSE); - //always use FBO for mWaterDis so it can be used for avatar texture bakes - mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE,LLTexUnit::TT_TEXTURE, true); + mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE,LLTexUnit::TT_TEXTURE); } + // Use FBO for bake tex + mBake.allocate(512, 512, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, true); + mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE); stop_glerror(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index b0c40d145b..cc9ec06f80 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -650,6 +650,8 @@ public: //water distortion texture (refraction) LLRenderTarget mWaterDis; + LLRenderTarget mBake; + //texture for making the glow LLRenderTarget mGlow[3]; -- cgit v1.2.3