Viewer#779 Make RenderMaxVRAMBudget more consistent
parent
17b5bc9403
commit
a2971d84d5
|
|
@ -431,7 +431,7 @@ LLWindow* LLWindowManager::createWindow(
|
|||
#elif LL_DARWIN
|
||||
new_window = new LLWindowMacOSX(callbacks,
|
||||
title, name, x, y, width, height, flags,
|
||||
fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
|
||||
fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, max_vram);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ public:
|
|||
|
||||
// query VRAM usage
|
||||
virtual U32 getAvailableVRAMMegabytes() = 0;
|
||||
virtual void setMaxVRAMMegabytes(U32 max_vram) = 0;
|
||||
|
||||
virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode)
|
||||
virtual void afterDialog() {}; // undo whatever was done in beforeDialog()
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public:
|
|||
/*virtual*/ void setNativeAspectRatio(F32 ratio) override {}
|
||||
|
||||
U32 getAvailableVRAMMegabytes() override { return 4096; }
|
||||
void setMaxVRAMMegabytes(U32 max_vram) override {}
|
||||
|
||||
/*virtual*/ void *getPlatformWindow() override { return 0; }
|
||||
/*virtual*/ void bringToFront() override {}
|
||||
|
|
|
|||
|
|
@ -115,8 +115,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||
BOOL fullscreen, BOOL clearBg,
|
||||
BOOL enable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth,
|
||||
U32 fsaa_samples)
|
||||
U32 fsaa_samples,
|
||||
U32 max_vram)
|
||||
: LLWindow(NULL, fullscreen, flags)
|
||||
, mMaxVRAM(max_vram)
|
||||
{
|
||||
// *HACK: During window construction we get lots of OS events for window
|
||||
// reshape, activate, etc. that the viewer isn't ready to handle.
|
||||
|
|
@ -1260,7 +1262,12 @@ U32 LLWindowMacOSX::getAvailableVRAMMegabytes() {
|
|||
static const U32 mb = 1024*1024;
|
||||
// We're asked for total available gpu memory, but we only have allocation info on texture usage. So estimate by doubling that.
|
||||
static const U32 total_factor = 2; // estimated total/textures
|
||||
return gGLManager.mVRAM - (LLImageGL::getTextureBytesAllocated() * total_factor/mb);
|
||||
U32 total_vram = gGLManager.mVRAM;
|
||||
if (mMaxVRAM)
|
||||
{
|
||||
total_vram = llmin(mMaxVRAM, total_vram);
|
||||
}
|
||||
return total_vram - (LLImageGL::getTextureBytesAllocated() * total_factor/mb);
|
||||
}
|
||||
|
||||
//static SInt32 oldWindowLevel;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public:
|
|||
|
||||
// query VRAM usage
|
||||
/*virtual*/ U32 getAvailableVRAMMegabytes() override;
|
||||
virtual void setMaxVRAMMegabytes(U32 max_vram) override { mMaxVRAM = max_vram; }
|
||||
|
||||
void beforeDialog() override;
|
||||
void afterDialog() override;
|
||||
|
|
@ -150,7 +151,8 @@ protected:
|
|||
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg, BOOL enable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth,
|
||||
U32 fsaa_samples);
|
||||
U32 fsaa_samples,
|
||||
U32 max_vram);
|
||||
~LLWindowMacOSX();
|
||||
|
||||
void initCursors();
|
||||
|
|
@ -224,6 +226,7 @@ protected:
|
|||
BOOL mMinimized;
|
||||
U32 mFSAASamples;
|
||||
BOOL mForceRebuild;
|
||||
U32 mMaxVRAM;
|
||||
|
||||
S32 mDragOverrideCursor;
|
||||
|
||||
|
|
|
|||
|
|
@ -4586,6 +4586,14 @@ U32 LLWindowWin32::getAvailableVRAMMegabytes()
|
|||
return mWindowThread ? mWindowThread->getAvailableVRAMMegabytes() : 0;
|
||||
}
|
||||
|
||||
void LLWindowWin32::setMaxVRAMMegabytes(U32 max_vram)
|
||||
{
|
||||
if (mWindowThread)
|
||||
{
|
||||
mWindowThread->mMaxVRAM = max_vram;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
inline LLWindowWin32::LLWindowWin32Thread::LLWindowWin32Thread()
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ public:
|
|||
/*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
|
||||
|
||||
U32 getAvailableVRAMMegabytes() override;
|
||||
/*virtual*/ void setMaxVRAMMegabytes(U32 max_vram) override;
|
||||
|
||||
/*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b );
|
||||
|
||||
|
|
|
|||
|
|
@ -9376,7 +9376,7 @@
|
|||
<key>RenderMaxVRAMBudget</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Maximum amount of texture memory to budget for (in MB), or 0 for autodetect. Requires restart.</string>
|
||||
<string>Maximum amount of texture memory to budget for (in MB), or 0 for autodetect.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
|
|||
|
|
@ -1864,8 +1864,16 @@ LLViewerWindow::LLViewerWindow(const Params& p)
|
|||
// create window
|
||||
|
||||
U32 max_core_count = gSavedSettings.getU32("EmulateCoreCount");
|
||||
U32 max_vram = gSavedSettings.getU32("RenderMaxVRAMBudget");
|
||||
F32 max_gl_version = gSavedSettings.getF32("RenderMaxOpenGLVersion");
|
||||
|
||||
LLControlVariable* vram_control = gSavedSettings.getControl("RenderMaxVRAMBudget");
|
||||
U32 max_vram = vram_control->getValue().asInteger();
|
||||
mMaxVRAMControlConnection = vram_control->getSignal()->connect(
|
||||
[this](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val)
|
||||
{
|
||||
if (mWindow) mWindow->setMaxVRAMMegabytes(new_val.asInteger());
|
||||
});
|
||||
|
||||
|
||||
mWindow = LLWindowManager::createWindow(this,
|
||||
p.title, p.name, p.x, p.y, p.width, p.height, 0,
|
||||
|
|
@ -2421,6 +2429,8 @@ LLViewerWindow::~LLViewerWindow()
|
|||
LLViewerShaderMgr::releaseInstance();
|
||||
LLViewerShaderMgr::sInitialized = FALSE;
|
||||
}
|
||||
|
||||
mMaxVRAMControlConnection.disconnect();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -545,6 +545,8 @@ private:
|
|||
// Object temporarily hovered over while dragging
|
||||
LLPointer<LLViewerObject> mDragHoveredObject;
|
||||
|
||||
boost::signals2::connection mMaxVRAMControlConnection;
|
||||
|
||||
static LLTrace::SampleStatHandle<> sMouseVelocityStat;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue