From 5f397fa58352fb58d79b72148904f925416f4978 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 28 Jun 2013 13:29:11 -0400 Subject: NORSPEC-206: read RenderMaterialsCapability throttle rate per second from simulator --- indra/newview/llmaterialmgr.cpp | 24 +++++++++++++----------- indra/newview/llmaterialmgr.h | 3 +++ indra/newview/llviewerregion.cpp | 32 ++++++++++++++++++++++++++++++++ indra/newview/llviewerregion.h | 8 ++++++++ 4 files changed, 56 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index ad9958546c..96dd402d84 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -543,11 +543,9 @@ void LLMaterialMgr::onIdle(void*) instancep->processGetAllQueue(); } - static LLFrameTimer mPutTimer; - if ( (!instancep->mPutQueue.empty()) && (mPutTimer.hasExpired()) ) + if (!instancep->mPutQueue.empty()) { instancep->processPutQueue(); - mPutTimer.resetWithExpiry(MATERIALS_PUT_THROTTLE_SECS); } } @@ -564,14 +562,14 @@ void LLMaterialMgr::processGetQueue() continue; } - const LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); + LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (!regionp) { LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL; mGetQueue.erase(itRegionQueue); continue; } - else if (!regionp->capabilitiesReceived()) + else if (!regionp->capabilitiesReceived() || regionp->materialsCapThrottled()) { continue; } @@ -628,6 +626,7 @@ void LLMaterialMgr::processGetQueue() LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialsData.size() << " materials." << "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; LLHTTPClient::post(capURL, postData, materialsResponder); + regionp->resetMaterialsCapThrottle(); } } @@ -646,7 +645,7 @@ void LLMaterialMgr::processGetAllQueue() clearGetQueues(region_id); // Invalidates region_id continue; } - else if (!regionp->capabilitiesReceived()) + else if (!regionp->capabilitiesReceived() || regionp->materialsCapThrottled()) { continue; } @@ -663,6 +662,7 @@ void LLMaterialMgr::processGetAllQueue() LL_DEBUGS("Materials") << "GET all for region " << region_id << "url " << capURL << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *itRegion)); LLHTTPClient::get(capURL, materialsResponder); + regionp->resetMaterialsCapThrottle(); mGetAllPending.insert(std::pair(region_id, LLFrameTimer::getTotalSeconds())); mGetAllQueue.erase(itRegion); // Invalidates region_id } @@ -670,7 +670,7 @@ void LLMaterialMgr::processGetAllQueue() void LLMaterialMgr::processPutQueue() { - typedef std::map regionput_request_map; + typedef std::map regionput_request_map; regionput_request_map requests; put_queue_t::iterator loopQueue = mPutQueue.begin(); @@ -687,13 +687,13 @@ void LLMaterialMgr::processPutQueue() } else { - const LLViewerRegion* regionp = objectp->getRegion(); + LLViewerRegion* regionp = objectp->getRegion(); if ( !regionp ) { LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL; mPutQueue.erase(itQueue); } - else if ( regionp->capabilitiesReceived()) + else if ( regionp->capabilitiesReceived() && !regionp->materialsCapThrottled()) { LLSD& facesData = requests[regionp]; @@ -722,11 +722,12 @@ void LLMaterialMgr::processPutQueue() for (regionput_request_map::const_iterator itRequest = requests.begin(); itRequest != requests.end(); ++itRequest) { - std::string capURL = itRequest->first->getCapability(MATERIALS_CAPABILITY_NAME); + LLViewerRegion* regionp = itRequest->first; + std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME - << "' is not defined on region '" << itRequest->first->getName() << "'" << LL_ENDL; + << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; continue; } @@ -749,6 +750,7 @@ void LLMaterialMgr::processPutQueue() LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces to region " << itRequest->first->getName() << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)); LLHTTPClient::put(capURL, putData, materialsResponder); + regionp->resetMaterialsCapThrottle(); } else { diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index e83f1f4e01..2836019c27 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -126,6 +126,9 @@ protected: material_map_t mMaterials; U32 getMaxEntries(const LLViewerRegion* regionp); + + LLFrameTimer mCapThrottleTimer; + F32 getThrottleIntervalSecs(const LLUUID& region_id); }; #endif // LL_LLMATERIALMGR_H diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a4f6340d9e..0f8decc643 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1944,3 +1944,35 @@ bool LLViewerRegion::dynamicPathfindingEnabled() const mSimulatorFeatures["DynamicPathfindingEnabled"].asBoolean()); } +void LLViewerRegion::resetMaterialsCapThrottle() +{ + F32 requests_per_sec = 1.0f; // original default; + if ( mSimulatorFeatures.has("RenderMaterialsCapability") + && mSimulatorFeatures["RenderMaterialsCapability"].isReal() ) + { + requests_per_sec = mSimulatorFeatures["RenderMaterialsCapability"].asReal(); + if ( requests_per_sec != 0.0f ) + { + requests_per_sec = 1.0f; + LL_WARNS("Materials") + << "region '" << getName() + << "' returned zero for RenderMaterialsCapability; using default " + << requests_per_sec << " per second" + << LL_ENDL; + } + LL_DEBUGS_ONCE("Materials") << "region '" << getName() + << "' RenderMaterialsCapability " << requests_per_sec + << LL_ENDL; + } + else + { + LL_DEBUGS("Materials") + << "region '" << getName() + << "' did not return RenderMaterialsCapability, using default " + << requests_per_sec << " per second" + << LL_ENDL; + } + + mMaterialsCapThrottleTimer.resetWithExpiry( 1.0f / requests_per_sec ); +} + diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 031159183b..a3db7f5ac7 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -43,6 +43,7 @@ #include "llcapabilityprovider.h" #include "m4math.h" // LLMatrix4 #include "llhttpclient.h" +#include "llframetimer.h" // Surface id's #define LAND 1 @@ -342,6 +343,10 @@ public: void getNeighboringRegionsStatus( std::vector& regions ); const LLViewerRegionImpl * getRegionImpl() const { return mImpl; } LLViewerRegionImpl * getRegionImplNC() { return mImpl; } + + // implements the materials capability throttle + bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); } + void resetMaterialsCapThrottle(); public: struct CompareDistance @@ -434,6 +439,9 @@ private: BOOL mReleaseNotesRequested; LLSD mSimulatorFeatures; + + // the materials capability throttle + LLFrameTimer mMaterialsCapThrottleTimer; }; inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const -- cgit v1.2.3 From 8ae792b38af42d26a0f588e9a8b778df99416fd5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 28 Jun 2013 16:18:08 -0400 Subject: move reading of the sim features to LLViewerRegion for consistency, a couple of minor cleanups --- indra/newview/llmaterialmgr.cpp | 23 ++--------------------- indra/newview/llmaterialmgr.h | 5 ----- indra/newview/llviewerregion.cpp | 12 ++++++++++++ indra/newview/llviewerregion.h | 1 + 4 files changed, 15 insertions(+), 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 96dd402d84..658fea944d 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -50,9 +50,7 @@ #define MATERIALS_CAP_MATERIAL_FIELD "Material" #define MATERIALS_CAP_OBJECT_ID_FIELD "ID" #define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" -#define SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION "MaxMaterialsPerTransaction" -#define MATERIALS_DEFAULT_MAX_ENTRIES 50 #define MATERIALS_GET_TIMEOUT (60.f * 20) #define MATERIALS_POST_TIMEOUT (60.f * 5) #define MATERIALS_PUT_THROTTLE_SECS 1.f @@ -592,7 +590,7 @@ void LLMaterialMgr::processGetQueue() LLSD materialsData = LLSD::emptyArray(); material_queue_t& materials = itRegionQueue->second; - U32 max_entries = getMaxEntries(regionp); + U32 max_entries = regionp->getMaxMaterialsPerTransaction(); material_queue_t::iterator loopMaterial = materials.begin(); while ( (materials.end() != loopMaterial) && (materialsData.size() < max_entries) ) { @@ -698,7 +696,7 @@ void LLMaterialMgr::processPutQueue() LLSD& facesData = requests[regionp]; facematerial_map_t& face_map = itQueue->second; - U32 max_entries = getMaxEntries(regionp); + U32 max_entries = regionp->getMaxMaterialsPerTransaction(); facematerial_map_t::iterator itFace = face_map.begin(); while ( (face_map.end() != itFace) && (facesData.size() < max_entries) ) { @@ -785,20 +783,3 @@ void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) // Put doesn't need clearing: objects that can't be found will clean up in processPutQueue() } -U32 LLMaterialMgr::getMaxEntries(const LLViewerRegion* regionp) -{ - LLSD sim_features; - regionp->getSimulatorFeatures(sim_features); - U32 max_entries; - if ( sim_features.has( SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION ) - && sim_features[ SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION ].isInteger()) - { - max_entries = sim_features[ SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION ].asInteger(); - } - else - { - max_entries = MATERIALS_DEFAULT_MAX_ENTRIES; - } - return max_entries; -} - diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 2836019c27..e317a791ad 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -124,11 +124,6 @@ protected: put_queue_t mPutQueue; material_map_t mMaterials; - - U32 getMaxEntries(const LLViewerRegion* regionp); - - LLFrameTimer mCapThrottleTimer; - F32 getThrottleIntervalSecs(const LLUUID& region_id); }; #endif // LL_LLMATERIALMGR_H diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0f8decc643..b541a35111 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1976,3 +1976,15 @@ void LLViewerRegion::resetMaterialsCapThrottle() mMaterialsCapThrottleTimer.resetWithExpiry( 1.0f / requests_per_sec ); } +U32 LLViewerRegion::getMaxMaterialsPerTransaction() const +{ + U32 max_entries = 50; // original hard coded default + if ( mSimulatorFeatures.has( "MaxMaterialsPerTransaction" ) + && mSimulatorFeatures[ "MaxMaterialsPerTransaction" ].isInteger()) + { + max_entries = mSimulatorFeatures[ "MaxMaterialsPerTransaction" ].asInteger(); + } + return max_entries; +} + + diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a3db7f5ac7..109baccf9a 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -348,6 +348,7 @@ public: bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); } void resetMaterialsCapThrottle(); + U32 getMaxMaterialsPerTransaction() const; public: struct CompareDistance { -- cgit v1.2.3 From 9c8fdf5a49145f4147f50c16c4e1775386976798 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 2 Jul 2013 17:07:50 -0400 Subject: fix bug reading RenderMaterialsCapability, improve logging for NORSPEC-206 --- indra/newview/llviewerregion.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b541a35111..e6fc82f761 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1951,7 +1951,7 @@ void LLViewerRegion::resetMaterialsCapThrottle() && mSimulatorFeatures["RenderMaterialsCapability"].isReal() ) { requests_per_sec = mSimulatorFeatures["RenderMaterialsCapability"].asReal(); - if ( requests_per_sec != 0.0f ) + if ( requests_per_sec == 0.0f ) { requests_per_sec = 1.0f; LL_WARNS("Materials") @@ -1960,9 +1960,9 @@ void LLViewerRegion::resetMaterialsCapThrottle() << requests_per_sec << " per second" << LL_ENDL; } - LL_DEBUGS_ONCE("Materials") << "region '" << getName() - << "' RenderMaterialsCapability " << requests_per_sec - << LL_ENDL; + LL_DEBUGS("Materials") << "region '" << getName() + << "' RenderMaterialsCapability " << requests_per_sec + << LL_ENDL; } else { -- cgit v1.2.3 From 5d7be3a4987c603500bbe3733870a378bd9eda92 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 8 Jul 2013 10:46:21 -0700 Subject: NORSPEC-300 stop-gap measure of clamping offsets > 0 until server-side fix to store negative values can be released --- indra/newview/skins/default/xui/en/panel_tools_texture.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index 5ac2ec2b20..426c0c4915 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -663,7 +663,7 @@ label_width="205" layout="topleft" left="10" - min_val="-1" + min_val="0" name="bumpyOffsetU" width="265" />