diff options
| author | Cosmic Linden <cosmic@lindenlab.com> | 2024-02-16 09:49:45 -0800 |
|---|---|---|
| committer | Cosmic Linden <cosmic@lindenlab.com> | 2024-02-16 12:59:23 -0800 |
| commit | 3e4e414011b032e64b5fd477f2c561fc2b4553f7 (patch) | |
| tree | 6a608482916a4ada71aa852940c5b624ca28577b /indra/newview/llgltfmaterialpreviewmgr.cpp | |
| parent | 1552ee3a5d72a1d6b2dc536d033d4c2d8f2e74ee (diff) | |
secondlife/viewer-issues#72: Material preview shouldRender should return false if no render needed
Diffstat (limited to 'indra/newview/llgltfmaterialpreviewmgr.cpp')
| -rw-r--r-- | indra/newview/llgltfmaterialpreviewmgr.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index 901db87eed..36bd552c31 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -58,6 +58,15 @@ LLGLTFPreviewTexture::MaterialLoadLevels::MaterialLoadLevels() } } +bool LLGLTFPreviewTexture::MaterialLoadLevels::isFullyLoaded() +{ + for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i) + { + if (levels[i] != FULLY_LOADED) { return false; } + } + return true; +} + S32& LLGLTFPreviewTexture::MaterialLoadLevels::operator[](size_t i) { llassert(i >= 0 && i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT); @@ -187,17 +196,26 @@ LLPointer<LLGLTFPreviewTexture> LLGLTFPreviewTexture::create(LLPointer<LLFetched return new LLGLTFPreviewTexture(material, LLPipeline::MAX_BAKE_WIDTH); } -void LLGLTFPreviewTexture::preRender(BOOL clear_depth) +BOOL LLGLTFPreviewTexture::needsRender() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; + if (!mShouldRender && mBestLoad.isFullyLoaded()) { return false; } MaterialLoadLevels current_load = get_material_load_levels(*mGLTFMaterial.get()); if (current_load < mBestLoad) { mShouldRender = true; mBestLoad = current_load; + return true; } + return false; +} + +void LLGLTFPreviewTexture::preRender(BOOL clear_depth) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; + llassert(mShouldRender); if (!mShouldRender) { return; } LLViewerDynamicTexture::preRender(clear_depth); |
