diff options
author | Rye Mutt <rye@lindenlab.com> | 2024-09-16 16:46:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-16 16:46:14 -0700 |
commit | 42975dfd8868454172ca0c3fcfa9ae18cb1d4de8 (patch) | |
tree | 8c1ad88deba9255c042a5cc0140c3cb0913e9e30 | |
parent | eac0c748a2f650a7875e29e9ccc65522f485911b (diff) | |
parent | 85a7020e4903e83701c3f1ccbc9a14bd84c9368b (diff) |
Merge pull request #2580 from RyeMutt/2kbom
Raise resolution of local baked texture preview from 512 to 2048
-rw-r--r-- | indra/llappearance/llavatarappearancedefines.cpp | 4 | ||||
-rw-r--r-- | indra/newview/character/avatar_lad.xml | 46 | ||||
-rw-r--r-- | indra/newview/lldynamictexture.cpp | 54 | ||||
-rw-r--r-- | indra/newview/llgltfmaterialpreviewmgr.cpp | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 6 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 5 |
6 files changed, 72 insertions, 45 deletions
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp index 580e6433c5..5f98f2c8c1 100644 --- a/indra/llappearance/llavatarappearancedefines.cpp +++ b/indra/llappearance/llavatarappearancedefines.cpp @@ -28,8 +28,8 @@ #include "llavatarappearancedefines.h" #include "indra_constants.h" -const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024; -const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024; +const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 2048; +const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 2048; using namespace LLAvatarAppearanceDefines; diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 2cdd86267e..90dc361a5c 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="US-ASCII" standalone="yes"?> +<?xml version="1.0" encoding="us-ascii" standalone="yes"?> <linden_avatar version="2.0" wearable_definition_version="22"> <!-- The wearable_definition_version is checked during asset upload. --> @@ -8923,8 +8923,8 @@ <!-- =========================================================== --> <layer_set body_region="hair" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer name="base" @@ -9013,8 +9013,8 @@ <layer_set body_region="head" - width="512" - height="512"> + width="2048" + height="2048"> <layer name="head bump base" fixed_color = "128,128,128,255" @@ -10149,8 +10149,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="upper_body" - width="512" - height="512"> + width="2048" + height="2048"> <layer name="base_upperbody bump" render_pass="bump" @@ -11458,8 +11458,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="lower_body" - width="512" - height="512"> + width="2048" + height="2048"> <layer name="lower body bump base" fixed_color = "128,128,128,255" @@ -12448,8 +12448,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="eyes" - width="128" - height="128"> + width="512" + height="512"> <layer name="whites"> <texture @@ -12535,8 +12535,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="skirt" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer name="skirt_fabric" @@ -12774,8 +12774,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="leftarm" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer name="base" @@ -12850,8 +12850,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="leftleg" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer name="base" @@ -12925,8 +12925,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="aux1" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer @@ -13002,8 +13002,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="aux2" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer @@ -13079,8 +13079,8 @@ render_pass="bump"> <!-- =========================================================== --> <layer_set body_region="aux3" - width="512" - height="512" + width="2048" + height="2048" clear_alpha="false"> <layer diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index fe6cd4e37d..0b9f76e7f6 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() >= LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH); + llassert(bake_target.getHeight() >= 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(); diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index 294b445694..cf6b08797d 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -193,7 +193,7 @@ LLGLTFPreviewTexture::LLGLTFPreviewTexture(LLPointer<LLFetchedGLTFMaterial> mate // static LLPointer<LLGLTFPreviewTexture> LLGLTFPreviewTexture::create(LLPointer<LLFetchedGLTFMaterial> material) { - return new LLGLTFPreviewTexture(material, LLPipeline::MAX_BAKE_WIDTH); + return new LLGLTFPreviewTexture(material, LLPipeline::MAX_PREVIEW_WIDTH); } bool LLGLTFPreviewTexture::needsRender() diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 88871f5fb8..13dfd48643 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -219,7 +219,7 @@ S32 LLPipeline::RenderHeroProbeUpdateRate; S32 LLPipeline::RenderHeroProbeConservativeUpdateMultiplier; LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize"); -const U32 LLPipeline::MAX_BAKE_WIDTH = 512; +const U32 LLPipeline::MAX_PREVIEW_WIDTH = 512; const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f; @@ -878,6 +878,8 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY) // used to scale down textures // See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown mDownResMap.allocate(4, 4, GL_RGBA); + + mBakeMap.allocate(LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT, GL_RGBA); } //HACK make screenbuffer allocations start failing after 30 seconds if (gSavedSettings.getBOOL("SimulateFBOFailure")) @@ -1138,6 +1140,8 @@ void LLPipeline::releaseGLBuffers() mDownResMap.release(); + mBakeMap.release(); + for (U32 i = 0; i < 3; i++) { mGlow[i].release(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index a3ecab3208..5c9b95ef4a 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -737,6 +737,9 @@ public: // downres scratch space for GPU downscaling of textures LLRenderTarget mDownResMap; + // 2k bom scratch target + LLRenderTarget mBakeMap; + LLCullResult mSky; LLCullResult mReflectedObjects; LLCullResult mRefractedObjects; @@ -776,7 +779,7 @@ public: //water distortion texture (refraction) LLRenderTarget mWaterDis; - static const U32 MAX_BAKE_WIDTH; + static const U32 MAX_PREVIEW_WIDTH; //texture for making the glow LLRenderTarget mGlow[3]; |