From ab87978cbc71cd4c83648627998055a010700f05 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 27 Jun 2024 13:12:43 -0500 Subject: 1836 dont store texture in system memory unless absolutely necessary (#1843) * #1836 Texture memory usage overhaul. Much decrufting - don't keep a copy of textures in system memory - use GPU to downrez textures instead of reloading from cache - use GPU to generate brightness/darkness bumpmaps --- indra/newview/gltf/buffer_util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/gltf') diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index 40f9448aaf..89cedf4a47 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -180,6 +180,16 @@ namespace LL data[3] = src[3]; } + template<> + inline void copyVec4(U8* src, U64& dst) + { + U8* data = (U8*)&dst; + data[0] = src[0]; + data[1] = src[1]; + data[2] = src[2]; + data[3] = src[3]; + } + template<> inline void copyVec4(U16* src, LLColor4U& dst) { -- cgit v1.2.3 From 08b933a0c67463f06f124420f16c8a3f7dc83f1f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Jul 2024 17:42:24 -0500 Subject: #1870 Tune up for better experience on integrated intel with low memory (#1872) * More deterministic vsize calculation. Add control for choosing downscale method. * Quick hack to make GLTF preview work again --- indra/newview/gltf/accessor.h | 2 -- indra/newview/gltf/asset.cpp | 1 + indra/newview/gltf/common.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/gltf') diff --git a/indra/newview/gltf/accessor.h b/indra/newview/gltf/accessor.h index ec68c5f624..85ea0f2967 100644 --- a/indra/newview/gltf/accessor.h +++ b/indra/newview/gltf/accessor.h @@ -36,8 +36,6 @@ namespace LL { namespace GLTF { - constexpr S32 INVALID_INDEX = -1; - class Buffer { public: diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp index a454e68a92..e07befef3b 100644 --- a/indra/newview/gltf/asset.cpp +++ b/indra/newview/gltf/asset.cpp @@ -476,6 +476,7 @@ void Asset::update() { // HACK - force texture to be loaded full rez // TODO: calculate actual vsize image.mTexture->addTextureStats(2048.f * 2048.f); + image.mTexture->setBoostLevel(LLViewerTexture::BOOST_HIGH); } } } diff --git a/indra/newview/gltf/common.h b/indra/newview/gltf/common.h index b9698d4017..742daff715 100644 --- a/indra/newview/gltf/common.h +++ b/indra/newview/gltf/common.h @@ -43,6 +43,8 @@ namespace LL { namespace GLTF { + constexpr S32 INVALID_INDEX = -1; + using Value = boost::json::value; using mat4 = glm::mat4; -- cgit v1.2.3 From 9fdca96f8bd2211a99fe88e57b70cbecefa20b6d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 8 Jul 2024 20:27:14 +0200 Subject: Re-enable compiler warnings C4244 and C4396 except for lltracerecording.h and llunittype.h for now --- indra/newview/gltf/accessor.cpp | 4 ++-- indra/newview/gltf/animation.cpp | 4 ++-- indra/newview/gltf/asset.cpp | 8 ++++---- indra/newview/gltf/buffer_util.h | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/gltf') diff --git a/indra/newview/gltf/accessor.cpp b/indra/newview/gltf/accessor.cpp index 2ef9237f2d..d1845605d4 100644 --- a/indra/newview/gltf/accessor.cpp +++ b/indra/newview/gltf/accessor.cpp @@ -104,7 +104,7 @@ namespace LL void Buffer::erase(Asset& asset, S32 offset, S32 length) { - S32 idx = this - &asset.mBuffers[0]; + S32 idx = (S32)(this - &asset.mBuffers[0]); mData.erase(mData.begin() + offset, mData.begin() + offset + length); @@ -197,7 +197,7 @@ bool Buffer::save(Asset& asset, const std::string& folder) { if (mName.empty()) { - S32 idx = this - &asset.mBuffers[0]; + S32 idx = (S32)(this - &asset.mBuffers[0]); mUri = llformat("buffer_%d.bin", idx); } else diff --git a/indra/newview/gltf/animation.cpp b/indra/newview/gltf/animation.cpp index 3dff67d746..31549986af 100644 --- a/indra/newview/gltf/animation.cpp +++ b/indra/newview/gltf/animation.cpp @@ -127,8 +127,8 @@ void Animation::apply(Asset& asset, float time) bool Animation::Sampler::prep(Asset& asset) { Accessor& accessor = asset.mAccessors[mInput]; - mMinTime = accessor.mMin[0]; - mMaxTime = accessor.mMax[0]; + mMinTime = (F32)accessor.mMin[0]; + mMaxTime = (F32)accessor.mMax[0]; mFrameTimes.resize(accessor.mCount); diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp index e07befef3b..5ba5951064 100644 --- a/indra/newview/gltf/asset.cpp +++ b/indra/newview/gltf/asset.cpp @@ -105,7 +105,7 @@ void Node::updateTransforms(Asset& asset, const mat4& parentMatrix) mAssetMatrixInv = glm::inverse(mAssetMatrix); - S32 my_index = this - &asset.mNodes[0]; + S32 my_index = (S32)(this - &asset.mNodes[0]); for (auto& childIndex : mChildren) { @@ -271,11 +271,11 @@ S32 Asset::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, local_end = p; // pointer math to get the node index - node_hit = &node - &mNodes[0]; + node_hit = (S32)(&node - &mNodes[0]); llassert(&mNodes[node_hit] == &node); //pointer math to get the primitive index - primitive_hit = &primitive - &mesh.mPrimitives[0]; + primitive_hit = (S32)(&primitive - &mesh.mPrimitives[0]); llassert(&mesh.mPrimitives[primitive_hit] == &primitive); } } @@ -1028,7 +1028,7 @@ bool Image::save(Asset& asset, const std::string& folder) const std::string& delim = gDirUtilp->getDirDelimiter(); if (name.empty()) { - S32 idx = this - asset.mImages.data(); + S32 idx = (S32)(this - asset.mImages.data()); name = llformat("image_%d", idx); } diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index 89cedf4a47..ef9bba8128 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -161,7 +161,7 @@ namespace LL template<> inline void copyVec3(U16* src, LLColor4U& dst) { - dst.set(src[0], src[1], src[2], 255); + dst.set((U8)(src[0]), (U8)(src[1]), (U8)(src[2]), 255); } template<> @@ -193,13 +193,13 @@ namespace LL template<> inline void copyVec4(U16* src, LLColor4U& dst) { - dst.set(src[0], src[1], src[2], src[3]); + dst.set((U8)(src[0]), (U8)(src[1]), (U8)(src[2]), ((U8)src[3])); } template<> inline void copyVec4(F32* src, LLColor4U& dst) { - dst.set(src[0]*255, src[1]*255, src[2]*255, src[3]*255); + dst.set((U8)(src[0]*255.f), (U8)(src[1]*255.f), (U8)(src[2]*255.f), (U8)(src[3]*255.f)); } template<> @@ -902,7 +902,7 @@ namespace LL { if (src.is_int64()) { - dst = src.get_int64(); + dst = (U32)src.get_int64(); return true; } return false; @@ -957,7 +957,7 @@ namespace LL { if (src.is_int64()) { - dst = src.get_int64(); + dst = (U32)src.get_int64(); return true; } return false; -- cgit v1.2.3 From 98941831e4afab1cd5ccb5bab995a671df320f72 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 11 Jul 2024 11:36:36 -0500 Subject: Fix for GLTF scenes not uploading (#1994) --- indra/newview/gltf/asset.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/gltf') diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp index 5ba5951064..c210b9c61d 100644 --- a/indra/newview/gltf/asset.cpp +++ b/indra/newview/gltf/asset.cpp @@ -991,6 +991,12 @@ bool Image::prep(Asset& asset) return false; } + if (!asset.mFilename.empty()) + { // local preview, boost image so it doesn't discard and force to save raw image in case we save out or upload + mTexture->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); + mTexture->forceToSaveRawImage(0, F32_MAX); + } + return true; } -- cgit v1.2.3 From af93e581929f79b9a21ead6fca0a3c58c498b0d5 Mon Sep 17 00:00:00 2001 From: Zi Ree <81702435+zi-ree@users.noreply.github.com> Date: Fri, 12 Jul 2024 18:08:56 +0200 Subject: Initialize array before use (#2011) gcc detects usage of this array as uninitialized, so make sure it's initialized. I am not sure if this is a legitimate warning, or if the code guarantees the array gets initialized before use in lines 140-142 and this is a performance optimization. --- indra/newview/gltf/primitive.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/gltf') diff --git a/indra/newview/gltf/primitive.cpp b/indra/newview/gltf/primitive.cpp index e1579374d4..81caff8ab2 100644 --- a/indra/newview/gltf/primitive.cpp +++ b/indra/newview/gltf/primitive.cpp @@ -109,7 +109,7 @@ struct MikktMesh for (U32 tri_idx = 0; tri_idx < U32(triangle_count); ++tri_idx) { - U32 idx[3]; + U32 idx[3] = {0, 0, 0}; if (prim->mMode == Primitive::Mode::TRIANGLES) { -- cgit v1.2.3