summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-08-06 09:21:19 -0400
committerGitHub <noreply@github.com>2024-08-06 16:21:19 +0300
commit75455d101c9535d0d45aa0f505f888f4ba3de64d (patch)
tree3fdef7aedddb1034d986eb5d017e048e4c5b950c
parentdb376f2ace28b199749796520966b6e9884985d6 (diff)
Convert LLUI and LLRender2D to LLSimpleton to reduce overhead during ui draw (#2202)
-rw-r--r--indra/llrender/llrender2dutils.cpp2
-rw-r--r--indra/llrender/llrender2dutils.h7
-rw-r--r--indra/llrender/lluiimage.cpp6
-rw-r--r--indra/llui/llfocusmgr.cpp4
-rw-r--r--indra/llui/llui.cpp7
-rw-r--r--indra/llui/llui.h10
-rw-r--r--indra/newview/llappviewer.cpp3
7 files changed, 23 insertions, 16 deletions
diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp
index 176c7a5d2c..428370057e 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -726,7 +726,7 @@ void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& c
}
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)
diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h
index 0d3efc38d6..096e7584f1 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -122,12 +122,13 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, bool
class LLImageProviderInterface;
-class LLRender2D : public LLParamSingleton<LLRender2D>
+class LLRender2D : public LLSimpleton<LLRender2D>
{
- LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider);
LOG_CLASS(LLRender2D);
- ~LLRender2D();
public:
+ LLRender2D(LLImageProviderInterface* image_provider);
+ ~LLRender2D();
+
static void pushMatrix();
static void popMatrix();
static void loadIdentity();
diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp
index d31a91e2af..dc18bf16bf 100644
--- a/indra/llrender/lluiimage.cpp
+++ b/indra/llrender/lluiimage.cpp
@@ -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 + ((F32)rect.mLeft * x_axis) + ((F32)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
(F32)rect.getWidth() * x_axis,
(F32)rect.getHeight() * y_axis);
- } LLRender2D::getInstance()->popMatrix();
+ } LLRender2D::popMatrix();
}
//#include "lluiimage.inl"
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 937dde4def..c635d24f51 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -183,7 +183,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
}
}
- LLUI::getInstance()->removePopup(view);
+ if(LLUI::instanceExists()) LLUI::getInstance()->removePopup(view);
}
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only)
@@ -481,7 +481,7 @@ void LLFocusMgr::setAppHasFocus(bool focus)
// release focus from "top ctrl"s, which generally hides them
if (!focus)
{
- LLUI::getInstance()->clearPopups();
+ if(LLUI::instanceExists()) LLUI::getInstance()->clearPopups();
}
mAppHasFocus = focus;
}
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index e3ddd66b58..8d46422c09 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -156,7 +156,7 @@ mWindow(NULL), // set later in startup
mRootView(NULL),
mHelpImpl(NULL)
{
- LLRender2D::initParamSingleton(image_provider);
+ LLRender2D::createInstance(image_provider);
if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) ||
(get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) ||
@@ -196,6 +196,11 @@ mHelpImpl(NULL)
LLCommandManager::load();
}
+LLUI::~LLUI()
+{
+ LLRender2D::deleteSingleton();
+}
+
void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups)
{
mAddPopupFunc = add_popup;
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index f33b43f599..375cd539b7 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -112,18 +112,18 @@ class LLImageProviderInterface;
typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
-class LLUI : public LLParamSingleton<LLUI>
+class LLUI : public LLSimpleton<LLUI>
{
+ LOG_CLASS(LLUI);
public:
typedef std::map<std::string, LLControlGroup*, std::less<> > settings_map_t;
-private:
- LLSINGLETON(LLUI , const settings_map_t &settings,
+ LLUI(const settings_map_t &settings,
LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback,
LLUIAudioCallback deferred_audio_callback);
- LOG_CLASS(LLUI);
-public:
+ ~LLUI();
+
//
// Classes
//
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f2023565fc..262ab439b4 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -802,7 +802,7 @@ bool LLAppViewer::init()
settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
settings_map["account"] = &gSavedPerAccountSettings;
- LLUI::initParamSingleton(settings_map,
+ LLUI::createInstance(settings_map,
LLUIImageList::getInstance(),
ui_audio_callback,
deferred_ui_audio_callback);
@@ -2155,6 +2155,7 @@ bool LLAppViewer::cleanup()
LLViewerEventRecorder::deleteSingleton();
LLWorld::deleteSingleton();
LLVoiceClient::deleteSingleton();
+ LLUI::deleteSingleton();
// It's not at first obvious where, in this long sequence, a generic cleanup
// call OUGHT to go. So let's say this: as we migrate cleanup from