summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.hgtags1
-rwxr-xr-xdoc/contributions.txt1
-rwxr-xr-xindra/llcommon/CMakeLists.txt1
-rwxr-xr-xindra/llcommon/llcoros.cpp13
-rwxr-xr-xindra/llcommon/llcoros.h6
-rwxr-xr-xindra/llcommon/tests/lleventcoro_test.cpp37
-rwxr-xr-xindra/newview/app_settings/settings.xml11
-rwxr-xr-xindra/newview/llappviewer.cpp12
-rwxr-xr-xindra/newview/lllocalbitmaps.cpp67
-rwxr-xr-xindra/newview/lllocalbitmaps.h4
-rw-r--r--indra/newview/llmaterialmgr.cpp53
-rw-r--r--indra/newview/llmaterialmgr.h31
-rwxr-xr-xindra/newview/llpanelface.cpp54
-rwxr-xr-xindra/newview/llselectmgr.cpp163
-rwxr-xr-xindra/newview/llselectmgr.h2
-rwxr-xr-xindra/newview/llspatialpartition.h2
-rwxr-xr-xindra/newview/llvovolume.cpp51
-rwxr-xr-xindra/newview/llvovolume.h7
-rwxr-xr-xindra/newview/skins/default/xui/en/menu_viewer.xml3
-rw-r--r--indra/newview/skins/default/xui/en/panel_tools_texture.xml6
20 files changed, 335 insertions, 190 deletions
diff --git a/.hgtags b/.hgtags
index 34cfdfbe1e..8320c2ae3e 100755
--- a/.hgtags
+++ b/.hgtags
@@ -456,3 +456,4 @@ a314f1c94374ab1f6633dd2983f7090a68663eb2 3.5.2-beta4
895628bb5e162410cfdf4bca58f0a57d22ccfcde 3.5.2-beta5
9013c07bfe1c51107233f1924dccdcc5057dd909 3.5.2-beta6
9b1b6f33aa5394b27bb652b31b5cb81ef6060370 3.5.2-release
+a277b841729f2a62ba1e34acacc964bc13c1ad6f 3.5.3-release
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 5b9a98ef80..b942bc4c19 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -1243,6 +1243,7 @@ Vadim Bigbear
VWR-2681
Vaalith Jinn
STORM-64
+ MATBUG-8
Vector Hastings
VWR-8726
Veritas Raymaker
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 95b1d536fe..3a4a8facc2 100755
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -337,6 +337,7 @@ if (LL_TESTS)
LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}")
+ LL_ADD_INTEGRATION_TEST(lleventcoro "" "${test_libs};${BOOST_CONTEXT_LIBRARY}")
LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llleap "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}")
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index 9122704306..a629f71d4b 100755
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -39,7 +39,12 @@
#include "llerror.h"
#include "stringize.h"
-LLCoros::LLCoros()
+LLCoros::LLCoros():
+ // MAINT-2724: default coroutine stack size too small on Windows.
+ // Previously we used
+ // boost::context::guarded_stack_allocator::default_stacksize();
+ // empirically this is 64KB on Windows and Linux. Try quadrupling.
+ mStackSize(256*1024)
{
// Register our cleanup() method for "mainloop" ticks
LLEventPumps::instance().obtain("mainloop").listen(
@@ -125,6 +130,12 @@ std::string LLCoros::getNameByID(const void* self_id) const
return "";
}
+void LLCoros::setStackSize(S32 stacksize)
+{
+ LL_INFOS("LLCoros") << "Setting coroutine stack size to " << stacksize << LL_ENDL;
+ mStackSize = stacksize;
+}
+
/*****************************************************************************
* MUST BE LAST
*****************************************************************************/
diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h
index 03df406b68..01ee11da1a 100755
--- a/indra/llcommon/llcoros.h
+++ b/indra/llcommon/llcoros.h
@@ -125,7 +125,7 @@ public:
template <typename CALLABLE>
std::string launch(const std::string& prefix, const CALLABLE& callable)
{
- return launchImpl(prefix, new coro(callable));
+ return launchImpl(prefix, new coro(callable, mStackSize));
}
/**
@@ -152,6 +152,9 @@ public:
/// getName() by self.get_id()
std::string getNameByID(const void* self_id) const;
+ /// for delayed initialization
+ void setStackSize(S32 stacksize);
+
private:
friend class LLSingleton<LLCoros>;
LLCoros();
@@ -159,6 +162,7 @@ private:
std::string generateDistinctName(const std::string& prefix) const;
bool cleanup(const LLSD&);
+ S32 mStackSize;
typedef boost::ptr_map<std::string, coro> CoroMap;
CoroMap mCoros;
};
diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp
index 8d12529613..5ebde1a31d 100755
--- a/indra/llcommon/tests/lleventcoro_test.cpp
+++ b/indra/llcommon/tests/lleventcoro_test.cpp
@@ -78,6 +78,7 @@
#include "../test/lltut.h"
#include "llsd.h"
+#include "llsdutil.h"
#include "llevents.h"
#include "tests/wrapllerrs.h"
#include "stringize.h"
@@ -108,7 +109,7 @@ match_substring(BidirectionalIterator begin,
BidirectionalIterator end,
std::string xmatch,
BOOST_DEDUCED_TYPENAME coroutine<BidirectionalIterator(void)>::self& self) {
- BidirectionalIterator begin_ = begin;
+//BidirectionalIterator begin_ = begin;
for(; begin != end; ++begin)
if(match(begin, end, xmatch)) {
self.yield(begin);
@@ -213,7 +214,7 @@ namespace tut
BEGIN
{
result = postAndWait(self,
- LLSD().insert("value", 17), // request event
+ LLSDMap("value", 17), // request event
immediateAPI.getPump(), // requestPump
"reply1", // replyPump
"reply"); // request["reply"] = name
@@ -226,7 +227,7 @@ namespace tut
BEGIN
{
LLEventWithID pair = ::postAndWait2(self,
- LLSD().insert("value", 18),
+ LLSDMap("value", 18),
immediateAPI.getPump(),
"reply2",
"error2",
@@ -244,7 +245,7 @@ namespace tut
BEGIN
{
LLEventWithID pair = ::postAndWait2(self,
- LLSD().insert("value", 18).insert("fail", LLSD()),
+ LLSDMap("value", 18)("fail", LLSD()),
immediateAPI.getPump(),
"reply2",
"error2",
@@ -273,7 +274,7 @@ namespace tut
BEGIN
{
LLCoroEventPump waiter;
- result = waiter.postAndWait(self, LLSD().insert("value", 17),
+ result = waiter.postAndWait(self, LLSDMap("value", 17),
immediateAPI.getPump(), "reply");
}
END
@@ -365,7 +366,7 @@ namespace tut
BEGIN
{
LLCoroEventPumps waiter;
- LLEventWithID pair(waiter.postAndWait(self, LLSD().insert("value", 23),
+ LLEventWithID pair(waiter.postAndWait(self, LLSDMap("value", 23),
immediateAPI.getPump(), "reply", "error"));
result = pair.first;
which = pair.second;
@@ -379,7 +380,7 @@ namespace tut
{
LLCoroEventPumps waiter;
LLEventWithID pair(
- waiter.postAndWait(self, LLSD().insert("value", 23).insert("fail", LLSD()),
+ waiter.postAndWait(self, LLSDMap("value", 23)("fail", LLSD()),
immediateAPI.getPump(), "reply", "error"));
result = pair.first;
which = pair.second;
@@ -392,7 +393,7 @@ namespace tut
BEGIN
{
LLCoroEventPumps waiter;
- result = waiter.postAndWaitWithException(self, LLSD().insert("value", 8),
+ result = waiter.postAndWaitWithException(self, LLSDMap("value", 8),
immediateAPI.getPump(), "reply", "error");
}
END
@@ -406,7 +407,7 @@ namespace tut
try
{
result = waiter.postAndWaitWithException(self,
- LLSD().insert("value", 9).insert("fail", LLSD()),
+ LLSDMap("value", 9)("fail", LLSD()),
immediateAPI.getPump(), "reply", "error");
debug("no exception");
}
@@ -424,7 +425,7 @@ namespace tut
BEGIN
{
LLCoroEventPumps waiter;
- result = waiter.postAndWaitWithLog(self, LLSD().insert("value", 30),
+ result = waiter.postAndWaitWithLog(self, LLSDMap("value", 30),
immediateAPI.getPump(), "reply", "error");
}
END
@@ -439,7 +440,7 @@ namespace tut
try
{
result = waiter.postAndWaitWithLog(self,
- LLSD().insert("value", 31).insert("fail", LLSD()),
+ LLSDMap("value", 31)("fail", LLSD()),
immediateAPI.getPump(), "reply", "error");
debug("no exception");
}
@@ -796,4 +797,18 @@ namespace tut
ensure("no result", result.isUndefined());
ensure_contains("got error", threw, "32");
}
+}
+
+/*==========================================================================*|
+#include <boost/context/guarded_stack_allocator.hpp>
+
+namespace tut
+{
+ template<> template<>
+ void object::test<23>()
+ {
+ set_test_name("stacksize");
+ std::cout << "default_stacksize: " << boost::context::guarded_stack_allocator::default_stacksize() << '\n';
+ }
} // namespace tut
+|*==========================================================================*/
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 9104ad8512..2d4ae5ea55 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1905,6 +1905,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>CoroutineStackSize</key>
+ <map>
+ <key>Comment</key>
+ <string>Size (in bytes) for each coroutine stack</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>262144</integer>
+ </map>
<key>CreateToolCopyCenters</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d4484d844f..4fb0ea8052 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -117,6 +117,7 @@
#include "llleap.h"
#include "stringize.h"
+#include "llcoros.h"
// Third party library includes
#include <boost/bind.hpp>
@@ -756,6 +757,7 @@ bool LLAppViewer::init()
//set the max heap size.
initMaxHeapSize() ;
+ LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
LLPrivateMemoryPoolManager::initClass((BOOL)gSavedSettings.getBOOL("MemoryPrivatePoolEnabled"), (U32)gSavedSettings.getU32("MemoryPrivatePoolSize")*1024*1024) ;
@@ -2813,6 +2815,16 @@ bool LLAppViewer::initConfiguration()
loadColorSettings();
+ // Let anyone else who cares know that we've populated our settings
+ // variables.
+ for (LLControlGroup::key_iter ki(LLControlGroup::beginKeys()), kend(LLControlGroup::endKeys());
+ ki != kend; ++ki)
+ {
+ // For each named instance of LLControlGroup, send an event saying
+ // we've initialized an LLControlGroup instance by that name.
+ LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", *ki));
+ }
+
return true; // Config was successful.
}
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 1f2b9904eb..2d9385390b 100755
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -58,6 +58,8 @@
#include "lltexlayerparams.h"
#include "llvovolume.h"
#include "llnotificationsutil.h"
+#include "pipeline.h"
+#include "llmaterialmgr.h"
/*=======================================*/
/* Formal declarations, constants, etc. */
@@ -339,7 +341,12 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id)
return;
}
- updateUserPrims(old_id, new_id);
+ // processing updates per channel; makes the process scalable.
+ // the only actual difference is in SetTE* call i.e. SetTETexture, SetTENormal, etc.
+ updateUserPrims(old_id, new_id, LLRender::DIFFUSE_MAP);
+ updateUserPrims(old_id, new_id, LLRender::NORMAL_MAP);
+ updateUserPrims(old_id, new_id, LLRender::SPECULAR_MAP);
+
updateUserSculpts(old_id, new_id); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something?
// default safeguard image for layers
@@ -367,17 +374,15 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id)
// this function sorts the faces from a getFaceList[getNumFaces] into a list of objects
// in order to prevent multiple sendTEUpdate calls per object during updateUserPrims
-std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id)
+std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 channel)
{
std::vector<LLViewerObject*> obj_list;
LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id);
-
- U32 ch = LLRender::DIFFUSE_MAP;
-
- for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(ch); face_iterator++)
+
+ for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++)
{
// getting an object from a face
- LLFace* face_to_object = (*old_texture->getFaceList(ch))[face_iterator];
+ LLFace* face_to_object = (*old_texture->getFaceList(channel))[face_iterator];
if(face_to_object)
{
@@ -418,9 +423,9 @@ std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id)
return obj_list;
}
-void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
+void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel)
{
- std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id);
+ std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id, channel);
for(std::vector<LLViewerObject*>::iterator object_iterator = objectlist.begin();
object_iterator != objectlist.end(); object_iterator++)
@@ -429,7 +434,8 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
if(object)
{
- bool update_obj = false;
+ bool update_tex = false;
+ bool update_mat = false;
S32 num_faces = object->getNumFaces();
for (U8 face_iter = 0; face_iter < num_faces; face_iter++)
@@ -437,20 +443,51 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
if (object->mDrawable)
{
LLFace* face = object->mDrawable->getFace(face_iter);
- if (face && face->getTexture() && face->getTexture()->getID() == old_id)
+ if (face && face->getTexture(channel) && face->getTexture(channel)->getID() == old_id)
{
- object->setTEImage(face_iter, LLViewerTextureManager::getFetchedTexture(
- new_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+ // these things differ per channel, unless there already is a universal
+ // texture setting function to setTE that takes channel as a param?
+ // p.s.: switch for now, might become if - if an extra test is needed to verify before touching normalmap/specmap
+ switch(channel)
+ {
+ case LLRender::DIFFUSE_MAP:
+ {
+ object->setTETexture(face_iter, new_id);
+ update_tex = true;
+ break;
+ }
+
+ case LLRender::NORMAL_MAP:
+ {
+ object->setTENormalMap(face_iter, new_id);
+ update_mat = true;
+ update_tex = true;
+ break;
+ }
+
+ case LLRender::SPECULAR_MAP:
+ {
+ object->setTESpecularMap(face_iter, new_id);
+ update_mat = true;
+ update_tex = true;
+ break;
+ }
+ }
+ // end switch
- update_obj = true;
}
}
}
- if (update_obj)
+ if (update_tex)
{
object->sendTEUpdate();
}
+
+ if (update_mat)
+ {
+ object->mDrawable->getVOVolume()->faceMappingChanged();
+ }
}
}
diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h
index 580b6dfa7e..2ee84bf46e 100755
--- a/indra/newview/lllocalbitmaps.h
+++ b/indra/newview/lllocalbitmaps.h
@@ -62,8 +62,8 @@ class LLLocalBitmap
private: /* self update private section */
bool decodeBitmap(LLPointer<LLImageRaw> raw);
void replaceIDs(LLUUID old_id, LLUUID new_id);
- std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id);
- void updateUserPrims(LLUUID old_id, LLUUID new_id);
+ std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id, U32 channel);
+ void updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel);
void updateUserSculpts(LLUUID old_id, LLUUID new_id);
void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type);
LLAvatarAppearanceDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind);
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index edf8e83038..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
{
@@ -337,34 +335,39 @@ 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))
+ {
+
+ 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);
+ }
+ }
- 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;
}
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h
index 9b3d7a0246..e317a791ad 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -47,10 +47,8 @@ public:
const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
-#if USE_TE_SPECIFIC_REGISTRATION
typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t;
boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb);
-#endif
typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
void getAll(const LLUUID& region_id);
@@ -84,27 +82,34 @@ protected:
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
get_callback_map_t mGetCallbacks;
-#if USE_TE_SPECIFIC_REGISTRATION
// struct for TE-specific material ID query
- struct TEMaterialPair
+ class TEMaterialPair
{
+ public:
+
U32 te;
LLMaterialID materialID;
- };
- // needed for std::map compliance only
- //
+ bool operator==(const TEMaterialPair& b) const { return (materialID == b.materialID) && (te == b.te); }
+ };
+
friend inline bool operator<(
- const struct LLMaterialMgr::TEMaterialPair& lhs,
- const struct LLMaterialMgr::TEMaterialPair& rhs)
+ const LLMaterialMgr::TEMaterialPair& lhs,
+ const LLMaterialMgr::TEMaterialPair& rhs)
{
- return (lhs.materialID < rhs.materialID) ? TRUE :
- (lhs.te < rhs.te) ? TRUE : FALSE;
+ return (lhs.te < rhs.te) ? TRUE :
+ (lhs.materialID < rhs.materialID);
}
- typedef std::map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t;
+ struct TEMaterialPairHasher
+ {
+ enum { bucket_size = 8 };
+ size_t operator()(const TEMaterialPair& key_value) const { return *((size_t*)key_value.materialID.get()); } // cheesy, but effective
+ bool operator()(const TEMaterialPair& left, const TEMaterialPair& right) const { return left < right; }
+ };
+
+ typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t;
get_callback_te_map_t mGetTECallbacks;
-#endif
typedef std::set<LLUUID> getall_queue_t;
getall_queue_t mGetAllQueue;
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 49750c8c19..b7dc838601 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -1683,7 +1683,7 @@ void LLPanelFace::updateUI()
texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
texture_ctrl->setImageAssetID(material->getNormalID());
- if (!material->getNormalID().isNull() && (bumpy == BUMPY_TEXTURE))
+ if (!material->getNormalID().isNull())
{
material->getNormalOffset(offset_x,offset_y);
material->getNormalRepeat(repeat_x,repeat_y);
@@ -1799,9 +1799,12 @@ void LLPanelFace::updateMaterial()
bool is_default_blend_mode = mIsAlpha ? (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
: (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
+ LLUUID norm_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID();
+ LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID();
+
if ( !is_default_blend_mode
- || (bumpiness == BUMPY_TEXTURE)
- || (shininess == SHINY_TEXTURE))
+ || !norm_map_id.isNull()
+ || !spec_map_id.isNull())
{
// This should match getState()
struct f1 : public LLSelectedTEGetFunctor<LLMaterialPtr>
@@ -1822,7 +1825,6 @@ void LLPanelFace::updateMaterial()
material->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex());
material->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger()));
- LLUUID norm_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID();
if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE))
{
LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL;
@@ -1852,7 +1854,7 @@ void LLPanelFace::updateMaterial()
material->setNormalRotation(0.0f);
}
- LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID();
+
if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE))
{
@@ -2264,6 +2266,48 @@ void LLPanelFace::onSelectTexture(const LLSD& data)
{
LLSelectMgr::getInstance()->saveSelectedObjectTextures();
sendTexture();
+
+ LLGLenum image_format;
+ struct f2 : public LLSelectedTEGetFunctor<LLGLenum>
+ {
+ LLGLenum get(LLViewerObject* object, S32 te_index)
+ {
+ LLGLenum image_format = GL_RGB;
+
+ LLViewerTexture* image = object->getTEImage(te_index);
+ if (image) image_format = image->getPrimaryFormat();
+ return image_format;
+ }
+ } func2;
+ LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format );
+
+ LLCtrlSelectionInterface* combobox_alphamode =
+ childGetSelectionInterface("combobox alphamode");
+
+ U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ if (combobox_alphamode)
+ {
+ switch (image_format)
+ {
+ case GL_RGBA:
+ case GL_ALPHA:
+ {
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+ break;
+
+ case GL_RGB: break;
+ default:
+ {
+ llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl;
+ }
+ break;
+ }
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+
+ updateMaterial();
}
void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 1bb12e495d..372dfb0f0c 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2501,57 +2501,41 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
continue;
}
- LLVector3 scale_ratio = selectNode->mTextureScaleRatios[te_num];
LLVector3 object_scale = object->getScale();
+ LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[LLRender::DIFFUSE_MAP][te_num];
+ LLVector3 normal_scale_ratio = selectNode->mTextureScaleRatios[LLRender::NORMAL_MAP][te_num];
+ LLVector3 specular_scale_ratio = selectNode->mTextureScaleRatios[LLRender::SPECULAR_MAP][te_num];
// Apply new scale to face
if (planar)
{
- F32 scale_s = scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
- F32 scale_t = scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+ F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
- switch (mTextureChannel)
+ F32 normal_scale_s = normal_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 normal_scale_t = normal_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+ F32 specular_scale_s = specular_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 specular_scale_t = specular_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+
+ object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t);
+
+ LLTextureEntry* tep = object->getTE(te_num);
+
+ if (tep && !tep->getMaterialParams().isNull())
{
- case LLRender::DIFFUSE_MAP:
- {
- object->setTEScale(te_num, scale_s, scale_t);
- }
- break;
-
- case LLRender::NORMAL_MAP:
- {
- LLTextureEntry* tep = object->getTE(te_num);
- if (tep && !tep->getMaterialParams().isNull())
- {
- LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = new LLMaterial(orig->asLLSD());
- p->setNormalRepeat(scale_s * 0.5f, scale_t * 0.5f);
- selectionSetMaterial( p );
- }
- }
- break;
-
- case LLRender::SPECULAR_MAP:
- {
- LLTextureEntry* tep = object->getTE(te_num);
- if (tep && !tep->getMaterialParams().isNull())
- {
- LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = new LLMaterial(orig->asLLSD());
- p->setSpecularRepeat(scale_s * 0.5f, scale_t * 0.5f);
- selectionSetMaterial( p );
- }
- }
- break;
- default:
- break;
+ LLMaterialPtr orig = tep->getMaterialParams();
+ LLMaterialPtr p = new LLMaterial(orig->asLLSD());
+ p->setNormalRepeat(normal_scale_s, normal_scale_t);
+ p->setSpecularRepeat(specular_scale_s, specular_scale_t);
+ selectionSetMaterial( p );
}
-
}
else
{
- object->setTEScale(te_num, scale_ratio.mV[s_axis]*object_scale.mV[s_axis],
- scale_ratio.mV[t_axis]*object_scale.mV[t_axis]);
+ object->setTEScale(te_num, diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis],
+ diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis]);
}
send = send_to_sim;
}
@@ -5876,7 +5860,10 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures)
void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
{
- mTextureScaleRatios.clear();
+ mTextureScaleRatios[LLRender::DIFFUSE_MAP].clear();
+ mTextureScaleRatios[LLRender::NORMAL_MAP].clear();
+ mTextureScaleRatios[LLRender::SPECULAR_MAP].clear();
+
if (mObject.notNull())
{
@@ -5884,9 +5871,15 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
for (U8 i = 0; i < mObject->getNumTEs(); i++)
{
- F32 s = 1.0f;
- F32 t = 1.0f;
+ F32 diffuse_s = 1.0f;
+ F32 diffuse_t = 1.0f;
+ F32 normal_s = 1.0f;
+ F32 normal_t = 1.0f;
+
+ F32 specular_s = 1.0f;
+ F32 specular_t = 1.0f;
+
LLVector3 v;
const LLTextureEntry* tep = mObject->getTE(i);
@@ -5899,60 +5892,54 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
U32 t_axis = VY;
LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
- switch(index_to_query)
+ tep->getScale(&diffuse_s,&diffuse_t);
+
+ if (mat)
{
- case LLRender::DIFFUSE_MAP:
- {
- tep->getScale(&s,&t);
- }
- break;
-
- case LLRender::NORMAL_MAP:
- {
- if (mat)
- {
- mat->getNormalRepeat(s, t);
- }
- else
- {
- tep->getScale(&s,&t);
- }
-
- }
- break;
-
- case LLRender::SPECULAR_MAP:
- {
- if (mat)
- {
- mat->getSpecularRepeat(s, t);
- }
- else
- {
- tep->getScale(&s,&t);
- }
- }
- break;
-
- default:
- // should never be.
- //
- llassert_always(false);
- break;
+ mat->getNormalRepeat(normal_s, normal_t);
+ }
+ else
+ {
+ tep->getScale(&normal_s,&normal_t);
}
- if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
+ if (mat)
{
- v.mV[s_axis] = s*scale.mV[s_axis];
- v.mV[t_axis] = t*scale.mV[t_axis];
+ mat->getSpecularRepeat(specular_s, specular_t);
}
else
{
- v.mV[s_axis] = s/scale.mV[s_axis];
- v.mV[t_axis] = t/scale.mV[t_axis];
+ tep->getScale(&specular_s,&specular_t);
}
- mTextureScaleRatios.push_back(v);
+ if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
+ {
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::DIFFUSE_MAP].push_back(v);
+
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::NORMAL_MAP].push_back(v);
+
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::SPECULAR_MAP].push_back(v);
+ }
+ else
+ {
+ v.mV[s_axis] = diffuse_s/scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t/scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::DIFFUSE_MAP].push_back(v);
+
+ v.mV[s_axis] = normal_s/scale.mV[s_axis];
+ v.mV[t_axis] = normal_t/scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::NORMAL_MAP].push_back(v);
+
+ v.mV[s_axis] = specular_s/scale.mV[s_axis];
+ v.mV[t_axis] = specular_t/scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::SPECULAR_MAP].push_back(v);
+ }
}
}
}
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index f9b97cebdd..a750d8ce72 100755
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -183,7 +183,7 @@ public:
U64 mCreationDate;
std::vector<LLColor4> mSavedColors;
uuid_vec_t mSavedTextures;
- std::vector<LLVector3> mTextureScaleRatios;
+ std::vector<LLVector3> mTextureScaleRatios[LLRender::NUM_TEXTURE_CHANNELS];
std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
BOOL mSilhouetteExists; // need to generate silhouette?
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index bf32440848..8ccc3efd66 100755
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -112,6 +112,7 @@ public:
U32 mOffset;
BOOL mFullbright;
U8 mBump;
+ U8 mShiny;
BOOL mParticle;
F32 mPartSize;
F32 mVSize;
@@ -120,6 +121,7 @@ public:
F32 mDistance;
U32 mDrawMode;
LLMaterialPtr mMaterial; // If this is null, the following parameters are unused.
+ LLMaterialID mMaterialID;
U32 mShaderMask;
LLPointer<LLViewerTexture> mSpecularMap;
const LLMatrix4* mSpecularMapMatrix;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 367edd21c6..b107f43e4c 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1973,27 +1973,19 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow)
return res;
}
-void LLVOVolume::setTEMaterialParamsCallbackTE(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te)
+void LLVOVolume::setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te)
{
- LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL;
- if (te >= getNumTEs())
- return;
-
- LLTextureEntry* texture_entry = getTE(te);
- if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
+ LLVOVolume* pVol = (LLVOVolume*)gObjectList.findObject(objectID);
+ if (pVol)
{
- setTEMaterialParams(te, pMaterialParams);
- }
-}
+ LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL;
+ if (te >= pVol->getNumTEs())
+ return;
-void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams)
-{
- LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL;
- for (U8 i = 0; i < getNumTEs(); i++)
- {
- if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID)))
+ LLTextureEntry* texture_entry = pVol->getTE(te);
+ if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
{
- setTEMaterialParams(i, pMaterialParams);
+ pVol->setTEMaterialParams(te, pMaterialParams);
}
}
}
@@ -2008,11 +2000,8 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
if (res)
{
-#if USE_TE_SPECIFIC_REGISTRATION
- LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, this, _1, _2, _3));
-#else
- LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2));
-#endif
+ LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, getID(), _1, _2, _3));
+
setChanged(TEXTURE);
if (!mDrawable.isNull())
{
@@ -4103,11 +4092,14 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? facep->getTextureEntry()->getBumpmap() : 0;
+ U8 shiny = facep->getTextureEntry()->getShiny();
+
LLViewerTexture* tex = facep->getTexture();
U8 index = facep->getTextureIndex();
LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get();
+ LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID();
bool batchable = false;
@@ -4158,11 +4150,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
#endif
+ draw_vec[idx]->mMaterial == mat &&
+ draw_vec[idx]->mMaterialID == mat_id &&
draw_vec[idx]->mFullbright == fullbright &&
- draw_vec[idx]->mBump == bump &&
+ draw_vec[idx]->mBump == bump &&
+ (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different
draw_vec[idx]->mTextureMatrix == tex_mat &&
draw_vec[idx]->mModelMatrix == model_mat &&
- draw_vec[idx]->mMaterial == mat &&
draw_vec[idx]->mShaderMask == shader_mask)
{
draw_vec[idx]->mCount += facep->getIndicesCount();
@@ -4192,7 +4186,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
- U8 shiny = facep->getTextureEntry()->getShiny();
+ draw_info->mShiny = shiny;
+
float alpha[4] =
{
0.00f,
@@ -4210,6 +4205,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
if (mat)
{
+ draw_info->mMaterialID = mat_id;
+
// We have a material. Update our draw info accordingly.
if (!mat->getSpecularID().isNull())
@@ -5012,6 +5009,10 @@ struct CompareBatchBreakerModified
{
return lte->getMaterialParams() < rte->getMaterialParams();
}
+ else if (LLPipeline::sRenderDeferred && (lte->getMaterialParams() == rte->getMaterialParams()) && (lte->getShiny() != rte->getShiny()))
+ {
+ return lte->getShiny() < rte->getShiny();
+ }
else
{
return lhs->getTexture() < rhs->getTexture();
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 52539ab8d5..928ff7f66b 100755
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -31,6 +31,7 @@
#include "llviewertexture.h"
#include "llviewermedia.h"
#include "llframetimer.h"
+#include "lllocalbitmaps.h"
#include "m3math.h" // LLMatrix3
#include "m4math.h" // LLMatrix4
#include <map>
@@ -158,6 +159,7 @@ public:
const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const;
void markForUpdate(BOOL priority) { LLViewerObject::markForUpdate(priority); mVolumeChanged = TRUE; }
+ void faceMappingChanged() { mFaceMappingChanged=TRUE; };
/*virtual*/ void onShift(const LLVector4a &shift_vector); // Called when the drawable shifts
@@ -187,8 +189,9 @@ public:
/*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags);
/*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
/*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
- void setTEMaterialParamsCallback(const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams);
- void setTEMaterialParamsCallbackTE(const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
+
+ static void setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
+
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
/*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t);
/*virtual*/ S32 setTEScaleS(const U8 te, const F32 s);
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 500c11da74..b01c3067ff 100755
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2666,7 +2666,8 @@
</menu_item_call>
<menu_item_call
label="Selected Material Info"
- name="Selected Material Info">
+ name="Selected Material Info"
+ shortcut="control|alt|shift|M">
<menu_item_call.on_click
function="Advanced.SelectedMaterialInfo" />
</menu_item_call>
diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml
index d3a9437063..5ac2ec2b20 100644
--- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml
+++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml
@@ -318,10 +318,13 @@
label="weave"
name="weave"
value="weave" />
+ <!--
+ NORSPEC-182, ensure item doesn't show up in menu until it should
<combo_box.item
label="Use texture"
name="Use texture"
value="Use texture" />
+ -->
</combo_box>
<texture_picker
allow_no_texture="true"
@@ -373,10 +376,13 @@
label="High"
name="High"
value="High" />
+ <!--
+ NORSPEC-182, ensure item doesn't show up in menu until it should
<combo_box.item
label="Use texture"
name="Use texture"
value="Use texture" />
+ -->
</combo_box>
<text
type="string"