diff options
author | Brad Linden <brad@lindenlab.com> | 2024-10-29 15:43:21 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-10-29 15:43:21 -0700 |
commit | 74b0c86e48387e2154cb2acf03f626ca11229bce (patch) | |
tree | 0c74138a6d0c60eb5dffcc745464b58a6b315036 /indra/newview/lldynamictexture.cpp | |
parent | 9598e2f4cedd3dc36d447086273e0ed97967bbf9 (diff) | |
parent | 1a7909517368206d54407e54b9332aed1e4c9863 (diff) |
Merge brad/2549-downrez-controls into release/2024.09-ExtraFPS (#2864)
Diffstat (limited to 'indra/newview/lldynamictexture.cpp')
-rw-r--r-- | indra/newview/lldynamictexture.cpp | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index fe6cd4e37d..33325e352f 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -191,44 +191,42 @@ bool LLViewerDynamicTexture::updateAllInstances() return true; } - LLRenderTarget& bake_target = gPipeline.mAuxillaryRT.deferredScreen; - - if (!bake_target.isComplete()) + LLRenderTarget& preview_target = gPipeline.mAuxillaryRT.deferredScreen; + LLRenderTarget& bake_target = gPipeline.mBakeMap; + if (!preview_target.isComplete() || !bake_target.isComplete()) { llassert(false); return false; } - llassert(bake_target.getWidth() >= LLPipeline::MAX_BAKE_WIDTH); - llassert(bake_target.getHeight() >= LLPipeline::MAX_BAKE_WIDTH); + llassert(preview_target.getWidth() >= LLPipeline::MAX_PREVIEW_WIDTH); + llassert(preview_target.getHeight() >= LLPipeline::MAX_PREVIEW_WIDTH); + llassert(bake_target.getWidth() >= (U32) LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH); + llassert(bake_target.getHeight() >= (U32) LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT); - bake_target.bindTarget(); - bake_target.clear(); + preview_target.bindTarget(); + preview_target.clear(); LLGLSLShader::unbind(); LLVertexBuffer::unbind(); bool result = false; bool ret = false ; - for( S32 order = 0; order < ORDER_COUNT; order++ ) - { - for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin(); - iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter) + auto update_func = [&](LLViewerDynamicTexture* dynamicTexture, LLRenderTarget& renderTarget, S32 width, S32 height) { - LLViewerDynamicTexture *dynamicTexture = *iter; if (dynamicTexture->needsRender()) { - llassert(dynamicTexture->getFullWidth() <= S32(LLPipeline::MAX_BAKE_WIDTH)); - llassert(dynamicTexture->getFullHeight() <= S32(LLPipeline::MAX_BAKE_WIDTH)); + llassert(dynamicTexture->getFullWidth() <= width); + llassert(dynamicTexture->getFullHeight() <= height); glClear(GL_DEPTH_BUFFER_BIT); - gGL.color4f(1,1,1,1); - dynamicTexture->setBoundTarget(&bake_target); + gGL.color4f(1.f, 1.f, 1.f, 1.f); + dynamicTexture->setBoundTarget(&renderTarget); dynamicTexture->preRender(); // Must be called outside of startRender() result = false; if (dynamicTexture->render()) { - ret = true ; + ret = true; result = true; sNumRenders++; } @@ -237,9 +235,31 @@ bool LLViewerDynamicTexture::updateAllInstances() dynamicTexture->setBoundTarget(nullptr); dynamicTexture->postRender(result); } + }; + + // ORDER_FIRST is unused, ORDER_MIDDLE is various ui preview + for(S32 order = 0; order < ORDER_LAST; ++order) + { + for (LLViewerDynamicTexture* dynamicTexture : LLViewerDynamicTexture::sInstances[order]) + { + update_func(dynamicTexture, preview_target, LLPipeline::MAX_PREVIEW_WIDTH, LLPipeline::MAX_PREVIEW_WIDTH); } } + preview_target.flush(); + + // ORDER_LAST is baked skin preview, ORDER_RESET resets appearance parameters and does not render. + bake_target.bindTarget(); + bake_target.clear(); + result = false; + ret = false; + for (S32 order = ORDER_LAST; order < ORDER_COUNT; ++order) + { + for (LLViewerDynamicTexture* dynamicTexture : LLViewerDynamicTexture::sInstances[order]) + { + update_func(dynamicTexture, bake_target, LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT); + } + } bake_target.flush(); gGL.flush(); |