summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Madarasz (Graham) <graham@lindenlab.com>2013-06-26 13:45:57 -0700
committerGraham Madarasz (Graham) <graham@lindenlab.com>2013-06-26 13:45:57 -0700
commita1a64c35271dae70d482600ced791059f42982c0 (patch)
tree862f8f7578ffca2445cd23bbe8e048a9b29197cf /indra
parent3ce387a04dfa7d1f90b3340770d236b2a168150d (diff)
parent1c6783fdb564cb10ade2a585a874ce951fff34e6 (diff)
Merge vwr-dev-mat
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llmaterialmgr.cpp86
-rw-r--r--indra/newview/llmaterialmgr.h2
-rwxr-xr-xindra/newview/llviewerregion.cpp2
-rwxr-xr-xindra/newview/llviewerregion.h2
4 files changed, 57 insertions, 35 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 16871adc4d..ad9958546c 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -50,13 +50,12 @@
#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_GET_MAX_ENTRIES 50
+#define MATERIALS_DEFAULT_MAX_ENTRIES 50
#define MATERIALS_GET_TIMEOUT (60.f * 20)
-#define MATERIALS_POST_MAX_ENTRIES 50
#define MATERIALS_POST_TIMEOUT (60.f * 5)
#define MATERIALS_PUT_THROTTLE_SECS 1.f
-#define MATERIALS_PUT_MAX_ENTRIES 50
/**
* LLMaterialsResponder helper class
@@ -595,8 +594,9 @@ void LLMaterialMgr::processGetQueue()
LLSD materialsData = LLSD::emptyArray();
material_queue_t& materials = itRegionQueue->second;
- material_queue_t::iterator loopMaterial = materials.begin();
- while ( (materials.end() != loopMaterial) && (materialsData.size() <= MATERIALS_GET_MAX_ENTRIES) )
+ U32 max_entries = getMaxEntries(regionp);
+ material_queue_t::iterator loopMaterial = materials.begin();
+ while ( (materials.end() != loopMaterial) && (materialsData.size() < max_entries) )
{
material_queue_t::iterator itMaterial = loopMaterial++;
materialsData.append((*itMaterial).asLLSD());
@@ -680,39 +680,43 @@ void LLMaterialMgr::processPutQueue()
const LLUUID& object_id = itQueue->first;
const LLViewerObject* objectp = gObjectList.findObject(object_id);
- if ( (!objectp) || (!objectp->getRegion()) )
+ if ( !objectp )
{
- LL_WARNS("Materials") << "Object or object region is NULL" << LL_ENDL;
-
+ LL_WARNS("Materials") << "Object is NULL" << LL_ENDL;
mPutQueue.erase(itQueue);
- continue;
- }
-
- const LLViewerRegion* regionp = objectp->getRegion();
- if (!regionp->capabilitiesReceived())
- {
- continue;
}
-
- LLSD& facesData = requests[regionp];
-
- facematerial_map_t& face_map = itQueue->second;
- facematerial_map_t::iterator itFace = face_map.begin();
- while ( (face_map.end() != itFace) && (facesData.size() < MATERIALS_GET_MAX_ENTRIES) )
+ else
{
- LLSD faceData = LLSD::emptyMap();
- faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
- faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
- if (!itFace->second.isNull())
+ const LLViewerRegion* regionp = objectp->getRegion();
+ if ( !regionp )
{
- faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
+ LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL;
+ mPutQueue.erase(itQueue);
+ }
+ else if ( regionp->capabilitiesReceived())
+ {
+ LLSD& facesData = requests[regionp];
+
+ facematerial_map_t& face_map = itQueue->second;
+ U32 max_entries = getMaxEntries(regionp);
+ facematerial_map_t::iterator itFace = face_map.begin();
+ while ( (face_map.end() != itFace) && (facesData.size() < max_entries) )
+ {
+ LLSD faceData = LLSD::emptyMap();
+ faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
+ faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
+ if (!itFace->second.isNull())
+ {
+ faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
+ }
+ facesData.append(faceData);
+ face_map.erase(itFace++);
+ }
+ if (face_map.empty())
+ {
+ mPutQueue.erase(itQueue);
+ }
}
- facesData.append(faceData);
- face_map.erase(itFace++);
- }
- if (face_map.empty())
- {
- mPutQueue.erase(itQueue);
}
}
@@ -773,10 +777,26 @@ void LLMaterialMgr::clearGetQueues(const LLUUID& region_id)
mGetAllPending.erase(region_id);
mGetAllCallbacks.erase(region_id);
}
-
void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp)
{
clearGetQueues(regionp->getRegionID());
// 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 e317a791ad..e83f1f4e01 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -124,6 +124,8 @@ protected:
put_queue_t mPutQueue;
material_map_t mMaterials;
+
+ U32 getMaxEntries(const LLViewerRegion* regionp);
};
#endif // LL_LLMATERIALMGR_H
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 8422708add..a4f6340d9e 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1219,7 +1219,7 @@ void LLViewerRegion::getInfo(LLSD& info)
info["Region"]["Handle"]["y"] = (LLSD::Integer)y;
}
-void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features)
+void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features) const
{
sim_features = mSimulatorFeatures;
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 56cd0c9ea1..031159183b 100755
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -293,7 +293,7 @@ public:
bool meshRezEnabled() const;
bool meshUploadEnabled() const;
- void getSimulatorFeatures(LLSD& info);
+ void getSimulatorFeatures(LLSD& info) const;
void setSimulatorFeatures(const LLSD& info);