From 57805cac68bbc67ecb8a8e76c0ced2ce9b622dd1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 28 Jun 2022 15:15:57 -0500 Subject: SL-17379 More complete integration of material asset type --- indra/newview/llviewerregion.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 67ad72e997..6345323ff9 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -3095,6 +3095,8 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("UpdateScriptTask"); capabilityNames.append("UpdateSettingsAgentInventory"); capabilityNames.append("UpdateSettingsTaskInventory"); + capabilityNames.append("UpdateMaterialAgentInventory"); + capabilityNames.append("UpdateMaterialTaskInventory"); capabilityNames.append("UploadBakedTexture"); capabilityNames.append("UserInfo"); capabilityNames.append("ViewerAsset"); -- cgit v1.2.3 From 1900df361558313f10e8b27ada03bcefd41241d9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 4 Oct 2022 12:20:19 -0500 Subject: SL-18293, SL-18190 -- Fix for debug displays not showing up (wireframe still busted). WIP on reflection probe/PBR driven water shader. --- indra/newview/llviewerregion.cpp | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 8f56f6110f..19f8cc105e 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -830,6 +830,9 @@ void LLViewerRegion::sendReliableMessage() void LLViewerRegion::setWaterHeight(F32 water_level) { mImpl->mLandp->setWaterHeight(water_level); + + // reflection probes move with the water height + updateReflectionProbes(); } F32 LLViewerRegion::getWaterHeight() const @@ -1233,6 +1236,45 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const return mImpl ? mImpl->mVisibleGroups.size() : 0; } +void LLViewerRegion::updateReflectionProbes() +{ + const F32 probe_spacing = 32.f; + const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); + const F32 hover_height = 2.f; + + F32 start = probe_spacing * 0.5f; + + U32 grid_width = REGION_WIDTH_METERS / probe_spacing; + + mReflectionMaps.resize(grid_width * grid_width); + + F32 water_height = getWaterHeight(); + LLVector3 origin = getOriginAgent(); + + for (U32 i = 0; i < grid_width; ++i) + { + F32 x = i * probe_spacing + start; + for (U32 j = 0; j < grid_width; ++j) + { + F32 y = j * probe_spacing + start; + + U32 idx = i * grid_width + j; + + if (mReflectionMaps[idx].isNull()) + { + mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); + } + + LLVector3 probe_origin = LLVector3(x,y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x,y))); + probe_origin.mV[2] += hover_height; + probe_origin += origin; + + mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); + mReflectionMaps[idx]->mRadius = probe_radius; + } + } +} + void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { if(!sVOCacheCullingEnabled) -- cgit v1.2.3 From 30bcc7d6d5fa4ceedfec28cc0973c253364c555e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 5 Oct 2022 08:11:33 -0500 Subject: SL-18190 WIP - Add refraction to water without splitting scene between above and below water --- indra/newview/llviewerregion.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 19f8cc105e..628d0ecc6a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -830,9 +830,6 @@ void LLViewerRegion::sendReliableMessage() void LLViewerRegion::setWaterHeight(F32 water_level) { mImpl->mLandp->setWaterHeight(water_level); - - // reflection probes move with the water height - updateReflectionProbes(); } F32 LLViewerRegion::getWaterHeight() const -- cgit v1.2.3 From dafa93304335c3c48042e4b5a014dea2480f253f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 11 Oct 2022 16:33:51 -0500 Subject: SL-18190 Fix for mystery circle showing up on east side of reflection probes. Add one probe to rule them all as a fallback for pixels that aren't inside any influence volume. --- indra/newview/llviewerregion.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 628d0ecc6a..3167d1161c 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1235,6 +1235,7 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const void LLViewerRegion::updateReflectionProbes() { +#if 1 const F32 probe_spacing = 32.f; const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); const F32 hover_height = 2.f; @@ -1270,6 +1271,7 @@ void LLViewerRegion::updateReflectionProbes() mReflectionMaps[idx]->mRadius = probe_radius; } } +#endif } void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) -- cgit v1.2.3 From bda420662710e95de1b3f6ff954459b4bb6c3b01 Mon Sep 17 00:00:00 2001 From: "Brad Kittenbrink (Brad Linden)" Date: Mon, 10 Oct 2022 16:10:10 -0700 Subject: WIP for SL-18103 and SL-17697 live editing of materials using ModifyMaterialParams cap --- indra/newview/llviewerregion.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 3167d1161c..31752a5a8b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -3082,6 +3082,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("MeshUploadFlag"); + capabilityNames.append("ModifyMaterialParams"); capabilityNames.append("NavMeshGenerationStatus"); capabilityNames.append("NewFileAgentInventory"); capabilityNames.append("ObjectAnimation"); -- cgit v1.2.3 From 1971839517519657fc895c9cb12c47317dde6b39 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 10:00:37 -0800 Subject: Basic solution for SL-18458 vocache implementation for material overrides --- indra/newview/llviewerregion.cpp | 48 ++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 7 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 36d8fffa7c..0e7fd63c7f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -53,6 +53,7 @@ #include "llfloatergodtools.h" #include "llfloaterreporter.h" #include "llfloaterregioninfo.h" +#include "llgltfmateriallist.h" #include "llhttpnode.h" #include "llregioninfomodel.h" #include "llsdutil.h" @@ -214,6 +215,7 @@ public: LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation. LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation. std::set mNonCacheableCreatedList; //list of local ids of all non-cacheable objects + LLVOCacheEntry::vocache_extras_entry_map_t mCacheExtraJson; // for materials // time? // LRU info? @@ -782,7 +784,10 @@ void LLViewerRegion::loadObjectCache() if(LLVOCache::instanceExists()) { - LLVOCache::getInstance()->readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; + LLVOCache & vocache = LLVOCache::instance(); + vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; + vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheExtraJson); + if (mImpl->mCacheMap.empty()) { mCacheDirty = TRUE; @@ -807,8 +812,10 @@ void LLViewerRegion::saveObjectCache() { const F32 start_time_threshold = 600.0f; //seconds bool removal_enabled = sVOCacheCullingEnabled && (mRegionTimer.getElapsedTimeF32() > start_time_threshold); //allow to remove invalid objects from object cache file. - - LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; + + LLVOCache & instance = LLVOCache::instance(); + instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; + instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mCacheExtraJson, mCacheDirty, removal_enabled); mCacheDirty = FALSE; } @@ -1823,7 +1830,7 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) LLViewerObject* obj = NULL; if(!entry->getEntry()->hasDrawable()) //not added to the rendering pipeline yet - { + { //add the object obj = gObjectList.processObjectUpdateFromCache(entry, this); if(obj) @@ -2598,7 +2605,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB LL_DEBUGS("AnimatedObjects") << " got update for local_id " << local_id << LL_ENDL; dumpStack("AnimatedObjectsStack"); - // Update the cache entry + // Update the cache entry entry->updateEntry(crc, dp); decodeBoundingInfo(entry); @@ -2615,7 +2622,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB // Create new entry and add to map result = CACHE_UPDATE_ADDED; entry = new LLVOCacheEntry(local_id, crc, dp); - record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(0)); + record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(0)); mImpl->mCacheMap[local_id] = entry; @@ -2633,6 +2640,22 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec return result; } +void LLViewerRegion::cacheFullUpdateExtras(LLSD const & extras, std::string const & extras_raw) +{ + LLUUID object_id = extras["object_id"].asUUID(); + LLViewerObject * obj = gObjectList.findObject(object_id); + if (obj != nullptr) + { + U32 local_id = obj->getLocalID(); + + mImpl->mCacheExtraJson[local_id] = LLVOCacheEntry::ExtrasEntry{extras, extras_raw}; + } + else + { + LL_WARNS() << "got material override for unknown object_id, cannot cache it" << LL_ENDL; + } +} + LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) { if(!sVOCacheCullingEnabled) @@ -2657,7 +2680,7 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id, bool valid) } } return NULL; - } +} void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type) { @@ -2731,6 +2754,9 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss entry->setValid(); decodeBoundingInfo(entry); + + loadCacheMiscExtras(local_id, entry, crc); + return true; } else @@ -3514,3 +3540,11 @@ std::string LLViewerRegion::getSimHostName() return std::string("..."); } +void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc) +{ + auto iter = mImpl->mCacheExtraJson.find(local_id); + if (iter != mImpl->mCacheExtraJson.end()) + { + LLGLTFMaterialList::loadCacheOverrides(iter->second.extras_raw); + } +} -- cgit v1.2.3 From ade79bc6f6b6269dbcb88f3dff2db6584d0c2f53 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 18 Nov 2022 21:06:48 +0200 Subject: SL-18677 Disable materials UI when materials caps are not available --- indra/newview/llviewerregion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0e7fd63c7f..5ecc081782 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2652,7 +2652,7 @@ void LLViewerRegion::cacheFullUpdateExtras(LLSD const & extras, std::string cons } else { - LL_WARNS() << "got material override for unknown object_id, cannot cache it" << LL_ENDL; + LL_WARNS("GLTF") << "got material override for unknown object_id, cannot cache it" << LL_ENDL; } } -- cgit v1.2.3 From 32984b56ea8fa4f4357379a40627b5e9267d7543 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 24 Nov 2022 12:16:59 +0200 Subject: SL-18701 llsd is not thread safe, parse it before using --- indra/newview/llviewerregion.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 5ecc081782..e3ac1767fb 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -215,7 +215,7 @@ public: LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation. LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation. std::set mNonCacheableCreatedList; //list of local ids of all non-cacheable objects - LLVOCacheEntry::vocache_extras_entry_map_t mCacheExtraJson; // for materials + LLVOCacheEntry::vocache_gltf_overrides_map_t mGLTFOverridesJson; // for materials // time? // LRU info? @@ -786,7 +786,7 @@ void LLViewerRegion::loadObjectCache() { LLVOCache & vocache = LLVOCache::instance(); vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; - vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheExtraJson); + vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson); if (mImpl->mCacheMap.empty()) { @@ -815,7 +815,7 @@ void LLViewerRegion::saveObjectCache() LLVOCache & instance = LLVOCache::instance(); instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; - instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mCacheExtraJson, mCacheDirty, removal_enabled); + instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson, mCacheDirty, removal_enabled); mCacheDirty = FALSE; } @@ -2640,15 +2640,15 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec return result; } -void LLViewerRegion::cacheFullUpdateExtras(LLSD const & extras, std::string const & extras_raw) +void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data) { - LLUUID object_id = extras["object_id"].asUUID(); + LLUUID object_id = override_data.mObjectId; LLViewerObject * obj = gObjectList.findObject(object_id); if (obj != nullptr) { U32 local_id = obj->getLocalID(); - mImpl->mCacheExtraJson[local_id] = LLVOCacheEntry::ExtrasEntry{extras, extras_raw}; + mImpl->mGLTFOverridesJson[local_id] = override_data; } else { @@ -3542,9 +3542,9 @@ std::string LLViewerRegion::getSimHostName() void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc) { - auto iter = mImpl->mCacheExtraJson.find(local_id); - if (iter != mImpl->mCacheExtraJson.end()) + auto iter = mImpl->mGLTFOverridesJson.find(local_id); + if (iter != mImpl->mGLTFOverridesJson.end()) { - LLGLTFMaterialList::loadCacheOverrides(iter->second.extras_raw); + LLGLTFMaterialList::loadCacheOverrides(iter->second); } } -- cgit v1.2.3 From 804c207dcc07b9ae39922a3475de7e9a513f3e16 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Wed, 1 Mar 2023 09:51:08 -0800 Subject: Partial solution for SL-18458 Materials override cache not working and related SL-18684/SL-19206/SL-19173 --- indra/newview/llviewerregion.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e3ac1767fb..afe48f01b5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -785,7 +785,7 @@ void LLViewerRegion::loadObjectCache() if(LLVOCache::instanceExists()) { LLVOCache & vocache = LLVOCache::instance(); - vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; + vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap); vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson); if (mImpl->mCacheMap.empty()) @@ -814,7 +814,8 @@ void LLViewerRegion::saveObjectCache() bool removal_enabled = sVOCacheCullingEnabled && (mRegionTimer.getElapsedTimeF32() > start_time_threshold); //allow to remove invalid objects from object cache file. LLVOCache & instance = LLVOCache::instance(); - instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; + + instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled); instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson, mCacheDirty, removal_enabled); mCacheDirty = FALSE; } @@ -822,6 +823,7 @@ void LLViewerRegion::saveObjectCache() // Map of LLVOCacheEntry takes time to release, store map for cleanup on idle sRegionCacheCleanup.insert(mImpl->mCacheMap.begin(), mImpl->mCacheMap.end()); mImpl->mCacheMap.clear(); + // TODO - probably need to do the same for overrides cache } void LLViewerRegion::sendMessage() @@ -2646,6 +2648,8 @@ void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry LLViewerObject * obj = gObjectList.findObject(object_id); if (obj != nullptr) { + llassert(obj->getRegion() == this); + U32 local_id = obj->getLocalID(); mImpl->mGLTFOverridesJson[local_id] = override_data; @@ -3547,4 +3551,8 @@ void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U { LLGLTFMaterialList::loadCacheOverrides(iter->second); } + else + { + LL_DEBUGS("GLTF") << "cache miss for handle: " << mHandle << " local_id:" << local_id << LL_ENDL; + } } -- cgit v1.2.3 From 82125e8fba67de32f43d4a1c2290f2eec6a1d5e2 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 Mar 2023 14:16:52 -0500 Subject: SL-18458 Fix for overrides not applying when zooming out and back in again. --- indra/newview/llviewerregion.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index afe48f01b5..4663129d35 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1862,6 +1862,9 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) //should not hit here any more, but does not hurt either, just put it back to active list addActiveCacheEntry(entry); } + + loadCacheMiscExtras(entry->getLocalID(), entry, entry->getCRC()); + return obj; } @@ -2759,7 +2762,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss entry->setValid(); decodeBoundingInfo(entry); - loadCacheMiscExtras(local_id, entry, crc); + //loadCacheMiscExtras(local_id, entry, crc); return true; } -- cgit v1.2.3 From cf3a0c77f1855aa1a33ff39f86e846e7fb9031d1 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Thu, 23 Mar 2023 16:51:30 -0700 Subject: Fix for SL-18458 overrides not applying when cache load happened before LLViewerObject::updateTEMaterialTextures call --- indra/newview/llviewerregion.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4663129d35..dd4ff50259 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -823,7 +823,7 @@ void LLViewerRegion::saveObjectCache() // Map of LLVOCacheEntry takes time to release, store map for cleanup on idle sRegionCacheCleanup.insert(mImpl->mCacheMap.begin(), mImpl->mCacheMap.end()); mImpl->mCacheMap.clear(); - // TODO - probably need to do the same for overrides cache + // TODO - probably need to do the same for overrides cache } void LLViewerRegion::sendMessage() @@ -1151,6 +1151,8 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) entry->setState(LLVOCacheEntry::INACTIVE); entry->removeOctreeEntry(); entry->setValid(FALSE); + + // TODO kill extras/material overrides cache too } //physically delete the cache entry @@ -1863,7 +1865,7 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) addActiveCacheEntry(entry); } - loadCacheMiscExtras(entry->getLocalID(), entry, entry->getCRC()); + loadCacheMiscExtras(entry->getLocalID()); return obj; } @@ -2879,6 +2881,7 @@ void LLViewerRegion::dumpCache() { LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL; } + // TODO - add overrides cache too } void LLViewerRegion::unpackRegionHandshake() @@ -3547,15 +3550,11 @@ std::string LLViewerRegion::getSimHostName() return std::string("..."); } -void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc) +void LLViewerRegion::loadCacheMiscExtras(U32 local_id) { auto iter = mImpl->mGLTFOverridesJson.find(local_id); if (iter != mImpl->mGLTFOverridesJson.end()) { LLGLTFMaterialList::loadCacheOverrides(iter->second); } - else - { - LL_DEBUGS("GLTF") << "cache miss for handle: " << mHandle << " local_id:" << local_id << LL_ENDL; - } } -- cgit v1.2.3 From 6162b9208a087f78eba609d3fe9da5c8385f7ade Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 Mar 2023 10:41:04 -0500 Subject: DRTVWR-559 Add RenderAutomaticReflectionProbes control. Tweak automatic exposure. --- indra/newview/llviewerregion.cpp | 52 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dd4ff50259..192a96a408 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1255,43 +1255,45 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const void LLViewerRegion::updateReflectionProbes() { -#if 1 - const F32 probe_spacing = 32.f; - const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); - const F32 hover_height = 2.f; + static LLCachedControl automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); + if (automatic_probes > 0) + { + const F32 probe_spacing = 32.f; + const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); + const F32 hover_height = 2.f; - F32 start = probe_spacing * 0.5f; + F32 start = probe_spacing * 0.5f; - U32 grid_width = REGION_WIDTH_METERS / probe_spacing; + U32 grid_width = REGION_WIDTH_METERS / probe_spacing; - mReflectionMaps.resize(grid_width * grid_width); + mReflectionMaps.resize(grid_width * grid_width); - F32 water_height = getWaterHeight(); - LLVector3 origin = getOriginAgent(); + F32 water_height = getWaterHeight(); + LLVector3 origin = getOriginAgent(); - for (U32 i = 0; i < grid_width; ++i) - { - F32 x = i * probe_spacing + start; - for (U32 j = 0; j < grid_width; ++j) + for (U32 i = 0; i < grid_width; ++i) { - F32 y = j * probe_spacing + start; + F32 x = i * probe_spacing + start; + for (U32 j = 0; j < grid_width; ++j) + { + F32 y = j * probe_spacing + start; - U32 idx = i * grid_width + j; + U32 idx = i * grid_width + j; - if (mReflectionMaps[idx].isNull()) - { - mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); - } + if (mReflectionMaps[idx].isNull()) + { + mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); + } - LLVector3 probe_origin = LLVector3(x,y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x,y))); - probe_origin.mV[2] += hover_height; - probe_origin += origin; + LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); + probe_origin.mV[2] += hover_height; + probe_origin += origin; - mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); - mReflectionMaps[idx]->mRadius = probe_radius; + mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); + mReflectionMaps[idx]->mRadius = probe_radius; + } } } -#endif } void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) -- cgit v1.2.3 From 7c831d115b55b96129806353a51a01dcf2bcebba Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 3 Apr 2023 17:22:40 -0500 Subject: SL-18458 Make LLVOCache the one source of truth on most recently received overrides. (#147) --- indra/newview/llviewerregion.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 192a96a408..b159cc2750 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2651,20 +2651,8 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data) { - LLUUID object_id = override_data.mObjectId; - LLViewerObject * obj = gObjectList.findObject(object_id); - if (obj != nullptr) - { - llassert(obj->getRegion() == this); - - U32 local_id = obj->getLocalID(); - - mImpl->mGLTFOverridesJson[local_id] = override_data; - } - else - { - LL_WARNS("GLTF") << "got material override for unknown object_id, cannot cache it" << LL_ENDL; - } + U32 object_id = override_data.mLocalId; + mImpl->mGLTFOverridesJson[object_id] = override_data; } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) @@ -3560,3 +3548,22 @@ void LLViewerRegion::loadCacheMiscExtras(U32 local_id) LLGLTFMaterialList::loadCacheOverrides(iter->second); } } + +void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + llassert(obj); + + U32 local_id = obj->getLocalID(); + auto iter = mImpl->mGLTFOverridesJson.find(local_id); + if (iter != mImpl->mGLTFOverridesJson.end()) + { + llassert(iter->second.mGLTFMaterial.size() == iter->second.mSides.size()); + + for (auto& side : iter->second.mGLTFMaterial) + { + obj->setTEGLTFMaterialOverride(side.first, side.second); + } + } +} + -- cgit v1.2.3 From 7be7c66b0e43baef64871dac278eac5726e28d25 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 3 Apr 2023 19:13:23 -0500 Subject: SL-18458 Followup -- disable vocache unit test to unstick build, sanitize "object_id" to "local_id" --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b159cc2750..d3ee6daa6f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2651,8 +2651,8 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data) { - U32 object_id = override_data.mLocalId; - mImpl->mGLTFOverridesJson[object_id] = override_data; + U32 local_id = override_data.mLocalId; + mImpl->mGLTFOverridesJson[local_id] = override_data; } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) -- cgit v1.2.3 From 37eee397b70e2a13a1309025207d1c301f7070c5 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 18 Apr 2023 19:11:38 -0500 Subject: DRTVWR-559 Add control for automatic reflection probes to advanced preferences and featuretable. Remove Reflections checkbox. Don't persist reflection probe volume display between sessions. Incidental decruft. --- indra/newview/llviewerregion.cpp | 51 +++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d3ee6daa6f..402d03bc6e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1255,43 +1255,40 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const void LLViewerRegion::updateReflectionProbes() { - static LLCachedControl automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); - if (automatic_probes > 0) - { - const F32 probe_spacing = 32.f; - const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); - const F32 hover_height = 2.f; + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + const F32 probe_spacing = 32.f; + const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); + const F32 hover_height = 2.f; - F32 start = probe_spacing * 0.5f; + F32 start = probe_spacing * 0.5f; - U32 grid_width = REGION_WIDTH_METERS / probe_spacing; + U32 grid_width = REGION_WIDTH_METERS / probe_spacing; - mReflectionMaps.resize(grid_width * grid_width); + mReflectionMaps.resize(grid_width * grid_width); - F32 water_height = getWaterHeight(); - LLVector3 origin = getOriginAgent(); + F32 water_height = getWaterHeight(); + LLVector3 origin = getOriginAgent(); - for (U32 i = 0; i < grid_width; ++i) + for (U32 i = 0; i < grid_width; ++i) + { + F32 x = i * probe_spacing + start; + for (U32 j = 0; j < grid_width; ++j) { - F32 x = i * probe_spacing + start; - for (U32 j = 0; j < grid_width; ++j) - { - F32 y = j * probe_spacing + start; + F32 y = j * probe_spacing + start; - U32 idx = i * grid_width + j; + U32 idx = i * grid_width + j; - if (mReflectionMaps[idx].isNull()) - { - mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); - } + if (mReflectionMaps[idx].isNull()) + { + mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); + } - LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); - probe_origin.mV[2] += hover_height; - probe_origin += origin; + LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); + probe_origin.mV[2] += hover_height; + probe_origin += origin; - mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); - mReflectionMaps[idx]->mRadius = probe_radius; - } + mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); + mReflectionMaps[idx]->mRadius = probe_radius; } } } -- cgit v1.2.3 From 21b67896e9d1d181f39b8e44b9efe2b4c153d22b Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 26 Jun 2023 15:37:18 -0500 Subject: SL-19909 Fix for reflection probes on vehicles blocking mouse clicks. Incidental instrumentation and decruft. --- indra/newview/llviewerregion.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d60fae4bd6..6b92b16ef4 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -716,6 +716,7 @@ static LLTrace::BlockTimerStatHandle FTM_SAVE_REGION_CACHE("Save Region Cache"); LLViewerRegion::~LLViewerRegion() { + LL_PROFILE_ZONE_SCOPED; mDead = TRUE; mImpl->mActiveSet.clear(); mImpl->mVisibleEntries.clear(); @@ -1590,6 +1591,7 @@ void LLViewerRegion::lightIdleUpdate() void LLViewerRegion::idleUpdate(F32 max_update_time) { + LL_PROFILE_ZONE_SCOPED; LLTimer update_timer; F32 max_time; @@ -1693,6 +1695,10 @@ BOOL LLViewerRegion::isViewerCameraStatic() void LLViewerRegion::killInvisibleObjects(F32 max_time) { +#if 1 // TODO: kill this. This is ill-conceived, objects that aren't in the camera frustum should not be deleted from memory. + // because of this, every time you turn around the simulator sends a swarm of full object update messages from cache + // probe misses and objects have to be reloaded from scratch. From some reason, disabling this causes holes to + // appear in the scene when flying back and forth between regions if(!sVOCacheCullingEnabled) { return; @@ -1769,6 +1775,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } return; +#endif } void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& delete_list) -- cgit v1.2.3 From 455bbcf742691b709353aa3c3e35a76d0ff38ee4 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 29 Aug 2023 16:42:55 -0500 Subject: SL-20229 Add GenericStreamingMessage and use it to receive GLTF material overrides --- indra/newview/llviewerregion.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6b92b16ef4..ead1e8c073 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -215,7 +215,7 @@ public: LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation. LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation. std::set mNonCacheableCreatedList; //list of local ids of all non-cacheable objects - LLVOCacheEntry::vocache_gltf_overrides_map_t mGLTFOverridesJson; // for materials + LLVOCacheEntry::vocache_gltf_overrides_map_t mGLTFOverridesLLSD; // for materials // time? // LRU info? @@ -787,7 +787,7 @@ void LLViewerRegion::loadObjectCache() { LLVOCache & vocache = LLVOCache::instance(); vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap); - vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson); + vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD); if (mImpl->mCacheMap.empty()) { @@ -817,7 +817,7 @@ void LLViewerRegion::saveObjectCache() LLVOCache & instance = LLVOCache::instance(); instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled); - instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson, mCacheDirty, removal_enabled); + instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD, mCacheDirty, removal_enabled); mCacheDirty = FALSE; } @@ -2656,7 +2656,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data) { U32 local_id = override_data.mLocalId; - mImpl->mGLTFOverridesJson[local_id] = override_data; + mImpl->mGLTFOverridesLLSD[local_id] = override_data; } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) @@ -3546,8 +3546,8 @@ std::string LLViewerRegion::getSimHostName() void LLViewerRegion::loadCacheMiscExtras(U32 local_id) { - auto iter = mImpl->mGLTFOverridesJson.find(local_id); - if (iter != mImpl->mGLTFOverridesJson.end()) + auto iter = mImpl->mGLTFOverridesLLSD.find(local_id); + if (iter != mImpl->mGLTFOverridesLLSD.end()) { LLGLTFMaterialList::loadCacheOverrides(iter->second); } @@ -3559,8 +3559,8 @@ void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj) llassert(obj); U32 local_id = obj->getLocalID(); - auto iter = mImpl->mGLTFOverridesJson.find(local_id); - if (iter != mImpl->mGLTFOverridesJson.end()) + auto iter = mImpl->mGLTFOverridesLLSD.find(local_id); + if (iter != mImpl->mGLTFOverridesLLSD.end()) { llassert(iter->second.mGLTFMaterial.size() == iter->second.mSides.size()); -- cgit v1.2.3 From 7b3a0d86e2c8ec35f2cd1e5c4991d06ed460dee7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 12 Dec 2023 01:12:15 +0200 Subject: SL-20712 Crash at null cache buffer --- indra/newview/llviewerregion.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 452dcdd8fd..6c0e25ae39 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2467,7 +2467,10 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) //set parent id U32 parent_id = 0; - LLViewerObject::unpackParentID(entry->getDP(), parent_id); + if (entry->getDP()) // NULL if nothing cached + { + LLViewerObject::unpackParentID(entry->getDP(), parent_id); + } if(parent_id != entry->getParentID()) { entry->setParentID(parent_id); @@ -2487,7 +2490,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) LLQuaternion rot; //decode spatial info and parent info - U32 parent_id = LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot); + U32 parent_id = entry->getDP() ? LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot) : entry->getParentID(); U32 old_parent_id = entry->getParentID(); bool same_old_parent = false; -- cgit v1.2.3