...
 
Commits (11)
......@@ -306,4 +306,12 @@ else (USESYSTEMLIBS)
)
endif (USESYSTEMLIBS)
option(RELEASE_SHOW_ASSERTS "Enable asserts in release builds" OFF)
if(RELEASE_SHOW_ASSERTS)
add_definitions(-DRELEASE_SHOW_ASSERT=1)
else()
add_definitions(-URELEASE_SHOW_ASSERT)
endif()
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
......@@ -145,23 +145,23 @@ const S32 KEY_COUNT = 256;
const F32 DEFAULT_WATER_HEIGHT = 20.0f;
// Maturity ratings for simulators
const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG
const U8 SIM_ACCESS_PG = 13;
const U8 SIM_ACCESS_MATURE = 21;
const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only
const U8 SIM_ACCESS_DOWN = 254;
const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT;
constexpr U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG
constexpr U8 SIM_ACCESS_PG = 13;
constexpr U8 SIM_ACCESS_MATURE = 21;
constexpr U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only
constexpr U8 SIM_ACCESS_DOWN = 254;
constexpr U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT;
// attachment constants
const U8 ATTACHMENT_ADD = 0x80;
constexpr U8 ATTACHMENT_ADD = 0x80;
// god levels
const U8 GOD_MAINTENANCE = 250;
const U8 GOD_FULL = 200;
const U8 GOD_LIAISON = 150;
const U8 GOD_CUSTOMER_SERVICE = 100;
const U8 GOD_LIKE = 1;
const U8 GOD_NOT = 0;
constexpr U8 GOD_MAINTENANCE = 250;
constexpr U8 GOD_FULL = 200;
constexpr U8 GOD_LIAISON = 150;
constexpr U8 GOD_CUSTOMER_SERVICE = 100;
constexpr U8 GOD_LIKE = 1;
constexpr U8 GOD_NOT = 0;
// "agent id" for things that should be done to ALL agents
LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS;
......
......@@ -306,7 +306,7 @@ namespace LLError
}
//this is cheaper than llcallstacks if no need to output other variables to call stacks.
#if ENABLE_DEBUG_MACRO
#if defined(SHOW_DEBUG) || defined(LL_RELEASE_WITH_DEBUG_INFO) || defined(_DEBUG)
#define LL_PUSH_CALLSTACKS() LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
#define llcallstacks \
......
......@@ -141,8 +141,8 @@ class LLSD::Impl
virtual void erase(Integer) { }
virtual const LLSD& ref(Integer) const { return undef(); }
virtual const std::map<String, LLSD>& map() const { static const std::map<String, LLSD> empty; return empty; }
virtual std::map<String, LLSD>& map() { static std::map<String, LLSD> empty; return empty; }
virtual const absl::node_hash_map<String, LLSD>& map() const { static const absl::node_hash_map<String, LLSD> empty; return empty; }
virtual absl::node_hash_map<String, LLSD>& map() { static absl::node_hash_map<String, LLSD> empty; return empty; }
LLSD::map_const_iterator beginMap() const { return endMap(); }
LLSD::map_const_iterator endMap() const { return map().end(); }
virtual const std::vector<LLSD>& array() const { static const std::vector<LLSD> empty; return empty; }
......@@ -364,7 +364,7 @@ namespace
class ImplMap : public LLSD::Impl
{
private:
typedef std::map<LLSD::String, LLSD> DataMap;
typedef absl::node_hash_map<LLSD::String, LLSD> DataMap;
DataMap mData;
......@@ -456,8 +456,8 @@ namespace
const LLSD& ImplMap::ref(const LLSD::String& k) const
{
DataMap::const_iterator i = mData.lower_bound(k);
if (i == mData.end() || mData.key_comp()(k, i->first))
DataMap::const_iterator i = mData.find(k);
if (i == mData.end())
{
return undef();
}
......@@ -956,8 +956,8 @@ const char *LLSD::dump(const LLSD &llsd)
return llsd_dump(llsd, false);
}
std::map<LLSD::String, LLSD>& LLSD::map() { return makeMap(impl).map(); }
const std::map<LLSD::String, LLSD>& LLSD::map() const { return safe(impl).map(); }
absl::node_hash_map<LLSD::String, LLSD>& LLSD::map() { return makeMap(impl).map(); }
const absl::node_hash_map<LLSD::String, LLSD>& LLSD::map() const { return safe(impl).map(); }
LLSD::map_iterator LLSD::beginMap() { return map().begin(); }
LLSD::map_iterator LLSD::endMap() { return map().end(); }
......
......@@ -27,7 +27,7 @@
#ifndef LL_LLSD_NEW_H
#define LL_LLSD_NEW_H
#include <map>
#include <absl/container/node_hash_map.h>
#include <string>
#include <vector>
......@@ -314,11 +314,11 @@ class LL_COMMON_API LLSD
//@{
int size() const;
typedef std::map<String, LLSD>::iterator map_iterator;
typedef std::map<String, LLSD>::const_iterator map_const_iterator;
typedef absl::node_hash_map<String, LLSD>::iterator map_iterator;
typedef absl::node_hash_map<String, LLSD>::const_iterator map_const_iterator;
std::map<String, LLSD>& map();
const std::map<String, LLSD>& map() const;
absl::node_hash_map<String, LLSD>& map();
const absl::node_hash_map<String, LLSD>& map() const;
map_iterator beginMap();
map_iterator endMap();
......
......@@ -1323,16 +1323,15 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr,
}
bool need_comma = false;
LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap();
for(; iter != end; ++iter)
std::map<std::string, LLSD> sorted_map(data.beginMap(), data.endMap());
for(const auto& out_pair : sorted_map)
{
if(need_comma) ostr << ",";
need_comma = true;
ostr << post << inner_pre << '\'';
serialize_string((*iter).first, ostr);
serialize_string(out_pair.first, ostr);
ostr << "':";
format_count += format_impl((*iter).second, ostr, options, level + 2);
format_count += format_impl(out_pair.second, ostr, options, level + 2);
}
ostr << post << pre << "}";
break;
......@@ -1484,13 +1483,12 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr,
ostr.put('{');
U32 size_nbo = htonl(data.size());
ostr.write((const char*)(&size_nbo), sizeof(U32));
LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap();
for(; iter != end; ++iter)
std::map<std::string, LLSD> sorted_map(data.beginMap(), data.endMap());
for (const auto& out_pair : sorted_map)
{
ostr.put('k');
formatString((*iter).first, ostr);
format_count += format_impl((*iter).second, ostr, options, level+1);
formatString(out_pair.first, ostr);
format_count += format_impl(out_pair.second, ostr, options, level+1);
}
ostr.put('}');
break;
......
......@@ -101,12 +101,11 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
else
{
ostr << pre << "<map>" << post;
LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap();
for(; iter != end; ++iter)
std::map<std::string, LLSD> sorted_map(data.beginMap(), data.endMap());
for(const auto& out_pair : sorted_map)
{
ostr << pre << "<key>" << escapeString((*iter).first) << "</key>" << post;
format_count += format_impl((*iter).second, ostr, options, level + 1);
ostr << pre << "<key>" << escapeString(out_pair.first) << "</key>" << post;
format_count += format_impl(out_pair.second, ostr, options, level + 1);
}
ostr << pre << "</map>" << post;
}
......
......@@ -114,8 +114,10 @@ class LLMatrix3a
LL_ALIGN_16(LLVector4a mColumns[3]);
};
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLMatrix3a>::value, "LLMatrix3a must be a trivial type");
static_assert(std::is_standard_layout<LLMatrix3a>::value, "LLMatrix3a must be a standard layout type");
#endif
class LLRotation : public LLMatrix3a
{
......@@ -126,7 +128,9 @@ class LLRotation : public LLMatrix3a
// Returns true if this rotation is orthonormal with det ~= 1
inline bool isOkRotation() const;
};
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLRotation>::value, "LLRotation must be a trivial type");
static_assert(std::is_standard_layout<LLRotation>::value, "LLRotation must be a standard layout type");
#endif
#endif
......@@ -152,9 +152,10 @@ class LLMatrix4a
affineTransformSSE(v,res);
}
};
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type");
static_assert(std::is_standard_layout<LLMatrix4a>::value, "LLMatrix4a must be a standard layout type");
#endif
inline LLVector4a rowMul(const LLVector4a &row, const LLMatrix4a &mat)
{
......
......@@ -104,7 +104,9 @@ class LLPlane
LLVector4a mV;
} LL_ALIGN_POSTFIX(16);
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLPlane>::value, "LLPlane must be a trivial type");
static_assert(std::is_standard_layout<LLPlane>::value, "LLPlane must be a standard layout type");
#endif
#endif // LL_LLPLANE_H
......@@ -101,7 +101,9 @@ class LLQuaternion2
LLVector4a mQ;
};
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLQuaternion2>::value, "LLQuaternion2 must be a trivial type");
static_assert(std::is_standard_layout<LLQuaternion2>::value, "LLQuaternion2 must be a standard layout type");
#endif
#endif
......@@ -95,7 +95,7 @@ class LLVector4a
// CONSTRUCTORS
////////////////////////////////////
#if SHOW_ASSERT
#ifdef SHOW_ASSERT
LLVector4a()
{ //DO NOT INITIALIZE -- The overhead is completely unnecessary
ll_assert_aligned(this,16);
......@@ -330,8 +330,10 @@ class LLVector4a
LLQuad mQ;
} LL_ALIGN_POSTFIX(16);
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLVector4a>::value, "LLVector4a must be a trivial type");
static_assert(std::is_standard_layout<LLVector4a>::value, "LLVector4a must be a standard layout type");
#endif
inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p)
{
......
......@@ -399,7 +399,7 @@ class LLVolumeOctreeRebound : public LLOctreeTravelerDepthFirst<LLVolumeTriangle
max = *(tri->mV[0]);
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =
branch->getDataBegin(); iter != branch->getDataEnd(); ++iter)
branch->getDataBegin(), iter_end = branch->getDataEnd(); iter != iter_end; ++iter)
{ //for each triangle in node
//stretch by triangles in node
......
......@@ -125,7 +125,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>
void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle>* node)
{
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =
node->getDataBegin(); iter != node->getDataEnd(); ++iter)
node->getDataBegin(), iter_end = node->getDataEnd(); iter != iter_end; ++iter)
{
const LLVolumeTriangle* tri = *iter;
......@@ -256,8 +256,8 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)
}
//children fit, check data
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();
iter != branch->getDataEnd(); ++iter)
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin(), iter_end = branch->getDataEnd();
iter != iter_end; ++iter)
{
const LLVolumeTriangle* tri = *iter;
......
......@@ -106,11 +106,10 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
top += LLFontGL::sCurOrigin.mY;
gGL.loadUIIdentity();
LLRender2D *r2d_inst = LLRender2D::getInstance();
gl_rect_2d(llfloor((F32)left * r2d_inst->mGLScaleFactor.mV[VX]) - pixel_offset,
llfloor((F32)top * r2d_inst->mGLScaleFactor.mV[VY]) + pixel_offset,
llfloor((F32)right * r2d_inst->mGLScaleFactor.mV[VX]) + pixel_offset,
llfloor((F32)bottom * r2d_inst->mGLScaleFactor.mV[VY]) - pixel_offset,
gl_rect_2d(llfloor((F32)left * LLRender2D::sGLScaleFactor.mV[VX]) - pixel_offset,
llfloor((F32)top * LLRender2D::sGLScaleFactor.mV[VY]) + pixel_offset,
llfloor((F32)right * LLRender2D::sGLScaleFactor.mV[VX]) + pixel_offset,
llfloor((F32)bottom * LLRender2D::sGLScaleFactor.mV[VY]) - pixel_offset,
filled);
gGL.popUIMatrix();
}
......@@ -799,7 +798,7 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
}
gGL.end();
LLRender2D::getInstance()->setLineWidth(1.f);
LLRender2D::setLineWidth(1.f);
}
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle)
......@@ -966,7 +965,7 @@ void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
}
else
{ //polygon stipple is deprecated, use "Checker" texture
LLPointer<LLUIImage> img = LLRender2D::getInstance()->getUIImage("Checker");
LLPointer<LLUIImage> img = LLRender2D::getUIImage("Checker");
gGL.getTexUnit(0)->bind(img->getImage());
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
......@@ -1566,26 +1565,29 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
}
LLVector2 LLRender2D::sGLScaleFactor = { 1.f, 1.f };
LLImageProviderInterface* LLRender2D::sImageProvider = nullptr;
LLRender2D::LLRender2D(LLImageProviderInterface* image_provider)
{
mGLScaleFactor = LLVector2(1.f, 1.f);
mImageProvider = image_provider;
if(mImageProvider)
sGLScaleFactor = LLVector2(1.f, 1.f);
sImageProvider = image_provider;
if(sImageProvider)
{
mImageProvider->addOnRemovalCallback(resetProvider);
sImageProvider->addOnRemovalCallback(resetProvider);
}
}
LLRender2D::~LLRender2D()
{
if(mImageProvider)
if(sImageProvider)
{
mImageProvider->cleanUp();
mImageProvider->deleteOnRemovalCallback(resetProvider);
sImageProvider->cleanUp();
sImageProvider->deleteOnRemovalCallback(resetProvider);
}
}
// static
void LLRender2D::translate(F32 x, F32 y, F32 z)
{
gGL.translateUI(x,y,z);
......@@ -1594,20 +1596,26 @@ void LLRender2D::translate(F32 x, F32 y, F32 z)
LLFontGL::sCurDepth += z;
}
// static
void LLRender2D::pushMatrix()
{
gGL.pushUIMatrix();
LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
LLFontGL::sOriginStack.emplace_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
}
// static
void LLRender2D::popMatrix()
{
gGL.popUIMatrix();
LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first;
LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second;
{
const auto& origin_pair = LLFontGL::sOriginStack.back();
LLFontGL::sCurOrigin = origin_pair.first;
LLFontGL::sCurDepth = origin_pair.second;
}
LLFontGL::sOriginStack.pop_back();
}
// static
void LLRender2D::loadIdentity()
{
gGL.loadUIIdentity();
......@@ -1616,22 +1624,25 @@ void LLRender2D::loadIdentity()
LLFontGL::sCurDepth = 0.f;
}
// static
void LLRender2D::setScaleFactor(const LLVector2 &scale_factor)
{
mGLScaleFactor = scale_factor;
sGLScaleFactor = scale_factor;
}
// static
void LLRender2D::setLineWidth(F32 width)
{
gGL.flush();
glLineWidth(width * lerp(mGLScaleFactor.mV[VX], mGLScaleFactor.mV[VY], 0.5f));
glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f));
}
// static
LLPointer<LLUIImage> LLRender2D::getUIImageByID(const LLUUID& image_id, S32 priority)
{
if (mImageProvider)
if (sImageProvider)
{
return mImageProvider->getUIImageByID(image_id, priority);
return sImageProvider->getUIImageByID(image_id, priority);
}
else
{
......@@ -1639,10 +1650,11 @@ LLPointer<LLUIImage> LLRender2D::getUIImageByID(const LLUUID& image_id, S32 prio
}
}
// static
LLPointer<LLUIImage> LLRender2D::getUIImage(const std::string& name, S32 priority)
{
if (!name.empty() && mImageProvider)
return mImageProvider->getUIImage(name, priority);
if (!name.empty() && sImageProvider)
return sImageProvider->getUIImage(name, priority);
else
return NULL;
}
......@@ -1652,7 +1664,7 @@ void LLRender2D::resetProvider()
{
if (LLRender2D::instanceExists())
{
LLRender2D::getInstance()->mImageProvider = NULL;
LLRender2D::sImageProvider = NULL;
}
}
......
......@@ -127,18 +127,18 @@ class LLRender2D final : public LLParamSingleton<LLRender2D>
LOG_CLASS(LLRender2D);
~LLRender2D();
public:
void pushMatrix();
void popMatrix();
void loadIdentity();
void translate(F32 x, F32 y, F32 z = 0.0f);
static void pushMatrix();
static void popMatrix();
static void loadIdentity();
static void translate(F32 x, F32 y, F32 z = 0.0f);
void setLineWidth(F32 width);
void setScaleFactor(const LLVector2& scale_factor);
static void setLineWidth(F32 width);
static void setScaleFactor(const LLVector2& scale_factor);
LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
LLVector2 mGLScaleFactor;
static LLVector2 sGLScaleFactor;
protected:
// since LLRender2D has no control of image provider's lifecycle
......@@ -147,7 +147,7 @@ class LLRender2D final : public LLParamSingleton<LLRender2D>
static void resetProvider();
private:
LLImageProviderInterface* mImageProvider;
static LLImageProviderInterface* sImageProvider;
};
class LLImageProviderInterface
......
......@@ -81,10 +81,10 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
}
}
LLRender2D::getInstance()->pushMatrix();
LLRender2D::pushMatrix();
{
LLVector3 rect_origin = origin_agent + (rect.mLeft * x_axis) + (rect.mBottom * y_axis);
LLRender2D::getInstance()->translate(rect_origin.mV[VX],
LLRender2D::translate(rect_origin.mV[VX],
rect_origin.mV[VY],
rect_origin.mV[VZ]);
gGL.getTexUnit(0)->bind(getImage());
......@@ -103,7 +103,7 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
rect.getWidth() * x_axis,
rect.getHeight() * y_axis);
} LLRender2D::getInstance()->popMatrix();
}LLRender2D::popMatrix();
}
//#include "lluiimage.inl"
......@@ -138,7 +138,7 @@ namespace LLInitParam
return;
}
LLUIImage* imagep = LLRender2D::getInstance()->getUIImage(name());
LLUIImage* imagep = LLRender2D::getUIImage(name());
if (imagep)
{
updateValue(imagep);
......
......@@ -30,6 +30,7 @@
#include "llinitparam.h"
#include "llsingleton.h"
#include <absl/container/flat_hash_map.h>
class LLCommand;
class LLCommandManager;
......@@ -198,7 +199,7 @@ class LLCommandManager final
void addCommand(LLCommand * command);
private:
typedef std::map<LLUUID, U32> CommandIndexMap;
typedef absl::flat_hash_map<LLUUID, U32> CommandIndexMap;
typedef std::vector<LLCommand *> CommandVector;
CommandVector mCommands;
......
......@@ -131,6 +131,11 @@ void LLConsole::setFontSize(S32 size_index)
void LLConsole::draw()
{
if (mParagraphs.empty()) //No text to draw.
{
return;
}
// Units in pixels
static const F32 padding_horizontal = 10;
static const F32 padding_vertical = 3;
......@@ -142,11 +147,6 @@ void LLConsole::draw()
F32 skip_time = cur_time - mLinePersistTime;
F32 fade_time = cur_time - mFadeTime;
if (mParagraphs.empty()) //No text to draw.
{
return;
}
U32 num_lines=0;
paragraph_t::reverse_iterator paragraph_it;
......
......@@ -39,9 +39,9 @@
LLFloaterReg::instance_list_t LLFloaterReg::sNullInstanceList;
LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap;
LLFloaterReg::build_map_t LLFloaterReg::sBuildMap;
std::map<std::string,std::string> LLFloaterReg::sGroupMap;
LLFloaterReg::group_map_t LLFloaterReg::sGroupMap;
bool LLFloaterReg::sBlockShowFloaters = false;
std::set<std::string> LLFloaterReg::sAlwaysShowableList;
absl::flat_hash_set<std::string> LLFloaterReg::sAlwaysShowableList;
static LLFloaterRegListener sFloaterRegListener;
......@@ -89,7 +89,7 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
candidate_rect.mTop = 100000;
LLFloater* candidate_floater = NULL;
std::map<std::string,std::string>::const_iterator it = sGroupMap.begin(), it_end = sGroupMap.end();
auto it = sGroupMap.begin(), it_end = sGroupMap.end();
for( ; it != it_end; ++it)
{
const std::string& group_name = it->second;
......@@ -457,11 +457,9 @@ void LLFloaterReg::registerControlVariables()
}
const LLSD& exclude_list = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("always_showable_floaters");
for (LLSD::array_const_iterator iter = exclude_list.beginArray();
iter != exclude_list.endArray();
iter++)
for (const auto& llsd_var : exclude_list.array())
{
sAlwaysShowableList.insert(iter->asString());
sAlwaysShowableList.insert(llsd_var.asString());
}
}
......@@ -540,7 +538,7 @@ U32 LLFloaterReg::getVisibleFloaterInstanceCount()
{
U32 count = 0;
std::map<std::string,std::string>::const_iterator it = sGroupMap.begin(), it_end = sGroupMap.end();
auto it = sGroupMap.begin(), it_end = sGroupMap.end();
for( ; it != it_end; ++it)
{
const std::string& group_name = it->second;
......
......@@ -32,6 +32,9 @@
#include <list>
#include <boost/function.hpp>
#include<absl/container/flat_hash_set.h>
#include<absl/container/flat_hash_map.h>
#include<absl/container/node_hash_map.h>
// [RLVa:KB] - Checked: 2011-05-25 (RLVa-1.4.0a)
#include <boost/signals2.hpp>
#include "llboost.h"
......@@ -55,26 +58,27 @@ class LLFloaterReg
// 2) We can change the key of a floater without altering the list.
typedef std::list<LLFloater*> instance_list_t;
typedef const instance_list_t const_instance_list_t;
typedef std::map<std::string, instance_list_t> instance_map_t;
typedef absl::node_hash_map<std::string, instance_list_t> instance_map_t;
struct BuildData
{
LLFloaterBuildFunc mFunc;
std::string mFile;
};
typedef std::map<std::string, BuildData> build_map_t;
typedef absl::flat_hash_map<std::string, BuildData> build_map_t;
typedef absl::flat_hash_map<std::string, std::string> group_map_t;
private:
friend class LLFloaterRegListener;
static instance_list_t sNullInstanceList;
static instance_map_t sInstanceMap;
static build_map_t sBuildMap;
static std::map<std::string,std::string> sGroupMap;
static group_map_t sGroupMap;
static bool sBlockShowFloaters;
/**
* Defines list of floater names that can be shown despite state of sBlockShowFloaters.
*/
static std::set<std::string> sAlwaysShowableList;
static absl::flat_hash_set<std::string> sAlwaysShowableList;
// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.4.0a) | Modified: RLVa-1.2.0a
// Used to determine whether a floater can be shown
......
......@@ -961,10 +961,10 @@ void LLToolBar::draw()
// Update enable/disable state and highlight state for editable toolbars
if (!mReadOnly)
{
for (toolbar_button_list::iterator btn_it = mButtons.begin(); btn_it != mButtons.end(); ++btn_it)
auto& commandManager = LLCommandManager::instance();
for (LLToolBarButton* btn : mButtons)
{
LLToolBarButton* btn = *btn_it;
LLCommand* command = LLCommandManager::instance().getCommand(btn->mId);
LLCommand* command = commandManager.getCommand(btn->mId);
if (command && btn->mIsEnabledSignal)
{
......
......@@ -313,18 +313,18 @@ class LLUI final : public LLParamSingleton<LLUI>
void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX);
// LLRender2D wrappers
static void pushMatrix() { LLRender2D::getInstance()->pushMatrix(); }
static void popMatrix() { LLRender2D::getInstance()->popMatrix(); }
static void loadIdentity() { LLRender2D::getInstance()->loadIdentity(); }
static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::getInstance()->translate(x, y, z); }
static LLVector2& getScaleFactor() { return LLRender2D::getInstance()->mGLScaleFactor; }
static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::getInstance()->setScaleFactor(scale_factor); }
static void setLineWidth(F32 width) { LLRender2D::getInstance()->setLineWidth(width); }
static void pushMatrix() { LLRender2D::pushMatrix(); }
static void popMatrix() { LLRender2D::popMatrix(); }
static void loadIdentity() { LLRender2D::loadIdentity(); }
static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); }
static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; }
static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); }
static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); }
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0)
{ return LLRender2D::getInstance()->getUIImageByID(image_id, priority); }
{ return LLRender2D::getUIImageByID(image_id, priority); }
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0)
{ return LLRender2D::getInstance()->getUIImage(name, priority); }
{ return LLRender2D::getUIImage(name, priority); }
//
// Data
......
......@@ -33,6 +33,7 @@
#include <sstream>
#include <boost/tokenizer.hpp>
#include <boost/bind.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include "llrender.h"
#include "llevent.h"
......@@ -1172,14 +1173,12 @@ void LLView::drawChildren()
{
if (!mChildList.empty())
{
LLView* rootp = LLUI::getInstance()->getRootView();
auto& uiInst = LLUI::instance();
LLView* rootp = uiInst.getRootView();
++sDepth;
for (child_list_reverse_iter_t child_iter = mChildList.rbegin(), child_end = mChildList.rend(); child_iter != child_end;) // ++child_iter)
for (LLView* viewp : boost::adaptors::reverse(mChildList))
{
child_list_reverse_iter_t child = child_iter++;
LLView *viewp = *child;
if (viewp == NULL)
{
continue;
......@@ -1188,7 +1187,7 @@ void LLView::drawChildren()
if (viewp->getVisible() && viewp->getRect().isValid())
{
LLRect screen_rect = viewp->calcScreenRect();
if ( rootp->getLocalRect().overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
if ( rootp->getLocalRect().overlaps(screen_rect) && uiInst.mDirtyRect.overlaps(screen_rect))
{
LLUI::pushMatrix();
{
......
......@@ -1316,7 +1316,7 @@ ALAOSet* ALAOEngine::selectSetByName(const std::string& name)
return nullptr;
}
const std::vector<ALAOSet*> ALAOEngine::getSetList() const
const std::vector<ALAOSet*>& ALAOEngine::getSetList() const
{
return mSets;
}
......
......@@ -129,7 +129,7 @@ class ALAOEngine final : public LLSingleton<ALAOEngine>
// callback from LLAppViewer
static void onLoginComplete();
const std::vector<ALAOSet*> getSetList() const;
const std::vector<ALAOSet*>& getSetList() const;
const std::string& getCurrentSetName() const;
const ALAOSet* getDefaultSet() const;
bool renameSet(ALAOSet* set, const std::string& name);
......
......@@ -75,7 +75,7 @@ BOOL ALPanelAOMini::postBuild()
void ALPanelAOMini::updateSetList()
{
std::vector<ALAOSet*> list = ALAOEngine::getInstance()->getSetList();
const std::vector<ALAOSet*>& list = ALAOEngine::getInstance()->getSetList();
if (list.empty())
{
return;
......
......@@ -1991,9 +1991,11 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
camera_position_global = focusPosGlobal + mCameraFocusOffset;
}
auto& worldInst = LLWorld::instance();
if (!ALControlCache::DisableCameraConstraints && !gAgent.isGodlike())
{
LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
LLViewerRegion* regionp = worldInst.getRegionFromPosGlobal(camera_position_global);
bool constrain = true;
if(regionp && regionp->canManageEstate())
{
......@@ -2014,7 +2016,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
}
// JC - Could constrain camera based on parcel stuff here.
// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
// LLViewerRegion *regionp = worldInst.getRegionFromPosGlobal(camera_position_global);
//
// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global)))
// {
......@@ -2068,7 +2070,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
// Don't let camera go underground
F32 camera_min_off_ground = getCameraMinOffGround();
camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global);
camera_land_height = worldInst.resolveLandHeightGlobal(camera_position_global);
if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground)
{
......
......@@ -72,7 +72,8 @@ BOOL LLAgentUI::checkAgentDistance(const LLVector3& pole, F32 radius)
BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region)
{
LLViewerRegion* region = gAgent.getRegion();
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
LLViewerParcelMgr& parcelMGr = LLViewerParcelMgr::instance();
LLParcel* parcel = parcelMGr.getAgentParcel();
if (!region || !parcel) return FALSE;
......@@ -100,21 +101,20 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const
}
// create a default name and description for the landmark
std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName();
std::string region_name = region->getName();
bool rlva_has_showloc = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC);
const std::string& parcel_name = rlva_has_showloc ? RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL) : parcelMGr.getAgentParcelName();
const std::string& region_name = rlva_has_showloc ? RlvStrings::getString(RLV_STRING_HIDDEN_REGION) : region->getName();
// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0d) | Modified: RLVa-1.2.0d
// RELEASE-RLVa: [SL-2.0.0] Check ELocationFormat to make sure our switch still makes sense
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
parcel_name = RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL);
region_name = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
if (LOCATION_FORMAT_NO_MATURITY == fmt)
fmt = LOCATION_FORMAT_LANDMARK;
else if (LOCATION_FORMAT_FULL == fmt)
fmt = LOCATION_FORMAT_NO_COORDS;
}
// [/RLVa:KB]
std::string sim_access_string = region->getSimAccessString();
const std::string& sim_access_string = region->getSimAccessString();
std::string buffer;
if( parcel_name.empty() )
{
......@@ -191,7 +191,7 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const
break;
}
}
str = buffer;
str = std::move(buffer);
return TRUE;
}
BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt)
......
......@@ -2203,31 +2203,40 @@ bool LLAppViewer::initThreads()
return true;
}
void errorCallback(const std::string &error_string)
void errorCallback(const std::string& error_string)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK);
static std::string last_message;
if (last_message != error_string)
{
#ifdef SHOW_ASSERT
U32 response = OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_YESNO);
if (response == OSBTN_NO)
{
last_message = error_string;
return;
}
#endif
//Set the ErrorActivated global so we know to create a marker file
gLLErrorActivated = true;
//Set the ErrorActivated global so we know to create a marker file
gLLErrorActivated = true;
gDebugInfo["FatalMessage"] = error_string;
// We're not already crashing -- we simply *intend* to crash. Since we
// haven't actually trashed anything yet, we can afford to write the whole
// static info file.
LLAppViewer::instance()->writeDebugInfo();
gDebugInfo["FatalMessage"] = error_string;
// We're not already crashing -- we simply *intend* to crash. Since we
// haven't actually trashed anything yet, we can afford to write the whole
// static info file.
LLAppViewer::instance()->writeDebugInfo();
// [SL:KB] - Patch: Viewer-Build | Checked: Catznip-2.4
// [SL:KB] - Patch: Viewer-Build | Checked: Catznip-2.4
#if !LL_RELEASE_FOR_DOWNLOAD && LL_WINDOWS
DebugBreak();
DebugBreak();
#else
LLError::crashAndLoop(error_string);
LLError::crashAndLoop(error_string);
#endif // LL_RELEASE_WITH_DEBUG_INFO && LL_WINDOWS
// [/SL:KB]
//#ifndef SHADER_CRASH_NONFATAL
// LLError::crashAndLoop(error_string);
//#endif
// [/SL:KB]
//#ifndef SHADER_CRASH_NONFATAL
// LLError::crashAndLoop(error_string);
//#endif
}
}
void LLAppViewer::initLoggingAndGetLastDuration()
......@@ -4756,6 +4765,7 @@ void LLAppViewer::idle()
gGLActive = FALSE;
}
auto& worldInst = LLWorld::instance();
F32 yaw = 0.f; // radians
......@@ -4763,7 +4773,7 @@ void LLAppViewer::idle()
{
LL_RECORD_BLOCK_TIME(FTM_NETWORK);
// Update spaceserver timeinfo
LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw));
worldInst.setSpaceTimeUSec(worldInst.getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw));
//////////////////////////////////////
......@@ -4990,11 +5000,11 @@ void LLAppViewer::idle()
// Update surfaces, and surface textures as well.
//
LLWorld::getInstance()->updateVisibilities();
worldInst.updateVisibilities();
{
const F32 max_region_update_time = .001f; // 1ms
LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE);
LLWorld::getInstance()->updateRegions(max_region_update_time);
worldInst.updateRegions(max_region_update_time);
}
/////////////////////////
......@@ -5007,7 +5017,7 @@ void LLAppViewer::idle()
static LLVector3 average_wind;
LLViewerRegion *regionp;
regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position
regionp = worldInst.resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position
if (regionp)
{
gWindVec = regionp->mWind.getVelocity(wind_position_region);
......@@ -5032,7 +5042,7 @@ void LLAppViewer::idle()
LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE);
gPipeline.updateMove();
LLWorld::getInstance()->updateParticles();
worldInst.updateParticles();
if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera())
{
......
......@@ -918,6 +918,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box);
mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f));
#ifdef SHOW_DEBUG
LL_DEBUGS("DynamicBox") << avatarp->getFullname()
<< " pos (ignored) " << pos
<< " cam pos " << cam_pos
......@@ -925,6 +926,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
<< " box " << av_box[0] << "," << av_box[1]
<< " -> dist " << mDistanceWRTCamera
<< LL_ENDL;
#endif
mVObjp->updateLOD();
return;
}
......@@ -1557,10 +1559,8 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
mDrawable->updateDistance(camera, force_update);
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
for (LLViewerObject* child : child_list)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (!drawable)
{
......
......@@ -382,13 +382,13 @@ inline void Draw(LLDrawInfo* draw, U32 mask)
bool LLDrawPoolAlpha::TexSetup(LLDrawInfo* draw, bool use_shaders, bool use_material, LLGLSLShader* current_shader)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_TEX_BINDS);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_TEX_BINDS);
bool tex_setup = false;
if (deferred_render && use_material && current_shader)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_TEX_BINDS);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_TEX_BINDS);
if (draw->mNormalMap)
{
draw->mNormalMap->addTextureStats(draw->mVSize);
......@@ -518,7 +518,7 @@ void LLDrawPoolAlpha::renderMaterials(U32 mask, std::vector<LLDrawInfo*>& materi
if (current_shader != target_shader)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_SHADER_BINDS);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_SHADER_BINDS);
if (current_shader)
{
gPipeline.unbindDeferredShader(*current_shader);
......@@ -534,7 +534,7 @@ void LLDrawPoolAlpha::renderMaterials(U32 mask, std::vector<LLDrawInfo*>& materi
current_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, draw->mFullbright ? 1.f : 0.f);
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_TEX_BINDS);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_TEX_BINDS);
if (draw->mNormalMap)
{
draw->mNormalMap->addTextureStats(draw->mVSize);
......@@ -613,6 +613,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
BOOL use_shaders = gPipeline.canUseVertexShaders();
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_GROUP_LOOP);
for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(), i_end = gPipeline.endAlphaGroups(); i != i_end; ++i)
{
LLSpatialGroup* group = *i;
......@@ -631,7 +633,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
bool draw_glow_for_this_partition = mShaderLevel > 0; // no shaders = no glow.
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_GROUP_LOOP);
bool disable_cull = is_particle_or_hud_particle;
LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0);
......@@ -687,7 +689,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
// Turn off lighting if it hasn't already been so.
if (light_enabled || !initialized_lighting)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_LIGHT_SETUP);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_LIGHT_SETUP);
initialized_lighting = TRUE;
if (use_shaders)
......@@ -704,7 +706,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
// Turn on lighting if it isn't already.
else if (!light_enabled || !initialized_lighting)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_LIGHT_SETUP);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_LIGHT_SETUP);
initialized_lighting = TRUE;
if (use_shaders)
......@@ -732,7 +734,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
if (current_shader != target_shader)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_SHADER_BINDS);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_SHADER_BINDS);
gPipeline.bindDeferredShader(*target_shader);
current_shader = target_shader;
}
......@@ -749,7 +751,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
if(use_shaders && (current_shader != target_shader))
{// If we need shaders, and we're not ALREADY using the proper shader, then bind it
// (this way we won't rebind shaders unnecessarily).
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_SHADER_BINDS);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_SHADER_BINDS);
current_shader = target_shader;
current_shader->bind();
}
......@@ -786,7 +788,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
bool tex_setup = TexSetup(&params, use_shaders, use_shaders && (mat != nullptr), current_shader);
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_PUSH);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_PUSH);
LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
......@@ -794,7 +796,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
params.mVertexBuffer->setBuffer(mask & ~(params.mFullbright ? (LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2) : 0));
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DRAW);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DRAW);
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
}
......@@ -806,7 +808,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
(!is_particle_or_hud_particle || params.mHasGlow) &&
params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_EMISSIVE);
//LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_EMISSIVE);
if (batch_emissives)
{
......
......@@ -218,10 +218,8 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
{
std::vector<LLDrawable*> potentials;
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
for (LLViewerRegion* region : LLWorld::getInstance()->getRegionList())
{
LLViewerRegion* region = *iter;
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
LLSpatialPartition* part = region->getSpatialPartition(i);
......@@ -354,10 +352,12 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global,
// resolves correctly so we can get a height value.
const F32 FUDGE = 0.01f;
F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
auto& worldInst = LLWorld::instance();
F32 sw_bottom = worldInst.resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
F32 se_bottom = worldInst.resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
F32 ne_bottom = worldInst.resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
F32 nw_bottom = worldInst.resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
F32 sw_top = sw_bottom + PARCEL_POST_HEIGHT;
F32 se_top = se_bottom + PARCEL_POST_HEIGHT;
......
......@@ -620,6 +620,7 @@ void LLMaterialMgr::CapsRecvForRegion(const LLUUID& regionId, LLUUID regionTest,
void LLMaterialMgr::processGetQueue()
{
auto& worldInst = LLWorld::instance();
get_queue_t::iterator loopRegionQueue = mGetQueue.begin();
while (mGetQueue.end() != loopRegionQueue)
{
......@@ -635,7 +636,7 @@ void LLMaterialMgr::processGetQueue()
continue;
}
LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id);
LLViewerRegion* regionp = worldInst.getRegionFromID(region_id);
if (!regionp)
{
LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL;
......@@ -834,7 +835,8 @@ void LLMaterialMgr::processGetAllQueue()
void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
{
LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(regionId);
auto& worldInst = LLWorld::instance();
LLViewerRegion* regionp = worldInst.getRegionFromID(regionId);
if (regionp == NULL)
{
LL_WARNS("Materials") << "Unknown region with id " << regionId.asString() << LL_ENDL;
......@@ -852,7 +854,7 @@ void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
llcoro::suspendUntilEventOn(capsRecv);
// reget the region from the region ID since it may have gone away while waiting.
regionp = LLWorld::instance().getRegionFromID(regionId);
regionp = worldInst.getRegionFromID(regionId);
if (!regionp)
{
LL_WARNS("Materials") << "Region with ID " << regionId << " is no longer valid." << LL_ENDL;
......@@ -895,7 +897,7 @@ void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
}
// reget the region from the region ID since it may have gone away while waiting.
regionp = LLWorld::instance().getRegionFromID(regionId);
regionp = worldInst.getRegionFromID(regionId);
if (!regionp)
{
LL_WARNS("Materials") << "Region with ID " << regionId << " is no longer valid." << LL_ENDL;
......
......@@ -258,10 +258,12 @@ void LLNetMap::draw()
gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
}
auto& worldInst = LLWorld::instance();
// figure out where agent is
S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters());
S32 region_width = ll_round(worldInst.getRegionWidthInMeters());
for (LLViewerRegion* regionp : LLWorld::getInstance()->getRegionList())
for (LLViewerRegion* regionp : worldInst.getRegionList())
{
// Find x and y position relative to camera's center.
LLVector3 origin_agent = regionp->getOriginAgent();
......@@ -431,7 +433,7 @@ void LLNetMap::draw()
memset(texture_data, 0, mParcelImagep->getWidth() * mParcelImagep->getHeight() * mParcelImagep->getComponents());
// Process each region
for (LLViewerRegion* region : LLWorld::getInstance()->getRegionList())
for (LLViewerRegion* region : worldInst.getRegionList())
{
LLColor4 overlay_color = region->isAlive()
? map_parcel_line_color.get()
......@@ -483,7 +485,7 @@ void LLNetMap::draw()
LLWorld::pos_map_t positions;
bool unknown_relative_z;
LLWorld::getInstance()->getAvatars(&positions);
worldInst.getAvatars(&positions);
// Draw avatars
for (const auto& av_pos_pair : positions)
......@@ -588,7 +590,7 @@ void LLNetMap::draw()
}
// Draw frustum
F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
F32 meters_to_pixels = mScale/ worldInst.getRegionWidthInMeters();
F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
......
......@@ -483,10 +483,6 @@ void LLSceneMonitor::fetchQueryResult()
{
LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF);
// also throttle timing here, to avoid going below sample time due to phasing with frame capture
static LLCachedControl<F32> scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime");
F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control();
if(mDiffState == WAIT_ON_RESULT
&& !LLAppViewer::instance()->quitRequested())
{
......@@ -507,6 +503,10 @@ void LLSceneMonitor::fetchQueryResult()
static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingMonitorPixelDiffThreshold");
F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32();
// also throttle timing here, to avoid going below sample time due to phasing with frame capture
static LLCachedControl<F32> scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime");
F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control();
if (elapsed_time > scene_load_sample_time)
{
if(mDiffResult > diff_threshold())
......
......@@ -883,7 +883,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
}
setState(DEAD);
for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
for (element_iter i = getDataBegin(), i_end = getDataEnd(); i != i_end; ++i)
{
LLViewerOctreeEntry* entry = *i;
......@@ -940,7 +940,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)
}
for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)
for (LLSpatialGroup::element_iter i = getDataBegin(), i_end = getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -1298,7 +1298,7 @@ class LLOctreeSelect : public LLOctreeCull
LLSpatialGroup* group = (LLSpatialGroup*)base_group;
OctreeNode* branch = group->getOctreeNode();
for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
for (OctreeNode::const_element_iter i = branch->getDataBegin(), i_end = branch->getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -1439,7 +1439,7 @@ class LLOctreeDirty : public OctreeTraveler
LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);
group->destroyGL();
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
for (LLSpatialGroup::element_iter i = group->getDataBegin(), i_end = group->getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -1726,7 +1726,7 @@ void renderOctree(LLSpatialGroup* group)
gGL.flush();
glLineWidth(1.f);
gGL.flush();
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
for (LLSpatialGroup::element_iter i = group->getDataBegin(), i_end = group->getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -1869,7 +1869,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
bool selected = false;
for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
for (LLSpatialGroup::element_iter iter = group->getDataBegin(), iter_end = group->getDataEnd(); iter != iter_end; ++iter)
{
LLDrawable* drawable = *iter;
if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
......@@ -1913,7 +1913,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
bool selected = false;
for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
for (LLSpatialGroup::element_iter iter = group->getDataBegin(), iter_end = group->getDataEnd(); iter != iter_end; ++iter)
{
LLDrawable* drawable = *iter;
if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
......@@ -1942,7 +1942,7 @@ void renderXRay(LLSpatialGroup* group, LLCamera* camera)
bool selected = false;
for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
for (LLSpatialGroup::element_iter iter = group->getDataBegin(), iter_end = group->getDataEnd(); iter != iter_end; ++iter)
{
LLDrawable* drawable = (LLDrawable*)(*iter)->getDrawable();
if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
......@@ -2688,7 +2688,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
void renderPhysicsShapes(LLSpatialGroup* group)
{
for (OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
for (OctreeNode::const_element_iter i = group->getDataBegin(), i_end = group->getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -3096,8 +3096,8 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect
}
gGL.begin(LLRender::TRIANGLES);
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();
iter != branch->getDataEnd();
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin(), end = branch->getDataEnd();
iter != end;
++iter)
{
const LLVolumeTriangle* tri = *iter;
......@@ -3356,7 +3356,7 @@ class LLOctreeRenderNonOccluded : public OctreeTraveler
}
}
for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
for (OctreeNode::const_element_iter i = branch->getDataBegin(), i_end = branch->getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -3603,7 +3603,7 @@ class LLOctreePushBBoxVerts : public OctreeTraveler
return;
}
for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
for (OctreeNode::const_element_iter i = branch->getDataBegin(), i_end = branch->getDataEnd(); i != i_end; ++i)
{
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
if(!drawable)
......@@ -3853,7 +3853,7 @@ class LLOctreeIntersect : public LLOctreeTraveler<LLViewerOctreeEntry>
virtual void visit(const OctreeNode* branch)
{
for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
for (OctreeNode::const_element_iter i = branch->getDataBegin(), i_end = branch->getDataEnd(); i != i_end; ++i)
{
check(*i);
}
......
This diff is collapsed.
......@@ -1142,8 +1142,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
U32 retval = 0x0;
auto& worldInst = LLWorld::instance();
// If region is removed from the list it is also deleted.
if (!LLWorld::instance().isRegionListed(mRegionp))
if (!worldInst.isRegionListed(mRegionp))
{
LL_WARNS() << "Updating object in an invalid region" << LL_ENDL;
return retval;
......@@ -1155,7 +1157,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
if(mesgsys != NULL)
{
mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);