Revised VRAM override for cross-platform

relocated for x-platform (tested on Win and Linux, Mac TBC)
master
Beq 2024-06-18 01:11:28 +01:00
parent c882518f26
commit 174b934a13
6 changed files with 26 additions and 15 deletions

View File

@ -1014,6 +1014,7 @@ LLGLManager::LLGLManager() :
mGLSLVersionMajor(0),
mGLSLVersionMinor(0),
mVRAM(0),
mVRAMDetected(0), // <FS:Beq/> add override support
mGLMaxVertexRange(0),
mGLMaxIndexRange(0)
{

View File

@ -133,7 +133,7 @@ public:
std::string mGLVersionString;
S32 mVRAM; // VRAM in MB
S32 mVRAMDetected; // <FS:Beq/> The amount detected/reported by the OS/Drivers. If different to mVRAM there is an override in place.
void getPixelFormat(); // Get the best pixel format
std::string getGLInfoString();

View File

@ -1131,6 +1131,12 @@ bool LLAppViewer::init()
gGLActive = TRUE;
initWindow();
LL_INFOS("InitInfo") << "Window is initialized." << LL_ENDL ;
// <FS:Beq> allow detected hardware to be overridden.
gGLManager.mVRAMDetected = gGLManager.mVRAM;
LL_INFOS("AppInit") << "VRAM detected: " << gGLManager.mVRAMDetected << LL_ENDL;
overrideDetectedHardware();
// </FS:Beq>
// writeSystemInfo can be called after window is initialized (gViewerWindow non-null)
writeSystemInfo();
@ -1491,6 +1497,20 @@ bool LLAppViewer::init()
return true;
}
// <FS:Beq> allow detected hardware to be overridden.
void LLAppViewer::overrideDetectedHardware()
{
// Override the VRAM Detection if FSOverrideVRAMDetection is set.
if ( gSavedSettings.getBOOL("FSOverrideVRAMDetection") )
{
S32 forced_video_memory = gSavedSettings.getS32("FSForcedVideoMemory");
// Note: 0 is allowed here, some systems detect VRAM as zero so override should support emulating them.
LL_INFOS("AppInit") << "Overriding VRAM to " << forced_video_memory*1024 << " MB" << LL_ENDL;
gGLManager.mVRAM = forced_video_memory*1024;
}
}
// </FS:Beq>
void LLAppViewer::initMaxHeapSize()
{
//set the max heap size.
@ -3937,7 +3957,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["GRAPHICS_CARD_VENDOR"] = ll_safe_string((const char*)(glGetString(GL_VENDOR)));
info["GRAPHICS_CARD"] = ll_safe_string((const char*)(glGetString(GL_RENDERER)));
info["GRAPHICS_CARD_MEMORY"] = gGLManager.mVRAM;
info["GRAPHICS_CARD_MEMORY_DETECTED"] = gGLManager.mVRAMDetected; // <FS:Beq/> allow detected hardware to be overridden.
#if LL_WINDOWS
std::string drvinfo;

View File

@ -244,6 +244,7 @@ protected:
virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system
virtual void initConsole() {}; // Initialize OS level debugging console.
virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit.
virtual void overrideDetectedHardware(); // <FS:Beq/> Override VRAM (and others in future?) consistently.
virtual bool initSLURLHandler();
virtual bool sendURLToOtherInstance(const std::string& url);

View File

@ -1027,22 +1027,10 @@ bool LLAppViewerWin32::initHardwareTest()
if (gGLManager.mVRAM == 0)
{
// <FS:Beq> Allow the user to override the VRAM detection
if ( gSavedSettings.getBOOL("FSOverrideVRAMDetection") )
{
S32 forced_video_memory = gSavedSettings.getS32("FSForcedVideoMemory");
if ( forced_video_memory > 0 )
{
LL_INFOS("AppInit") << "Forcing VRAM to " << forced_video_memory*1024 << " MB" << LL_ENDL;
gGLManager.mVRAM = forced_video_memory*1024;
}
}
else
// </FS:Beq>
gGLManager.mVRAM = gDXHardware.getVRAM();
}
LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;
// LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL; // <FS:Beq/> move this into common code
return true;
}

View File

@ -56,6 +56,7 @@ OS Version: [OS_VERSION]
Graphics Card Vendor: [GRAPHICS_CARD_VENDOR]
Graphics Card: [GRAPHICS_CARD]
Graphics Card Memory: [GRAPHICS_CARD_MEMORY] MB
Graphics Card Memory (Detected): [GRAPHICS_CARD_MEMORY_DETECTED] MB
</string>
<string name="AboutDriver">Windows Graphics Driver Version: [GRAPHICS_DRIVER_VERSION]</string>
<string name="AboutOGL">OpenGL Version: [OPENGL_VERSION]</string>