From 05e2bb7ed70a24e14cf83529f2937ce6c3c4e437 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Wed, 14 Jul 2021 23:00:47 -0400 Subject: [PATCH] Tweaks to fps display --- indra/newview/llstatusbar.cpp | 23 ++----------------- indra/newview/skins/default/colors.xml | 3 +++ .../skins/default/xui/en/panel_status_bar.xml | 5 +++- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 477bf5d8693..ce465aff76a 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -150,25 +150,6 @@ LLStatusBar::~LLStatusBar() // Overrides //----------------------------------------------------------------------- -static int32_t fastFloor(const float* in, const ptrdiff_t length = 1) -{ - int32_t* out; - #define ALIGNMENT alignof(max_align_t) - static_assert(sizeof(float) == sizeof(int32_t), ""); - assert((uintptr_t)(void*)in % ALIGNMENT == 0); - assert((uintptr_t)(void*)out % ALIGNMENT == 0); - assert((size_t)length % (ALIGNMENT/sizeof(int32_t)) == 0); - - alignas(ALIGNMENT) const float* const input = in; - alignas(ALIGNMENT) int32_t* const output = out; - - // Do the conversion - for (int i = 0; i < length; ++i) { - output[i] = static_cast<int32_t>(std::floor(input[i])); - } - return *out; -} - // virtual void LLStatusBar::draw() { @@ -393,8 +374,8 @@ void LLStatusBar::refresh() if (show_fps && mFPSUpdateTimer->getElapsedTimeF32() > 0.125f) { mFPSUpdateTimer->reset(); - auto fps = (float)LLTrace::get_frame_recording().getPeriodMean(LLStatViewer::FPS); - mTextFPS->setText(fmt::format(FMT_STRING("{:d}"), fastFloor(&fps))); + F32 fps = (F32)LLTrace::get_frame_recording().getLastRecording().getMean(LLStatViewer::FPS_SAMPLE); + mTextFPS->setText(fmt::format(FMT_STRING("{:d}"), llfloor(fps))); } } diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index fc93f260246..e58efde8ccb 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -1000,4 +1000,7 @@ <color name="AddPaymentPanel" value="0.27 0.27 0.27 1" /> + <color + name="FPSTextColor" + reference="EmphasisColor" /> </colors> diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 59004539171..25f1bc24ae2 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -220,10 +220,13 @@ name="fps_bg"> <text type="string" + font="SansSerifLarge" + text_color="FPSTextColor" follows="right|top" halign="center" height="16" - top="3" + top="1" + v_pad="-1" left="0" name="FPSText" tool_tip="Current FPS" -- GitLab