From 1e26dbdcd27a1f29fe249cc7e074e5ede284bac8 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 3 Dec 2012 01:46:26 +0100 Subject: Started LLMaterialMgr to handle viewer<->region materials communication * refactored LLFloaterDebugMaterials::requestPutMaterials() to use LLMaterialMgr instead * replaced "Object editing" results list with information about the active selection instead --- indra/newview/llmaterialmgr.cpp | 270 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 indra/newview/llmaterialmgr.cpp (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp new file mode 100644 index 0000000000..5ba7ad5a05 --- /dev/null +++ b/indra/newview/llmaterialmgr.cpp @@ -0,0 +1,270 @@ +/** + * @file llmaterialmgr.cpp + * @brief Material manager + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llsdserialize.h" + +#include "llmaterialmgr.h" +#include "llviewerobject.h" +#include "llviewerobjectlist.h" +#include "llviewerregion.h" + +/** + * Materials cap parameters + */ + +#define MATERIALS_CAPABILITY_NAME "RenderMaterials" + +#define MATERIALS_CAP_ZIP_FIELD "Zipped" + +#define MATERIALS_CAP_FULL_PER_FACE_FIELD "FullMaterialsPerFace" +#define MATERIALS_CAP_FACE_FIELD "Face" +#define MATERIALS_CAP_MATERIAL_FIELD "Material" +#define MATERIALS_CAP_OBJECT_ID_FIELD "ID" +#define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" + +/** + * LLMaterialsResponder helper class + */ + +class LLMaterialsResponder : public LLHTTPClient::Responder +{ +public: + typedef boost::function CallbackFunction; + + LLMaterialsResponder(const std::string& pMethod, const std::string& pCapabilityURL, CallbackFunction pCallback); + virtual ~LLMaterialsResponder(); + + virtual void result(const LLSD& pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +private: + std::string mMethod; + std::string mCapabilityURL; + CallbackFunction mCallback; +}; + +LLMaterialsResponder::LLMaterialsResponder(const std::string& pMethod, const std::string& pCapabilityURL, CallbackFunction pCallback) + : LLHTTPClient::Responder() + , mMethod(pMethod) + , mCapabilityURL(pCapabilityURL) + , mCallback(pCallback) +{ +} + +LLMaterialsResponder::~LLMaterialsResponder() +{ +} + +void LLMaterialsResponder::result(const LLSD& pContent) +{ + mCallback(true, pContent); +} + +void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) +{ + LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; + LL_WARNS("debugMaterials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME + << "' with url '" << mCapabilityURL << "' because " << pReason << LL_ENDL; + LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; + + LLSD emptyResult; + mCallback(false, emptyResult); +} + +/** + * LLMaterialMgr class + */ + +LLMaterialMgr::LLMaterialMgr() +{ +} + +LLMaterialMgr::~LLMaterialMgr() +{ +} + +void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) +{ + put_queue_t::iterator itQueue = mPutQueue.find(object_id); + if (mPutQueue.end() == itQueue) + { + mPutQueue.insert(std::pair(object_id, facematerial_map_t())); + itQueue = mPutQueue.find(object_id); + } + + facematerial_map_t::iterator itFace = itQueue->second.find(te); + if (itQueue->second.end() == itFace) + { + itQueue->second.insert(std::pair(te, material)); + } + else + { + itFace->second = material; + } +} + +void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUID& object_id) +{ + if (!success) + { + // *TODO: is there any kind of error handling we can do here? + return; + } + + LLViewerObject* objectp = gObjectList.findObject(object_id); + if (!objectp) + { + LL_WARNS("debugMaterials") << "Received PUT response for unknown object" << LL_ENDL; + return; + } + + llassert(content.isMap()); + llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); + llassert(content.get(MATERIALS_CAP_ZIP_FIELD).isBinary()); + + LLSD::Binary content_binary = content.get(MATERIALS_CAP_ZIP_FIELD).asBinary(); + std::string content_string(reinterpret_cast(content_binary.data()), content_binary.size()); + std::istringstream content_stream(content_string); + + LLSD response_data; + if (!unzip_llsd(response_data, content_stream, content_binary.size())) + { + LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + return; + } + else + { + llassert(response_data.isArray()); + + for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter) + { + const LLSD& face_data = *faceIter; + llassert(face_data.isMap()); + + llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); + llassert(face_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).isInteger()); + U32 local_id = face_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).asInteger(); + if (objectp->getLocalID() != local_id) + { + LL_ERRS("debugMaterials") << "Received PUT response for wrong object" << LL_ENDL; + continue; + } + + llassert(face_data.has(MATERIALS_CAP_FACE_FIELD)); + llassert(face_data.get(MATERIALS_CAP_FACE_FIELD).isInteger()); + S32 te = face_data.get(MATERIALS_CAP_FACE_FIELD).asInteger(); + + llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD)); + llassert(face_data.get(MATERIALS_CAP_MATERIAL_ID_FIELD).isBinary()); + LLMaterialID material_id(face_data.get(MATERIALS_CAP_MATERIAL_ID_FIELD).asBinary()); + + LL_INFOS("debugMaterials") << "Setting material '" << material_id.asString() << "' on object '" << local_id + << "' face " << te << LL_ENDL; + + objectp->setTEMaterialID(te, material_id); + } + } +} + +void LLMaterialMgr::processPutQueue() +{ + put_queue_t::iterator itQueue = mPutQueue.begin(); + while (itQueue != mPutQueue.end()) + { + put_queue_t::iterator curQueue = itQueue++; + + const LLUUID& object_id = curQueue->first; + const LLViewerObject* objectp = gObjectList.findObject(object_id); + if ( (!objectp) || (!objectp->getRegion()) ) + { + LL_WARNS("debugMaterials") << "Object or object region is NULL" << LL_ENDL; + + mPutQueue.erase(curQueue); + continue; + } + + const LLViewerRegion* regionp = objectp->getRegion(); + if (!regionp->capabilitiesReceived()) + { + continue; + } + + std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); + if (capURL.empty()) + { + LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; + + mPutQueue.erase(curQueue); + continue; + } + + LLSD facesData = LLSD::emptyArray(); + for (facematerial_map_t::const_iterator itFace = curQueue->second.begin(); itFace != curQueue->second.end(); ++itFace) + { + LLSD faceData = LLSD::emptyMap(); + faceData[MATERIALS_CAP_FACE_FIELD] = static_cast(itFace->first); + faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast(objectp->getLocalID()); + if (!itFace->second.isNull()) + { + faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD(); + } + facesData.append(faceData); + + LL_INFOS("debugMaterials") << "Requesting material change on object '" << faceData[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger() + << "' face " << faceData[MATERIALS_CAP_FACE_FIELD].asInteger() << LL_ENDL; + } + + LLSD materialsData = LLSD::emptyMap(); + materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = facesData; + + std::string materialString = zip_llsd(materialsData); + + S32 materialSize = materialString.size(); + if (materialSize <= 0) + { + LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + + mPutQueue.erase(curQueue); + continue; + } + else + { + LLSD::Binary materialBinary; + materialBinary.resize(materialSize); + memcpy(materialBinary.data(), materialString.data(), materialSize); + + LLSD putData = LLSD::emptyMap(); + putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; + + // *HACK: the viewer can't lookup the local object id the cap returns so we'll pass the object's uuid along + LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2, object_id)); + LLHTTPClient::put(capURL, putData, materialsResponder); + } + } +} -- cgit v1.2.3 From 25bffc3d43ec7696c0a9fab43514affbfe006fb9 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 3 Dec 2012 15:20:11 +0100 Subject: Added LLMaterialMgr::get() to retrieve individual materials (with optional callback) --- indra/newview/llmaterialmgr.cpp | 157 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 5ba7ad5a05..9ee96dccb9 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -28,6 +28,7 @@ #include "llsdserialize.h" +#include "llagent.h" #include "llmaterialmgr.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -47,6 +48,8 @@ #define MATERIALS_CAP_OBJECT_ID_FIELD "ID" #define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" +#define MATERIALS_POST_TIMEOUT (60.f * 5) + /** * LLMaterialsResponder helper class */ @@ -108,6 +111,57 @@ LLMaterialMgr::~LLMaterialMgr() { } +bool LLMaterialMgr::isGetPending(const LLMaterialID& material_id) +{ + get_pending_map_t::const_iterator itPending = mGetPending.find(material_id); + return (mGetPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_POST_TIMEOUT); +} + +const LLMaterialPtr LLMaterialMgr::get(const LLMaterialID& material_id) +{ + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (itMaterial != mMaterials.end()) + { + return itMaterial->second; + } + + if (!isGetPending(material_id)) + { + mGetQueue.insert(material_id); + } + return LLMaterialPtr(); +} + +boost::signals2::connection LLMaterialMgr::get(const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) +{ + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (itMaterial != mMaterials.end()) + { + get_callback_t signal; + signal.connect(cb); + signal(material_id, itMaterial->second); + return boost::signals2::connection(); + } + + if (!isGetPending(material_id)) + { + mGetQueue.insert(material_id); + } + + get_callback_t* signalp = NULL; + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback == mGetCallbacks.end()) + { + signalp = new get_callback_t(); + mGetCallbacks.insert(std::pair(material_id, signalp)); + } + else + { + signalp = itCallback->second; + } + return signalp->connect(cb);; +} + void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) { put_queue_t::iterator itQueue = mPutQueue.find(object_id); @@ -128,6 +182,59 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& } } +void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) +{ + if (!success) + { + // *TODO: is there any kind of error handling we can do here? + return; + } + + llassert(content.isMap()); + llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); + llassert(content.get(MATERIALS_CAP_ZIP_FIELD).isBinary()); + + LLSD::Binary content_binary = content.get(MATERIALS_CAP_ZIP_FIELD).asBinary(); + std::string content_string(reinterpret_cast(content_binary.data()), content_binary.size()); + std::istringstream content_stream(content_string); + + LLSD response_data; + if (!unzip_llsd(response_data, content_stream, content_binary.size())) + { + LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + return; + } + else + { + llassert(response_data.isArray()); + + for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) + { + const LLSD& material_data = *itMaterial; + llassert(material_data.isMap()); + + llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); + llassert(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary()); + LLMaterialID material_id(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).asBinary()); + + llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD)); + llassert(material_data.get(MATERIALS_CAP_MATERIAL_FIELD).isMap()); + LLMaterialPtr material(new LLMaterial(material_data.get(MATERIALS_CAP_MATERIAL_FIELD))); + + mMaterials[material_id] = material; + + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback != mGetCallbacks.end()) + { + (*itCallback->second)(material_id, material); + + delete itCallback->second; + mGetCallbacks.erase(itCallback); + } + } + } +} + void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUID& object_id) { if (!success) @@ -191,6 +298,56 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI } } +void LLMaterialMgr::processGetQueue() +{ + LLViewerRegion* regionp = gAgent.getRegion(); + if (!regionp) + { + LL_WARNS("debugMaterials") << "Agent region is NULL" << LL_ENDL; + return; + } + else if (!regionp->capabilitiesReceived()) + { + return; + } + + const std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); + if (capURL.empty()) + { + LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; + return; + } + + LLSD materialsData = LLSD::emptyArray(); + + for (get_queue_t::const_iterator itQueue = mGetQueue.begin(); itQueue != mGetQueue.end(); ++itQueue) + { + const LLMaterialID& material_id = *itQueue; + materialsData.append(material_id.asLLSD()); + } + mGetQueue.clear(); + + std::string materialString = zip_llsd(materialsData); + + S32 materialSize = materialString.size(); + if (materialSize <= 0) + { + LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + return; + } + + LLSD::Binary materialBinary; + materialBinary.resize(materialSize); + memcpy(materialBinary.data(), materialString.data(), materialSize); + + LLSD postData = LLSD::emptyMap(); + postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; + + LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2)); + LLHTTPClient::post(capURL, postData, materialsResponder); +} + void LLMaterialMgr::processPutQueue() { put_queue_t::iterator itQueue = mPutQueue.begin(); -- cgit v1.2.3 From 1e194eb412bb10c1733ed76e270e45578ac15e0b Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 3 Dec 2012 15:46:49 +0100 Subject: Handle delayed requesting and sending of materials through an idle callback --- indra/newview/llmaterialmgr.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 9ee96dccb9..a8731a8c4c 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -29,6 +29,7 @@ #include "llsdserialize.h" #include "llagent.h" +#include "llcallbacklist.h" #include "llmaterialmgr.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -105,10 +106,12 @@ void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) LLMaterialMgr::LLMaterialMgr() { + gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL); } LLMaterialMgr::~LLMaterialMgr() { + gIdleCallbacks.deleteFunction(&LLMaterialMgr::onIdle, NULL); } bool LLMaterialMgr::isGetPending(const LLMaterialID& material_id) @@ -298,6 +301,25 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI } } +static LLFastTimer::DeclareTimer FTM_MATERIALS_IDLE("Materials"); + +void LLMaterialMgr::onIdle(void*) +{ + LLFastTimer t(FTM_MATERIALS_IDLE); + + LLMaterialMgr* instancep = LLMaterialMgr::getInstance(); + + if (!instancep->mGetQueue.empty()) + { + instancep->processGetQueue(); + } + + if (!instancep->mPutQueue.empty()) + { + instancep->processPutQueue(); + } +} + void LLMaterialMgr::processGetQueue() { LLViewerRegion* regionp = gAgent.getRegion(); -- cgit v1.2.3 From 4c68faec400e4c6d75a53528d8064a3448707158 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 5 Dec 2012 19:34:27 +0100 Subject: Added LLMaterialMgr::getAll() to retrieve all materials for the specified region --- indra/newview/llmaterialmgr.cpp | 145 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index a8731a8c4c..d463f9480e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llsdserialize.h" +#include "llsdutil.h" #include "llagent.h" #include "llcallbacklist.h" @@ -34,6 +35,7 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" +#include "llworld.h" /** * Materials cap parameters @@ -49,6 +51,7 @@ #define MATERIALS_CAP_OBJECT_ID_FIELD "ID" #define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" +#define MATERIALS_GET_TIMEOUT (60.f * 20) #define MATERIALS_POST_TIMEOUT (60.f * 5) /** @@ -165,6 +168,41 @@ boost::signals2::connection LLMaterialMgr::get(const LLMaterialID& material_id, return signalp->connect(cb);; } +bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) +{ + getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); + return (mGetAllPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_GET_TIMEOUT); +} + +void LLMaterialMgr::getAll(const LLUUID& region_id) +{ + if (!isGetAllPending(region_id)) + { + mGetAllQueue.insert(region_id); + } +} + +boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMaterialMgr::getall_callback_t::slot_type cb) +{ + if (!isGetAllPending(region_id)) + { + mGetAllQueue.insert(region_id); + } + + getall_callback_t* signalp = NULL; + getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id); + if (mGetAllCallbacks.end() == itCallback) + { + signalp = new getall_callback_t(); + mGetAllCallbacks.insert(std::pair(region_id, signalp)); + } + else + { + signalp = itCallback->second; + } + return signalp->connect(cb);; +} + void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) { put_queue_t::iterator itQueue = mPutQueue.find(object_id); @@ -185,6 +223,19 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& } } +const LLMaterialPtr LLMaterialMgr::setMaterial(const LLMaterialID& material_id, const LLSD& material_data) +{ + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (mMaterials.end() == itMaterial) + { + LLMaterialPtr material(new LLMaterial(material_data)); + mMaterials[material_id] = material; + return material; + } + return itMaterial->second; +} + + void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) { if (!success) @@ -222,9 +273,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD)); llassert(material_data.get(MATERIALS_CAP_MATERIAL_FIELD).isMap()); - LLMaterialPtr material(new LLMaterial(material_data.get(MATERIALS_CAP_MATERIAL_FIELD))); - - mMaterials[material_id] = material; + LLMaterialPtr material = setMaterial(material_id, material_data.get(MATERIALS_CAP_MATERIAL_FIELD)); get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); if (itCallback != mGetCallbacks.end()) @@ -238,6 +287,57 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) } } +void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LLUUID& region_id) +{ + if (!success) + { + // *TODO: is there any kind of error handling we can do here? + return; + } + + llassert(content.isMap()); + llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); + llassert(content.get(MATERIALS_CAP_ZIP_FIELD).isBinary()); + + LLSD::Binary content_binary = content.get(MATERIALS_CAP_ZIP_FIELD).asBinary(); + std::string content_string(reinterpret_cast(content_binary.data()), content_binary.size()); + std::istringstream content_stream(content_string); + + LLSD response_data; + if (!unzip_llsd(response_data, content_stream, content_binary.size())) + { + LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + return; + } + + llassert(response_data.isArray()); + material_map_t materials; + for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) + { + const LLSD& material_data = *itMaterial; + llassert(material_data.isMap()); + + llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); + llassert(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary()); + LLMaterialID material_id(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).asBinary()); + + llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD)); + llassert(material_data.get(MATERIALS_CAP_MATERIAL_FIELD).isMap()); + LLMaterialPtr material = setMaterial(material_id, material_data.get(MATERIALS_CAP_MATERIAL_FIELD)); + + materials[material_id] = material; + } + + getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id); + if (itCallback != mGetAllCallbacks.end()) + { + (*itCallback->second)(region_id, materials); + + delete itCallback->second; + mGetAllCallbacks.erase(itCallback); + } +} + void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUID& object_id) { if (!success) @@ -314,6 +414,11 @@ void LLMaterialMgr::onIdle(void*) instancep->processGetQueue(); } + if (!instancep->mGetAllQueue.empty()) + { + instancep->processGetAllQueue(); + } + if (!instancep->mPutQueue.empty()) { instancep->processPutQueue(); @@ -370,6 +475,40 @@ void LLMaterialMgr::processGetQueue() LLHTTPClient::post(capURL, postData, materialsResponder); } +void LLMaterialMgr::processGetAllQueue() +{ + getall_queue_t::iterator itRegion = mGetAllQueue.begin(); + while (mGetAllQueue.end() != itRegion) + { + getall_queue_t::iterator curRegion = itRegion++; + + LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(*curRegion); + if (regionp == NULL) + { + LL_WARNS("debugMaterials") << "Unknown region with id " << (*curRegion).asString() << LL_ENDL; + mGetAllQueue.erase(curRegion); + continue; + } + else if (!regionp->capabilitiesReceived()) + { + continue; + } + + std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); + if (capURL.empty()) + { + LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + << "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL; + mGetAllQueue.erase(curRegion); + continue; + } + + LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *curRegion)); + LLHTTPClient::get(capURL, materialsResponder); + mGetAllQueue.erase(curRegion); + } +} + void LLMaterialMgr::processPutQueue() { put_queue_t::iterator itQueue = mPutQueue.begin(); -- cgit v1.2.3 From 3cd04749128f3daa185bca477552a566bc287a8e Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 12 Dec 2012 20:39:47 +0100 Subject: Refactor material retrieval to always invoke the region's GET material cap first --- indra/newview/llmaterialmgr.cpp | 290 +++++++++++++++++++++++----------------- 1 file changed, 165 insertions(+), 125 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index d463f9480e..77c0102fa7 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -51,7 +51,9 @@ #define MATERIALS_CAP_OBJECT_ID_FIELD "ID" #define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" +#define MATERIALS_GET_MAX_ENTRIES 50 #define MATERIALS_GET_TIMEOUT (60.f * 20) +#define MATERIALS_POST_MAX_ENTRIES 50 #define MATERIALS_POST_TIMEOUT (60.f * 5) /** @@ -117,28 +119,34 @@ LLMaterialMgr::~LLMaterialMgr() gIdleCallbacks.deleteFunction(&LLMaterialMgr::onIdle, NULL); } -bool LLMaterialMgr::isGetPending(const LLMaterialID& material_id) +bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) { - get_pending_map_t::const_iterator itPending = mGetPending.find(material_id); + get_pending_map_t::const_iterator itPending = mGetPending.find(pending_material_t(region_id, material_id)); return (mGetPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_POST_TIMEOUT); } -const LLMaterialPtr LLMaterialMgr::get(const LLMaterialID& material_id) +const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id) { material_map_t::const_iterator itMaterial = mMaterials.find(material_id); - if (itMaterial != mMaterials.end()) + if (mMaterials.end() != itMaterial) { return itMaterial->second; } - if (!isGetPending(material_id)) + if (!isGetPending(region_id, material_id)) { - mGetQueue.insert(material_id); + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + std::pair ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + itQueue->second.insert(material_id); } return LLMaterialPtr(); } -boost::signals2::connection LLMaterialMgr::get(const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) +boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) { material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (itMaterial != mMaterials.end()) @@ -149,23 +157,24 @@ boost::signals2::connection LLMaterialMgr::get(const LLMaterialID& material_id, return boost::signals2::connection(); } - if (!isGetPending(material_id)) + if (!isGetPending(region_id, material_id)) { - mGetQueue.insert(material_id); + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + std::pair ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + itQueue->second.insert(material_id); } - get_callback_t* signalp = NULL; get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); if (itCallback == mGetCallbacks.end()) { - signalp = new get_callback_t(); - mGetCallbacks.insert(std::pair(material_id, signalp)); + std::pair ret = mGetCallbacks.insert(std::pair(material_id, new get_callback_t())); + itCallback = ret.first; } - else - { - signalp = itCallback->second; - } - return signalp->connect(cb);; + return itCallback->second->connect(cb);; } bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) @@ -189,18 +198,13 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat mGetAllQueue.insert(region_id); } - getall_callback_t* signalp = NULL; getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id); if (mGetAllCallbacks.end() == itCallback) { - signalp = new getall_callback_t(); - mGetAllCallbacks.insert(std::pair(region_id, signalp)); - } - else - { - signalp = itCallback->second; + std::pair ret = mGetAllCallbacks.insert(std::pair(region_id, new getall_callback_t())); + itCallback = ret.first; } - return signalp->connect(cb);; + return itCallback->second->connect(cb);; } void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) @@ -223,20 +227,30 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& } } -const LLMaterialPtr LLMaterialMgr::setMaterial(const LLMaterialID& material_id, const LLSD& material_data) +const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data) { material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() == itMaterial) { - LLMaterialPtr material(new LLMaterial(material_data)); - mMaterials[material_id] = material; - return material; + std::pair ret = mMaterials.insert(std::pair(material_id, new LLMaterial(material_data))); + itMaterial = ret.first; } + + mGetPending.erase(pending_material_t(region_id, material_id)); + + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback != mGetCallbacks.end()) + { + (*itCallback->second)(material_id, itMaterial->second); + + delete itCallback->second; + mGetCallbacks.erase(itCallback); + } + return itMaterial->second; } - -void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) +void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUID& region_id) { if (!success) { @@ -246,9 +260,9 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) llassert(content.isMap()); llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); - llassert(content.get(MATERIALS_CAP_ZIP_FIELD).isBinary()); + llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); - LLSD::Binary content_binary = content.get(MATERIALS_CAP_ZIP_FIELD).asBinary(); + LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); std::string content_string(reinterpret_cast(content_binary.data()), content_binary.size()); std::istringstream content_stream(content_string); @@ -258,32 +272,21 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content) LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } - else - { - llassert(response_data.isArray()); - - for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) - { - const LLSD& material_data = *itMaterial; - llassert(material_data.isMap()); - llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); - llassert(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary()); - LLMaterialID material_id(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).asBinary()); - - llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD)); - llassert(material_data.get(MATERIALS_CAP_MATERIAL_FIELD).isMap()); - LLMaterialPtr material = setMaterial(material_id, material_data.get(MATERIALS_CAP_MATERIAL_FIELD)); + llassert(response_data.isArray()); + for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) + { + const LLSD& material_data = *itMaterial; + llassert(material_data.isMap()); - get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); - if (itCallback != mGetCallbacks.end()) - { - (*itCallback->second)(material_id, material); + llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); + llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary()); + LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary()); - delete itCallback->second; - mGetCallbacks.erase(itCallback); - } - } + llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD)); + llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap()); + + setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]); } } @@ -297,9 +300,9 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL llassert(content.isMap()); llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); - llassert(content.get(MATERIALS_CAP_ZIP_FIELD).isBinary()); + llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); - LLSD::Binary content_binary = content.get(MATERIALS_CAP_ZIP_FIELD).asBinary(); + LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); std::string content_string(reinterpret_cast(content_binary.data()), content_binary.size()); std::istringstream content_stream(content_string); @@ -310,20 +313,26 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL return; } - llassert(response_data.isArray()); + get_queue_t::iterator itQueue = mGetQueue.find(region_id); material_map_t materials; + + llassert(response_data.isArray()); for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) { const LLSD& material_data = *itMaterial; llassert(material_data.isMap()); llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); - llassert(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary()); - LLMaterialID material_id(material_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).asBinary()); + llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary()); + LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary()); + if (mGetQueue.end() != itQueue) + { + itQueue->second.erase(material_id); + } llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD)); - llassert(material_data.get(MATERIALS_CAP_MATERIAL_FIELD).isMap()); - LLMaterialPtr material = setMaterial(material_id, material_data.get(MATERIALS_CAP_MATERIAL_FIELD)); + llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap()); + LLMaterialPtr material = setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]); materials[material_id] = material; } @@ -336,6 +345,13 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL delete itCallback->second; mGetAllCallbacks.erase(itCallback); } + + if ( (mGetQueue.end() != itQueue) && (itQueue->second.empty()) ) + { + mGetQueue.erase(itQueue); + } + mGetAllRequested.insert(region_id); + mGetAllPending.erase(region_id); // Invalidates region_id } void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUID& object_id) @@ -355,9 +371,9 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI llassert(content.isMap()); llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); - llassert(content.get(MATERIALS_CAP_ZIP_FIELD).isBinary()); + llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); - LLSD::Binary content_binary = content.get(MATERIALS_CAP_ZIP_FIELD).asBinary(); + LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); std::string content_string(reinterpret_cast(content_binary.data()), content_binary.size()); std::istringstream content_stream(content_string); @@ -377,8 +393,8 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI llassert(face_data.isMap()); llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); - llassert(face_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).isInteger()); - U32 local_id = face_data.get(MATERIALS_CAP_OBJECT_ID_FIELD).asInteger(); + llassert(face_data[MATERIALS_CAP_OBJECT_ID_FIELD].isInteger()); + U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger(); if (objectp->getLocalID() != local_id) { LL_ERRS("debugMaterials") << "Received PUT response for wrong object" << LL_ENDL; @@ -386,12 +402,12 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI } llassert(face_data.has(MATERIALS_CAP_FACE_FIELD)); - llassert(face_data.get(MATERIALS_CAP_FACE_FIELD).isInteger()); - S32 te = face_data.get(MATERIALS_CAP_FACE_FIELD).asInteger(); + llassert(face_data[MATERIALS_CAP_FACE_FIELD].isInteger()); + S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger(); llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD)); - llassert(face_data.get(MATERIALS_CAP_MATERIAL_ID_FIELD).isBinary()); - LLMaterialID material_id(face_data.get(MATERIALS_CAP_MATERIAL_ID_FIELD).asBinary()); + llassert(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].isBinary()); + LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary()); LL_INFOS("debugMaterials") << "Setting material '" << material_id.asString() << "' on object '" << local_id << "' face " << te << LL_ENDL; @@ -427,66 +443,89 @@ void LLMaterialMgr::onIdle(void*) void LLMaterialMgr::processGetQueue() { - LLViewerRegion* regionp = gAgent.getRegion(); - if (!regionp) + get_queue_t::iterator loopRegionQueue = mGetQueue.begin(); + while (mGetQueue.end() != loopRegionQueue) { - LL_WARNS("debugMaterials") << "Agent region is NULL" << LL_ENDL; - return; - } - else if (!regionp->capabilitiesReceived()) - { - return; - } + get_queue_t::iterator itRegionQueue = loopRegionQueue++; - const std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); - if (capURL.empty()) - { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME - << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; - return; - } + const LLUUID& region_id = itRegionQueue->first; + if (isGetAllPending(region_id)) + { + continue; + } - LLSD materialsData = LLSD::emptyArray(); + const LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); + if (!regionp) + { + LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; + mGetQueue.erase(itRegionQueue); + continue; + } + else if (!regionp->capabilitiesReceived()) + { + continue; + } + else if (mGetAllRequested.end() == mGetAllRequested.find(region_id)) + { + getAll(region_id); + continue; + } - for (get_queue_t::const_iterator itQueue = mGetQueue.begin(); itQueue != mGetQueue.end(); ++itQueue) - { - const LLMaterialID& material_id = *itQueue; - materialsData.append(material_id.asLLSD()); - } - mGetQueue.clear(); + const std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); + if (capURL.empty()) + { + LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; + mGetQueue.erase(itRegionQueue); + continue; + } - std::string materialString = zip_llsd(materialsData); + LLSD materialsData = LLSD::emptyArray(); - S32 materialSize = materialString.size(); - if (materialSize <= 0) - { - LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; - return; - } + material_queue_t& materials = itRegionQueue->second; + material_queue_t::iterator loopMaterial = materials.begin(); + while ( (materials.end() != loopMaterial) && (materialsData.size() <= MATERIALS_GET_MAX_ENTRIES) ) + { + material_queue_t::iterator itMaterial = loopMaterial++; + materialsData.append((*itMaterial).asLLSD()); + materials.erase(itMaterial); + mGetPending.insert(std::pair(pending_material_t(region_id, *itMaterial), LLFrameTimer::getTotalSeconds())); + } + + std::string materialString = zip_llsd(materialsData); + + S32 materialSize = materialString.size(); + if (materialSize <= 0) + { + LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + return; + } - LLSD::Binary materialBinary; - materialBinary.resize(materialSize); - memcpy(materialBinary.data(), materialString.data(), materialSize); + LLSD::Binary materialBinary; + materialBinary.resize(materialSize); + memcpy(materialBinary.data(), materialString.data(), materialSize); - LLSD postData = LLSD::emptyMap(); - postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; + LLSD postData = LLSD::emptyMap(); + postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; - LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2)); - LLHTTPClient::post(capURL, postData, materialsResponder); + LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)); + LLHTTPClient::post(capURL, postData, materialsResponder); + } } void LLMaterialMgr::processGetAllQueue() { - getall_queue_t::iterator itRegion = mGetAllQueue.begin(); - while (mGetAllQueue.end() != itRegion) + getall_queue_t::iterator loopRegion = mGetAllQueue.begin(); + while (mGetAllQueue.end() != loopRegion) { - getall_queue_t::iterator curRegion = itRegion++; + getall_queue_t::iterator itRegion = loopRegion++; - LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(*curRegion); + const LLUUID& region_id = *itRegion; + LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (regionp == NULL) { - LL_WARNS("debugMaterials") << "Unknown region with id " << (*curRegion).asString() << LL_ENDL; - mGetAllQueue.erase(curRegion); + LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; + mGetAllQueue.erase(itRegion); continue; } else if (!regionp->capabilitiesReceived()) @@ -499,30 +538,31 @@ void LLMaterialMgr::processGetAllQueue() { LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL; - mGetAllQueue.erase(curRegion); + mGetAllQueue.erase(itRegion); continue; } - LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *curRegion)); + LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *itRegion)); LLHTTPClient::get(capURL, materialsResponder); - mGetAllQueue.erase(curRegion); + mGetAllPending.insert(std::pair(region_id, LLFrameTimer::getTotalSeconds())); + mGetAllQueue.erase(itRegion); // Invalidates region_id } } void LLMaterialMgr::processPutQueue() { - put_queue_t::iterator itQueue = mPutQueue.begin(); - while (itQueue != mPutQueue.end()) + put_queue_t::iterator loopQueue = mPutQueue.begin(); + while (mPutQueue.end() != loopQueue) { - put_queue_t::iterator curQueue = itQueue++; + put_queue_t::iterator itQueue = loopQueue++; - const LLUUID& object_id = curQueue->first; + const LLUUID& object_id = itQueue->first; const LLViewerObject* objectp = gObjectList.findObject(object_id); if ( (!objectp) || (!objectp->getRegion()) ) { LL_WARNS("debugMaterials") << "Object or object region is NULL" << LL_ENDL; - mPutQueue.erase(curQueue); + mPutQueue.erase(itQueue); continue; } @@ -538,12 +578,12 @@ void LLMaterialMgr::processPutQueue() LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; - mPutQueue.erase(curQueue); + mPutQueue.erase(itQueue); continue; } LLSD facesData = LLSD::emptyArray(); - for (facematerial_map_t::const_iterator itFace = curQueue->second.begin(); itFace != curQueue->second.end(); ++itFace) + for (facematerial_map_t::const_iterator itFace = itQueue->second.begin(); itFace != itQueue->second.end(); ++itFace) { LLSD faceData = LLSD::emptyMap(); faceData[MATERIALS_CAP_FACE_FIELD] = static_cast(itFace->first); @@ -568,7 +608,7 @@ void LLMaterialMgr::processPutQueue() { LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; - mPutQueue.erase(curQueue); + mPutQueue.erase(itQueue); continue; } else -- cgit v1.2.3 From ef301c59832025240a20f9959008a33dc52233f9 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 12 Dec 2012 21:36:36 +0100 Subject: Don't call setTEMaterialID() while processing a PUT response; the region will send its own ObjectUpdate message --- indra/newview/llmaterialmgr.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 77c0102fa7..f623ca11ec 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -354,7 +354,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL mGetAllPending.erase(region_id); // Invalidates region_id } -void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUID& object_id) +void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) { if (!success) { @@ -362,13 +362,6 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI return; } - LLViewerObject* objectp = gObjectList.findObject(object_id); - if (!objectp) - { - LL_WARNS("debugMaterials") << "Received PUT response for unknown object" << LL_ENDL; - return; - } - llassert(content.isMap()); llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); @@ -394,25 +387,17 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); llassert(face_data[MATERIALS_CAP_OBJECT_ID_FIELD].isInteger()); - U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger(); - if (objectp->getLocalID() != local_id) - { - LL_ERRS("debugMaterials") << "Received PUT response for wrong object" << LL_ENDL; - continue; - } +// U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger(); llassert(face_data.has(MATERIALS_CAP_FACE_FIELD)); llassert(face_data[MATERIALS_CAP_FACE_FIELD].isInteger()); - S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger(); +// S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger(); llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD)); llassert(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].isBinary()); - LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary()); +// LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary()); - LL_INFOS("debugMaterials") << "Setting material '" << material_id.asString() << "' on object '" << local_id - << "' face " << te << LL_ENDL; - - objectp->setTEMaterialID(te, material_id); + // *TODO: do we really still need to process this? } } } @@ -593,9 +578,6 @@ void LLMaterialMgr::processPutQueue() faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD(); } facesData.append(faceData); - - LL_INFOS("debugMaterials") << "Requesting material change on object '" << faceData[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger() - << "' face " << faceData[MATERIALS_CAP_FACE_FIELD].asInteger() << LL_ENDL; } LLSD materialsData = LLSD::emptyMap(); @@ -620,8 +602,7 @@ void LLMaterialMgr::processPutQueue() LLSD putData = LLSD::emptyMap(); putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; - // *HACK: the viewer can't lookup the local object id the cap returns so we'll pass the object's uuid along - LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2, object_id)); + LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)); LLHTTPClient::put(capURL, putData, materialsResponder); } } -- cgit v1.2.3 From a18ea9d92923e331c0a3e179e126659e694b1c07 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 12 Dec 2012 21:47:24 +0100 Subject: Clean up pending requests when regions are removed from LLWorld --- indra/newview/llmaterialmgr.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index f623ca11ec..1daeedb8b0 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -112,6 +112,7 @@ void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) LLMaterialMgr::LLMaterialMgr() { gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL); + LLWorld::instance().setRegionRemovedCallback(boost::bind(&LLMaterialMgr::onRegionRemoved, this, _1)); } LLMaterialMgr::~LLMaterialMgr() @@ -607,3 +608,27 @@ void LLMaterialMgr::processPutQueue() } } } + +void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) +{ + const LLUUID& region_id = regionp->getRegionID(); + + // Get + mGetQueue.erase(region_id); + for (get_pending_map_t::const_iterator itPending = mGetPending.begin(); itPending != mGetPending.end();) + { + if (region_id == itPending->first.first) + mGetPending.erase(itPending++); + else + ++itPending; + } + + // Get all + mGetAllQueue.erase(region_id); + mGetAllRequested.erase(region_id); + mGetAllPending.erase(region_id); + mGetAllCallbacks.erase(region_id); + + // Put +// mPutQueue.erase(region_id); +} -- cgit v1.2.3 From d4910e15a68368d3cebbda1485da4fb68b45ed62 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 3 Jan 2013 14:14:43 -0500 Subject: changes needed to compile with Linden-standard toolchain --- indra/newview/llmaterialmgr.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 1daeedb8b0..3dd60f5dc3 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -233,7 +233,8 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() == itMaterial) { - std::pair ret = mMaterials.insert(std::pair(material_id, new LLMaterial(material_data))); + LLMaterialPtr newMaterial(new LLMaterial(material_data)); + std::pair ret = mMaterials.insert(std::pair(material_id, newMaterial)); itMaterial = ret.first; } @@ -615,12 +616,16 @@ void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) // Get mGetQueue.erase(region_id); - for (get_pending_map_t::const_iterator itPending = mGetPending.begin(); itPending != mGetPending.end();) + for (get_pending_map_t::iterator itPending = mGetPending.begin(); itPending != mGetPending.end();) { if (region_id == itPending->first.first) + { mGetPending.erase(itPending++); + } else + { ++itPending; + } } // Get all -- cgit v1.2.3 From 8b78b9960a32fb7a8a8663478d3fd30de65095fd Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 4 Jan 2013 14:12:05 -0500 Subject: add conditional to suppress unused variable warning in Release builds --- indra/newview/llmaterialmgr.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3dd60f5dc3..3138bfd4e1 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -384,20 +384,22 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter) { - const LLSD& face_data = *faceIter; +# ifndef LL_RELEASE_FOR_DOWNLOAD + const LLSD& face_data = *faceIter; // conditional to avoid unused variable warning +# endif llassert(face_data.isMap()); llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD)); llassert(face_data[MATERIALS_CAP_OBJECT_ID_FIELD].isInteger()); -// U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger(); + // U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger(); llassert(face_data.has(MATERIALS_CAP_FACE_FIELD)); llassert(face_data[MATERIALS_CAP_FACE_FIELD].isInteger()); -// S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger(); + // S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger(); llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD)); llassert(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].isBinary()); -// LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary()); + // LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary()); // *TODO: do we really still need to process this? } -- cgit v1.2.3 From 510a68134110b06779f34d2dd896a337911d5fef Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 31 Jan 2013 16:00:57 -0500 Subject: make logging tag for Materials uniform --- indra/newview/llmaterialmgr.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3138bfd4e1..3895411bb9 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -96,10 +96,10 @@ void LLMaterialsResponder::result(const LLSD& pContent) void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) { - LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; - LL_WARNS("debugMaterials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; + LL_WARNS("Materials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME << "' with url '" << mCapabilityURL << "' because " << pReason << LL_ENDL; - LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; + LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; LLSD emptyResult; mCallback(false, emptyResult); @@ -271,7 +271,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI LLSD response_data; if (!unzip_llsd(response_data, content_stream, content_binary.size())) { - LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } @@ -311,7 +311,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL LLSD response_data; if (!unzip_llsd(response_data, content_stream, content_binary.size())) { - LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } @@ -375,7 +375,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) LLSD response_data; if (!unzip_llsd(response_data, content_stream, content_binary.size())) { - LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } else @@ -446,7 +446,7 @@ void LLMaterialMgr::processGetQueue() const LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (!regionp) { - LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; + LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL; mGetQueue.erase(itRegionQueue); continue; } @@ -463,7 +463,7 @@ void LLMaterialMgr::processGetQueue() const std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; mGetQueue.erase(itRegionQueue); continue; @@ -486,7 +486,7 @@ void LLMaterialMgr::processGetQueue() S32 materialSize = materialString.size(); if (materialSize <= 0) { - LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; return; } @@ -513,7 +513,7 @@ void LLMaterialMgr::processGetAllQueue() LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (regionp == NULL) { - LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; + LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL; mGetAllQueue.erase(itRegion); continue; } @@ -525,7 +525,7 @@ void LLMaterialMgr::processGetAllQueue() std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL; mGetAllQueue.erase(itRegion); continue; @@ -549,7 +549,7 @@ void LLMaterialMgr::processPutQueue() const LLViewerObject* objectp = gObjectList.findObject(object_id); if ( (!objectp) || (!objectp->getRegion()) ) { - LL_WARNS("debugMaterials") << "Object or object region is NULL" << LL_ENDL; + LL_WARNS("Materials") << "Object or object region is NULL" << LL_ENDL; mPutQueue.erase(itQueue); continue; @@ -564,7 +564,7 @@ void LLMaterialMgr::processPutQueue() std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; mPutQueue.erase(itQueue); @@ -592,7 +592,7 @@ void LLMaterialMgr::processPutQueue() S32 materialSize = materialString.size(); if (materialSize <= 0) { - LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; mPutQueue.erase(itQueue); continue; -- cgit v1.2.3 From 90bf22ef24fbb8ff3497dd271abc7f7555a4f758 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 1 Feb 2013 10:20:44 -0500 Subject: add debug logging, ostream support for material ids, and some minor cleanup --- indra/newview/llmaterialmgr.cpp | 47 +++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3895411bb9..aa98748dbe 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -2,9 +2,9 @@ * @file llmaterialmgr.cpp * @brief Material manager * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2013, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -128,23 +128,31 @@ bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& ma const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id) { + LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; + LLMaterialPtr material; material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() != itMaterial) { - return itMaterial->second; + material = itMaterial->second; + LL_DEBUGS("Materials") << " found material " << LL_ENDL; } - - if (!isGetPending(region_id, material_id)) + else { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) + if (!isGetPending(region_id, material_id)) { - std::pair ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); - itQueue = ret.first; + LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL; + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + std::pair ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + itQueue->second.insert(material_id); } - itQueue->second.insert(material_id); + LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL; + material = LLMaterialPtr(); } - return LLMaterialPtr(); + return material; } boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) @@ -188,8 +196,13 @@ void LLMaterialMgr::getAll(const LLUUID& region_id) { if (!isGetAllPending(region_id)) { + LL_DEBUGS("Materials") << "queuing for region " << region_id << LL_ENDL; mGetAllQueue.insert(region_id); } + else + { + LL_DEBUGS("Materials") << "already pending for region " << region_id << LL_ENDL; + } } boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMaterialMgr::getall_callback_t::slot_type cb) @@ -210,6 +223,7 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) { + LL_DEBUGS("Materials") << "object " << object_id << LL_ENDL; put_queue_t::iterator itQueue = mPutQueue.find(object_id); if (mPutQueue.end() == itQueue) { @@ -230,9 +244,11 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data) { + LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() == itMaterial) { + LL_DEBUGS("Materials") << "new material" << LL_ENDL; LLMaterialPtr newMaterial(new LLMaterial(material_data)); std::pair ret = mMaterials.insert(std::pair(material_id, newMaterial)); itMaterial = ret.first; @@ -257,6 +273,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI if (!success) { // *TODO: is there any kind of error handling we can do here? + LL_WARNS("Materials")<< "failed"< Date: Mon, 4 Feb 2013 00:57:45 +0100 Subject: Material PUT queue entries aren't removed after a request is sent --- indra/newview/llmaterialmgr.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3138bfd4e1..c93f17859c 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -590,14 +590,7 @@ void LLMaterialMgr::processPutQueue() std::string materialString = zip_llsd(materialsData); S32 materialSize = materialString.size(); - if (materialSize <= 0) - { - LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; - - mPutQueue.erase(itQueue); - continue; - } - else + if (materialSize > 0) { LLSD::Binary materialBinary; materialBinary.resize(materialSize); @@ -609,6 +602,11 @@ void LLMaterialMgr::processPutQueue() LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)); LLHTTPClient::put(capURL, putData, materialsResponder); } + else + { + LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + } + mPutQueue.erase(itQueue); } } @@ -636,6 +634,5 @@ void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) mGetAllPending.erase(region_id); mGetAllCallbacks.erase(region_id); - // Put -// mPutQueue.erase(region_id); + // Put doesn't need clearing: objects that can't be found will clean up in processPutQueue() } -- cgit v1.2.3 From 5bbc33383ed63d4d0c8a4241c8274b32fa5b22cc Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Sun, 3 Feb 2013 23:01:22 -0600 Subject: Don't spam the sim with repeated queries for an empty list of materials. --- indra/newview/llmaterialmgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index c93f17859c..6068c2606c 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -473,6 +473,11 @@ void LLMaterialMgr::processGetQueue() material_queue_t& materials = itRegionQueue->second; material_queue_t::iterator loopMaterial = materials.begin(); + if (materials.end() == loopMaterial) + { + //LL_INFOS("Material") << "Get queue for region empty, trying next region." << LL_ENDL; + continue; + } while ( (materials.end() != loopMaterial) && (materialsData.size() <= MATERIALS_GET_MAX_ENTRIES) ) { material_queue_t::iterator itMaterial = loopMaterial++; -- cgit v1.2.3 From 7cc7ae873c5aeca9b5939176fb70677365e25395 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 4 Feb 2013 09:35:12 -0500 Subject: improve and clarify logging --- indra/newview/llmaterialmgr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index aa98748dbe..d74cc0c6ed 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -293,6 +293,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI } llassert(response_data.isArray()); + LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL; for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) { const LLSD& material_data = *itMaterial; @@ -337,6 +338,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL material_map_t materials; llassert(response_data.isArray()); + LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL; for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) { const LLSD& material_data = *itMaterial; @@ -400,7 +402,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) else { llassert(response_data.isArray()); - + LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL; for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter) { # ifndef LL_RELEASE_FOR_DOWNLOAD @@ -550,6 +552,7 @@ void LLMaterialMgr::processGetAllQueue() continue; } + LL_DEBUGS("Materials") << "getAll for region " << region_id << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *itRegion)); LLHTTPClient::get(capURL, materialsResponder); mGetAllPending.insert(std::pair(region_id, LLFrameTimer::getTotalSeconds())); @@ -625,6 +628,7 @@ void LLMaterialMgr::processPutQueue() LLSD putData = LLSD::emptyMap(); putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; + LL_DEBUGS("Materials") << "put for " << facesData.size() << " faces; object " << object_id << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)); LLHTTPClient::put(capURL, putData, materialsResponder); } -- cgit v1.2.3 From 64a4a13397ea7b895ebbeb707bdba72e2d97ff6b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 15 Feb 2013 15:40:43 -0500 Subject: fix crasher in setNumTEs --- indra/newview/llmaterialmgr.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 474e6b862e..cb628447bf 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -96,10 +96,12 @@ void LLMaterialsResponder::result(const LLSD& pContent) void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) { - LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; - LL_WARNS("Materials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME - << "' with url '" << mCapabilityURL << "' because " << pReason << LL_ENDL; - LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; + LL_WARNS("Materials") + << "\n--------------------------------------------------------------------------\n" + << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME + << "'\n with url '" << mCapabilityURL << "' because " << pReason + << "\n--------------------------------------------------------------------------" + << LL_ENDL; LLSD emptyResult; mCallback(false, emptyResult); @@ -144,6 +146,7 @@ const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterial get_queue_t::iterator itQueue = mGetQueue.find(region_id); if (mGetQueue.end() == itQueue) { + LL_DEBUGS("Materials") << "mGetQueue add region " << region_id << " pending " << material_id << LL_ENDL; std::pair ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); itQueue = ret.first; } @@ -171,6 +174,7 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL get_queue_t::iterator itQueue = mGetQueue.find(region_id); if (mGetQueue.end() == itQueue) { + LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); itQueue = ret.first; } @@ -223,10 +227,10 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) { - LL_DEBUGS("Materials") << "object " << object_id << LL_ENDL; put_queue_t::iterator itQueue = mPutQueue.find(object_id); if (mPutQueue.end() == itQueue) { + LL_DEBUGS("Materials") << "mPutQueue insert object " << object_id << LL_ENDL; mPutQueue.insert(std::pair(object_id, facematerial_map_t())); itQueue = mPutQueue.find(object_id); } @@ -372,7 +376,9 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL { mGetQueue.erase(itQueue); } - mGetAllRequested.insert(region_id); + + LL_DEBUGS("Materials")<< "recording that getAll has been done for region id " << region_id << LL_ENDL; + mGetAllRequested.insert(region_id); // prevents subsequent getAll requests for this region mGetAllPending.erase(region_id); // Invalidates region_id } @@ -477,6 +483,7 @@ void LLMaterialMgr::processGetQueue() } else if (mGetAllRequested.end() == mGetAllRequested.find(region_id)) { + LL_DEBUGS("Materials") << "calling getAll for " << regionp->getName() << LL_ENDL; getAll(region_id); continue; } @@ -496,7 +503,7 @@ void LLMaterialMgr::processGetQueue() material_queue_t::iterator loopMaterial = materials.begin(); if (materials.end() == loopMaterial) { - //LL_INFOS("Material") << "Get queue for region empty, trying next region." << LL_ENDL; + LL_DEBUGS("Material") << "Get queue for region empty, trying next region." << LL_ENDL; continue; } while ( (materials.end() != loopMaterial) && (materialsData.size() <= MATERIALS_GET_MAX_ENTRIES) ) @@ -506,7 +513,7 @@ void LLMaterialMgr::processGetQueue() materials.erase(itMaterial); mGetPending.insert(std::pair(pending_material_t(region_id, *itMaterial), LLFrameTimer::getTotalSeconds())); } - + std::string materialString = zip_llsd(materialsData); S32 materialSize = materialString.size(); @@ -524,6 +531,7 @@ void LLMaterialMgr::processGetQueue() postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)); + LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << "'\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; LLHTTPClient::post(capURL, postData, materialsResponder); } } @@ -557,7 +565,7 @@ void LLMaterialMgr::processGetAllQueue() continue; } - LL_DEBUGS("Materials") << "getAll for region " << region_id << LL_ENDL; + 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); mGetAllPending.insert(std::pair(region_id, LLFrameTimer::getTotalSeconds())); @@ -657,6 +665,7 @@ void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) } } + LL_DEBUGS("Materials") << regionp->getName() << " id " << region_id << LL_ENDL; // Get all mGetAllQueue.erase(region_id); mGetAllRequested.erase(region_id); -- cgit v1.2.3 From b4a87776d4207c4268b5c0d546790eeb45db1e75 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 18 Feb 2013 19:37:19 +0100 Subject: Prevent a failed GET from causing an infinite material request loop when there are still pending POST requests for the same region --- indra/newview/llmaterialmgr.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index cb628447bf..de82ec80c8 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -548,7 +548,7 @@ void LLMaterialMgr::processGetAllQueue() if (regionp == NULL) { LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL; - mGetAllQueue.erase(itRegion); + clearGetQueues(region_id); // Invalidates region_id continue; } else if (!regionp->capabilitiesReceived()) @@ -561,7 +561,7 @@ void LLMaterialMgr::processGetAllQueue() { LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL; - mGetAllQueue.erase(itRegion); + clearGetQueues(region_id); // Invalidates region_id continue; } @@ -647,11 +647,8 @@ void LLMaterialMgr::processPutQueue() } } -void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) +void LLMaterialMgr::clearGetQueues(const LLUUID& region_id) { - const LLUUID& region_id = regionp->getRegionID(); - - // Get mGetQueue.erase(region_id); for (get_pending_map_t::iterator itPending = mGetPending.begin(); itPending != mGetPending.end();) { @@ -665,12 +662,14 @@ void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) } } - LL_DEBUGS("Materials") << regionp->getName() << " id " << region_id << LL_ENDL; - // Get all mGetAllQueue.erase(region_id); mGetAllRequested.erase(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() } -- cgit v1.2.3 From fbf8e51c6059791b12f60602b4dda0d72dc2d847 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 25 Feb 2013 00:16:14 +0100 Subject: Added LLMaterialMgr::remove() to remove material information from a face --- indra/newview/llmaterialmgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index de82ec80c8..253b0c124e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -246,6 +246,11 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& } } +void LLMaterialMgr::remove(const LLUUID& object_id, const U8 te) +{ + put(object_id, te, LLMaterial::null); +} + const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data) { LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; -- cgit v1.2.3 From 5ba7be081273d4eb4dac3f66e82b33b44f62580a Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Thu, 28 Feb 2013 23:19:41 +0100 Subject: Mark a material as 'pending' from the very first call to LLMaterialMgr::get() --- indra/newview/llmaterialmgr.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 253b0c124e..d7f4a465a7 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -122,12 +122,25 @@ LLMaterialMgr::~LLMaterialMgr() gIdleCallbacks.deleteFunction(&LLMaterialMgr::onIdle, NULL); } -bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) +bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) const { get_pending_map_t::const_iterator itPending = mGetPending.find(pending_material_t(region_id, material_id)); return (mGetPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_POST_TIMEOUT); } +void LLMaterialMgr::markGetPending(const LLUUID& region_id, const LLMaterialID& material_id) +{ + get_pending_map_t::iterator itPending = mGetPending.find(pending_material_t(region_id, material_id)); + if (mGetPending.end() == itPending) + { + mGetPending.insert(std::pair(pending_material_t(region_id, material_id), LLFrameTimer::getTotalSeconds())); + } + else + { + itPending->second = LLFrameTimer::getTotalSeconds(); + } +} + const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id) { LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; @@ -151,6 +164,7 @@ const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterial itQueue = ret.first; } itQueue->second.insert(material_id); + markGetPending(region_id, material_id); } LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL; material = LLMaterialPtr(); @@ -179,6 +193,7 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL itQueue = ret.first; } itQueue->second.insert(material_id); + markGetPending(region_id, material_id); } get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); @@ -190,7 +205,7 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return itCallback->second->connect(cb);; } -bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) +bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); return (mGetAllPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_GET_TIMEOUT); @@ -516,7 +531,7 @@ void LLMaterialMgr::processGetQueue() material_queue_t::iterator itMaterial = loopMaterial++; materialsData.append((*itMaterial).asLLSD()); materials.erase(itMaterial); - mGetPending.insert(std::pair(pending_material_t(region_id, *itMaterial), LLFrameTimer::getTotalSeconds())); + markGetPending(region_id, *itMaterial); } std::string materialString = zip_llsd(materialsData); -- cgit v1.2.3 From 7a3a74b3d4eb6159a2edb86c8e967369cada78b9 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Thu, 28 Feb 2013 23:42:12 +0100 Subject: Group multiple material PUT requests together and throttle requests to the region --- indra/newview/llmaterialmgr.cpp | 54 ++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index d7f4a465a7..ffd7f1f1af 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -55,6 +55,8 @@ #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 @@ -471,9 +473,11 @@ void LLMaterialMgr::onIdle(void*) instancep->processGetAllQueue(); } - if (!instancep->mPutQueue.empty()) + static LLFrameTimer mPutTimer; + if ( (!instancep->mPutQueue.empty()) && (mPutTimer.hasExpired()) ) { instancep->processPutQueue(); + mPutTimer.resetWithExpiry(MATERIALS_PUT_THROTTLE_SECS); } } @@ -521,11 +525,6 @@ void LLMaterialMgr::processGetQueue() material_queue_t& materials = itRegionQueue->second; material_queue_t::iterator loopMaterial = materials.begin(); - if (materials.end() == loopMaterial) - { - LL_DEBUGS("Material") << "Get queue for region empty, trying next region." << LL_ENDL; - continue; - } while ( (materials.end() != loopMaterial) && (materialsData.size() <= MATERIALS_GET_MAX_ENTRIES) ) { material_queue_t::iterator itMaterial = loopMaterial++; @@ -533,6 +532,10 @@ void LLMaterialMgr::processGetQueue() materials.erase(itMaterial); markGetPending(region_id, *itMaterial); } + if (materials.empty()) + { + mGetQueue.erase(itRegionQueue); + } std::string materialString = zip_llsd(materialsData); @@ -595,6 +598,9 @@ void LLMaterialMgr::processGetAllQueue() void LLMaterialMgr::processPutQueue() { + typedef std::map regionput_request_map; + regionput_request_map requests; + put_queue_t::iterator loopQueue = mPutQueue.begin(); while (mPutQueue.end() != loopQueue) { @@ -616,18 +622,11 @@ void LLMaterialMgr::processPutQueue() continue; } - std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); - if (capURL.empty()) - { - LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME - << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; + LLSD& facesData = requests[regionp]; - mPutQueue.erase(itQueue); - continue; - } - - LLSD facesData = LLSD::emptyArray(); - for (facematerial_map_t::const_iterator itFace = itQueue->second.begin(); itFace != itQueue->second.end(); ++itFace) + 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) ) { LLSD faceData = LLSD::emptyMap(); faceData[MATERIALS_CAP_FACE_FIELD] = static_cast(itFace->first); @@ -637,10 +636,26 @@ void LLMaterialMgr::processPutQueue() faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD(); } facesData.append(faceData); + face_map.erase(itFace++); + } + if (face_map.empty()) + { + mPutQueue.erase(itQueue); + } + } + + for (regionput_request_map::const_iterator itRequest = requests.begin(); itRequest != requests.end(); ++itRequest) + { + std::string capURL = itRequest->first->getCapability(MATERIALS_CAPABILITY_NAME); + if (capURL.empty()) + { + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME + << "' is not defined on region '" << itRequest->first->getName() << "'" << LL_ENDL; + continue; } LLSD materialsData = LLSD::emptyMap(); - materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = facesData; + materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = itRequest->second; std::string materialString = zip_llsd(materialsData); @@ -655,7 +670,7 @@ void LLMaterialMgr::processPutQueue() LLSD putData = LLSD::emptyMap(); putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; - LL_DEBUGS("Materials") << "put for " << facesData.size() << " faces; object " << object_id << LL_ENDL; + LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces" << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)); LLHTTPClient::put(capURL, putData, materialsResponder); } @@ -663,7 +678,6 @@ void LLMaterialMgr::processPutQueue() { LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; } - mPutQueue.erase(itQueue); } } -- cgit v1.2.3 From a4510f5b1ce72a639889431d6f86e10b6fff96ad Mon Sep 17 00:00:00 2001 From: Maestro Linden Date: Wed, 27 Mar 2013 17:50:26 +0000 Subject: NORSPEC-56 Added some extra details to debug logs for RenderMaterials cap access. Reviewed by Graham. --- indra/newview/llmaterialmgr.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index ffd7f1f1af..25e92e27d9 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -554,7 +554,8 @@ void LLMaterialMgr::processGetQueue() postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)); - LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << "'\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; + LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialSize << " materials." + << "'\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; LLHTTPClient::post(capURL, postData, materialsResponder); } } @@ -670,7 +671,7 @@ void LLMaterialMgr::processPutQueue() LLSD putData = LLSD::emptyMap(); putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; - LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces" << LL_ENDL; + 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); } -- cgit v1.2.3 From 250175a0fa1dd1811e7b27a8cd8e6f99ff20ced9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 10 Apr 2013 13:12:15 -0700 Subject: NORSPEC-56 slight tweak to log formatting to correct material count --- indra/newview/llmaterialmgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 25e92e27d9..81284e42dd 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -554,8 +554,8 @@ void LLMaterialMgr::processGetQueue() postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)); - LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialSize << " materials." - << "'\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; + 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); } } -- cgit v1.2.3 From e66a32b4e2fe212b9044397a2283708e0eb8e5a4 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 25 Apr 2013 16:14:45 -0400 Subject: add some debug logging, make a single return in "get" method --- indra/newview/llmaterialmgr.cpp | 43 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 81284e42dd..fb8cffa4ef 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -93,6 +93,7 @@ LLMaterialsResponder::~LLMaterialsResponder() void LLMaterialsResponder::result(const LLSD& pContent) { + LL_DEBUGS("Materials") << LL_ENDL; mCallback(true, pContent); } @@ -176,35 +177,43 @@ const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterial boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) { + boost::signals2::connection connection; + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (itMaterial != mMaterials.end()) { + LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; get_callback_t signal; signal.connect(cb); signal(material_id, itMaterial->second); - return boost::signals2::connection(); + connection = boost::signals2::connection(); } - - if (!isGetPending(region_id, material_id)) + else { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) + if (!isGetPending(region_id, material_id)) { - LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); - itQueue = ret.first; + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; + itQueue->second.insert(material_id); + markGetPending(region_id, material_id); } - itQueue->second.insert(material_id); - markGetPending(region_id, material_id); - } - get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); - if (itCallback == mGetCallbacks.end()) - { - std::pair ret = mGetCallbacks.insert(std::pair(material_id, new get_callback_t())); - itCallback = ret.first; + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback == mGetCallbacks.end()) + { + std::pair ret = mGetCallbacks.insert(std::pair(material_id, new get_callback_t())); + itCallback = ret.first; + } + connection = itCallback->second->connect(cb);; } - return itCallback->second->connect(cb);; + + return connection; } bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const -- cgit v1.2.3 From f356d7eb9fd730f5f6f5a29fb0706e20876ad3bd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 11 May 2013 19:58:56 -0700 Subject: Fix many issues with selection misapplication and rendering not matching applied materials --- indra/newview/llmaterialmgr.cpp | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index fb8cffa4ef..e41a46038f 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -216,6 +216,51 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } +boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) +{ + boost::signals2::connection connection; + + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (itMaterial != mMaterials.end()) + { + LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; + get_callback_te_t signal; + signal.connect(cb); + signal(material_id, itMaterial->second, te); + connection = boost::signals2::connection(); + } + else + { + if (!isGetPending(region_id, material_id)) + { + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; + itQueue->second.insert(material_id); + markGetPending(region_id, material_id); + } + + TEMaterialPair te_mat_pair; + te_mat_pair.te = te; + te_mat_pair.materialID = material_id; + + get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); + if (itCallback == mGetTECallbacks.end()) + { + std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); + itCallback = ret.first; + } + connection = itCallback->second->connect(cb); + } + + return connection; +} + bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -300,6 +345,22 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; + + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) + { + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); + } + } + return itMaterial->second; } -- cgit v1.2.3 From c2c9380fe135fd8b191ebe3c9a38129af4994ed8 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 12 May 2013 13:02:54 +0200 Subject: Avoid code duplication in LLMaterialMgr --- indra/newview/llmaterialmgr.cpp | 61 ----------------------------------------- 1 file changed, 61 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index e41a46038f..fb8cffa4ef 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -216,51 +216,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } -boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) -{ - boost::signals2::connection connection; - - material_map_t::const_iterator itMaterial = mMaterials.find(material_id); - if (itMaterial != mMaterials.end()) - { - LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; - get_callback_te_t signal; - signal.connect(cb); - signal(material_id, itMaterial->second, te); - connection = boost::signals2::connection(); - } - else - { - if (!isGetPending(region_id, material_id)) - { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) - { - LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); - itQueue = ret.first; - } - LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; - itQueue->second.insert(material_id); - markGetPending(region_id, material_id); - } - - TEMaterialPair te_mat_pair; - te_mat_pair.te = te; - te_mat_pair.materialID = material_id; - - get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); - if (itCallback == mGetTECallbacks.end()) - { - std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); - itCallback = ret.first; - } - connection = itCallback->second->connect(cb); - } - - return connection; -} - bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -345,22 +300,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; - - U32 i = 0; - while (i < LLTEContents::MAX_TES) - { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) - { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); - } - } - return itMaterial->second; } -- cgit v1.2.3 From 5ac9d9cb05f22099bea8c9312f5e0b234430022a Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 12 May 2013 16:10:31 +0200 Subject: LLMaterialMgr::get() doesn't handle a callback request for LLMaterialID::null --- indra/newview/llmaterialmgr.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index fb8cffa4ef..f217ff160e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -116,6 +116,7 @@ void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) LLMaterialMgr::LLMaterialMgr() { + mMaterials.insert(std::pair(LLMaterialID::null, LLMaterialPtr(NULL))); gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL); LLWorld::instance().setRegionRemovedCallback(boost::bind(&LLMaterialMgr::onRegionRemoved, this, _1)); } -- cgit v1.2.3 From d9e8ee7cfd323872145c23e4032989f9b7770f55 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 13 May 2013 13:02:53 -0700 Subject: NORSPEC-178 NORSPEC-179 NORSPEC-180 made enable/disable handling more consistent and increased max range on repeats per meter --- indra/newview/llmaterialmgr.cpp | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index f217ff160e..59e5d05736 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,6 +217,51 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } +boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) +{ + boost::signals2::connection connection; + + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (itMaterial != mMaterials.end()) + { + LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; + get_callback_te_t signal; + signal.connect(cb); + signal(material_id, itMaterial->second, te); + connection = boost::signals2::connection(); + } + else + { + if (!isGetPending(region_id, material_id)) + { + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; + itQueue->second.insert(material_id); + markGetPending(region_id, material_id); + } + + TEMaterialPair te_mat_pair; + te_mat_pair.te = te; + te_mat_pair.materialID = material_id; + + get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); + if (itCallback == mGetTECallbacks.end()) + { + std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); + itCallback = ret.first; + } + connection = itCallback->second->connect(cb); + } + + return connection; +} + bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -301,6 +346,22 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; + + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) + { + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); + } + } + return itMaterial->second; } -- cgit v1.2.3 From ad09e2111cd980117ae937b79155ef6c24e4567c Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Tue, 14 May 2013 21:14:46 +0200 Subject: NORSPEC-102 & Co Reloaded --- indra/newview/llmaterialmgr.cpp | 61 ----------------------------------------- 1 file changed, 61 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 59e5d05736..f217ff160e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,51 +217,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } -boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) -{ - boost::signals2::connection connection; - - material_map_t::const_iterator itMaterial = mMaterials.find(material_id); - if (itMaterial != mMaterials.end()) - { - LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; - get_callback_te_t signal; - signal.connect(cb); - signal(material_id, itMaterial->second, te); - connection = boost::signals2::connection(); - } - else - { - if (!isGetPending(region_id, material_id)) - { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) - { - LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); - itQueue = ret.first; - } - LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; - itQueue->second.insert(material_id); - markGetPending(region_id, material_id); - } - - TEMaterialPair te_mat_pair; - te_mat_pair.te = te; - te_mat_pair.materialID = material_id; - - get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); - if (itCallback == mGetTECallbacks.end()) - { - std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); - itCallback = ret.first; - } - connection = itCallback->second->connect(cb); - } - - return connection; -} - bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -346,22 +301,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; - - U32 i = 0; - while (i < LLTEContents::MAX_TES) - { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) - { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); - } - } - return itMaterial->second; } -- cgit v1.2.3 From 666896ac4efa0575c82cd58c9fe041f354ccbbfc Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 15 May 2013 17:00:13 -0700 Subject: NORSPEC-119 put back TE-specific get registration in material manager stomped during 'reloading'. --- indra/newview/llmaterialmgr.cpp | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index f217ff160e..59e5d05736 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,6 +217,51 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } +boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) +{ + boost::signals2::connection connection; + + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (itMaterial != mMaterials.end()) + { + LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; + get_callback_te_t signal; + signal.connect(cb); + signal(material_id, itMaterial->second, te); + connection = boost::signals2::connection(); + } + else + { + if (!isGetPending(region_id, material_id)) + { + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; + itQueue->second.insert(material_id); + markGetPending(region_id, material_id); + } + + TEMaterialPair te_mat_pair; + te_mat_pair.te = te; + te_mat_pair.materialID = material_id; + + get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); + if (itCallback == mGetTECallbacks.end()) + { + std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); + itCallback = ret.first; + } + connection = itCallback->second->connect(cb); + } + + return connection; +} + bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -301,6 +346,22 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; + + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) + { + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); + } + } + return itMaterial->second; } -- cgit v1.2.3 From 74c1bc29e7dc566c7bb1a654b1dbf632d39dcb17 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 17 May 2013 14:02:31 -0700 Subject: NORSPEC-189 restore old mat param update registration --- indra/newview/llmaterialmgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 59e5d05736..edf8e83038 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,6 +217,7 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } +#if USE_TE_SPECIFIC_REGISTRATION boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) { boost::signals2::connection connection; @@ -261,6 +262,7 @@ boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const return connection; } +#endif bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { @@ -346,6 +348,7 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } +#if USE_TE_SPECIFIC_REGISTRATION TEMaterialPair te_mat_pair; te_mat_pair.materialID = material_id; @@ -361,6 +364,7 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetTECallbacks.erase(itCallbackTE); } } +#endif return itMaterial->second; } @@ -779,3 +783,4 @@ void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) clearGetQueues(regionp->getRegionID()); // Put doesn't need clearing: objects that can't be found will clean up in processPutQueue() } + -- cgit v1.2.3 From 260afbcece7db436af411abcba28495bf99fa08b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 23 May 2013 16:24:34 -0700 Subject: NORSPEC-192 fix more incorrect batching, fix bug in reflecting normal map state in build tool, and protect against callback crashes when switching regions --- indra/newview/llmaterialmgr.cpp | 53 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index edf8e83038..5c0173c7a7 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -337,34 +337,41 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL itMaterial = ret.first; } - mGetPending.erase(pending_material_t(region_id, material_id)); - - get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); - if (itCallback != mGetCallbacks.end()) - { - (*itCallback->second)(material_id, itMaterial->second); - - delete itCallback->second; - mGetCallbacks.erase(itCallback); - } + // we may have cleared our queues on leaving a region before we recv'd our + // update for this material...too late now! + // + if (isGetPending(region_id, material_id)) + { + + #if USE_TE_SPECIFIC_REGISTRATION + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; -#if USE_TE_SPECIFIC_REGISTRATION - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) + { + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); + } + } + #endif - U32 i = 0; - while (i < LLTEContents::MAX_TES) - { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback != mGetCallbacks.end()) { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); + (*itCallback->second)(material_id, itMaterial->second); + + delete itCallback->second; + mGetCallbacks.erase(itCallback); } } -#endif + + mGetPending.erase(pending_material_t(region_id, material_id)); return itMaterial->second; } -- cgit v1.2.3 From 66e53759679910e2c3720cda92ba6e917c66d12c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 24 May 2013 15:07:23 -0700 Subject: NORSPEC-96 NORSPEC-189 another attempt at planar stretch across all 3 channels and make the materials CB use a UUID instead of this pointer for safety --- indra/newview/llmaterialmgr.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 5c0173c7a7..fdc1dfd749 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,7 +217,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } -#if USE_TE_SPECIFIC_REGISTRATION boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) { boost::signals2::connection connection; @@ -262,7 +261,6 @@ boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const return connection; } -#endif bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { @@ -343,7 +341,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL if (isGetPending(region_id, material_id)) { - #if USE_TE_SPECIFIC_REGISTRATION TEMaterialPair te_mat_pair; te_mat_pair.materialID = material_id; @@ -359,7 +356,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetTECallbacks.erase(itCallbackTE); } } - #endif get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); if (itCallback != mGetCallbacks.end()) -- cgit v1.2.3 From f04e9363b9daca52c1fd2e675c2646f7e1d05054 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 14 Jun 2013 09:41:33 -0700 Subject: NORSPEC-266 fix issues with observer feedback on edits of material map parameters --- indra/newview/llmaterialmgr.cpp | 43 +++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index fdc1dfd749..16871adc4d 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -335,36 +335,29 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL itMaterial = ret.first; } - // we may have cleared our queues on leaving a region before we recv'd our - // update for this material...too late now! - // - if (isGetPending(region_id, material_id)) - { - - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; - U32 i = 0; - while (i < LLTEContents::MAX_TES) + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) - { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); - } + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); } + } - get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); - if (itCallback != mGetCallbacks.end()) - { - (*itCallback->second)(material_id, itMaterial->second); + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback != mGetCallbacks.end()) + { + (*itCallback->second)(material_id, itMaterial->second); - delete itCallback->second; - mGetCallbacks.erase(itCallback); - } + delete itCallback->second; + mGetCallbacks.erase(itCallback); } mGetPending.erase(pending_material_t(region_id, material_id)); -- cgit v1.2.3 From 1c6783fdb564cb10ade2a585a874ce951fff34e6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 26 Jun 2013 09:43:01 -0400 Subject: NORSPEC-29: use the MaxMaterialsPerTransaction simulator feature if available --- indra/newview/llmaterialmgr.cpp | 86 +++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 33 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') 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(itFace->first); - faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast(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(itFace->first); + faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast(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; +} + -- cgit v1.2.3 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 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') 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 { -- 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 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'indra/newview/llmaterialmgr.cpp') 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; -} - -- cgit v1.2.3