Apply some VRAM detection changes from DeltaFPS

master
Ansariel 2024-09-05 18:47:36 +02:00
parent 74b53143a2
commit a2f5183d6f
1 changed files with 27 additions and 1 deletions

View File

@ -1188,7 +1188,7 @@ bool LLGLManager::initGL()
// U32 old_vram = mVRAM;
// mVRAM = 0;
#if LL_WINDOWS
#if 0 //LL_WINDOWS <FS:Ansariel> Special handling down below
if (mHasAMDAssociations)
{
GLuint gl_gpus_count = wglGetGPUIDsAMD(0, 0);
@ -1249,6 +1249,32 @@ bool LLGLManager::initGL()
LL_INFOS("RenderInit") << "VRAM Detected (NVXMemInfo):" << mVRAM << LL_ENDL;
}
if (mHasAMDAssociations && mVRAM == 0)
{
GLuint gl_gpus_count = wglGetGPUIDsAMD(0, 0);
if (gl_gpus_count > 0)
{
GLuint* ids = new GLuint[gl_gpus_count];
wglGetGPUIDsAMD(gl_gpus_count, ids);
GLuint mem_mb = 0;
for (U32 i = 0; i < gl_gpus_count; i++)
{
wglGetGPUInfoAMD(ids[i],
WGL_GPU_RAM_AMD,
GL_UNSIGNED_INT,
sizeof(GLuint),
&mem_mb);
if (mVRAM < mem_mb)
{
// basically pick the best AMD and trust driver/OS to know to switch
mVRAM = mem_mb;
}
}
}
LL_INFOS("RenderInit") << "VRAM Detected (AMDAssociations):" << mVRAM << LL_ENDL;
}
if (mHasATIMemInfo && mVRAM == 0)
{ //ask the gl how much vram is free at startup and attempt to use no more than half of that
S32 meminfo[4];