master
Ansariel 2022-06-30 18:59:34 +02:00
commit e8f4153fc2
6 changed files with 28 additions and 5 deletions

View File

@ -126,7 +126,8 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
mSwapMethod(SWAP_METHOD_UNDEFINED),
mHideCursorPermanent(FALSE),
mFlags(flags),
mHighSurrogate(0)
mHighSurrogate(0),
mRefreshRate(0)
{
}

View File

@ -197,6 +197,8 @@ public:
// windows only DirectInput8 for joysticks
virtual void* getDirectInput8() { return NULL; };
virtual bool getInputDevices(U32 device_type_filter, void * devices_callback, void* userdata) { return false; };
virtual S32 getRefreshRate() { return mRefreshRate; }
protected:
LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags);
virtual ~LLWindow();
@ -230,6 +232,7 @@ protected:
U16 mHighSurrogate;
S32 mMinWindowWidth;
S32 mMinWindowHeight;
S32 mRefreshRate;
// Handle a UTF-16 encoding unit received from keyboard.
// Converting the series of UTF-16 encoding units to UTF-32 data,

View File

@ -670,6 +670,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
}
}
mRefreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(mDisplay));
// Disable vertical sync for swap
toggleVSync(enable_vsync);

View File

@ -585,7 +585,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
{
current_refresh = 60;
}
mRefreshRate = current_refresh;
//-----------------------------------------------------------------------
// Drop resolution and go fullscreen
// use a display mode with our desired size and depth, with a refresh
@ -1064,6 +1064,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO
{
current_refresh = 60;
}
mRefreshRate = current_refresh;
gGLManager.shutdownGL();
//destroy gl context

View File

@ -43,6 +43,7 @@
#include "lltextbox.h"
#include "lltrans.h"
#include "llviewerobjectlist.h"
#include "llviewerwindow.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llworld.h"
@ -162,11 +163,9 @@ void LLFloaterPerformance::showSelectedPanel(LLPanel* selected_panel)
void LLFloaterPerformance::draw()
{
const S32 NUM_PERIODS = 50;
if (mUpdateTimer->hasExpired())
{
getChild<LLTextBox>("fps_value")->setValue((S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS)));
setFPSText();
if (mHUDsPanel->getVisible())
{
populateHUDList();
@ -409,6 +408,22 @@ void LLFloaterPerformance::populateNearbyList()
mNearbyList->selectByID(prev_selected_id);
}
void LLFloaterPerformance::setFPSText()
{
const S32 NUM_PERIODS = 50;
S32 current_fps = (S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS));
getChild<LLTextBox>("fps_value")->setValue(current_fps);
std::string fps_text = getString("fps_text");
static LLCachedControl<bool> vsync_enabled(gSavedSettings, "RenderVSyncEnable", true);
S32 refresh_rate = gViewerWindow->getWindow()->getRefreshRate();
if (vsync_enabled && (refresh_rate > 0) && (current_fps >= refresh_rate))
{
fps_text += getString("max_text");
}
getChild<LLTextBox>("fps_lbl")->setValue(fps_text);
}
void LLFloaterPerformance::detachItem(const LLUUID& item_id)
{
LLAppearanceMgr::instance().removeItemFromAvatar(item_id);

View File

@ -57,6 +57,7 @@ private:
void populateHUDList();
void populateObjectList();
void populateNearbyList();
void setFPSText();
void onClickAdvanced();
void onChangeQuality(const LLSD& data);