1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0028466: Visualization, OpenGl_Context - read GPU memory using WGL_AMD_gpu_association extension

This commit is contained in:
kgv
2017-02-17 00:24:17 +03:00
committed by bugmaster
parent e525fd6ad2
commit 2eacd0b872
2 changed files with 43 additions and 0 deletions

View File

@@ -1350,6 +1350,12 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
FindProcShort (wglDXLockObjectsNV);
FindProcShort (wglDXUnlockObjectsNV);
}
if (CheckExtension (aWglExts, "WGL_AMD_gpu_association"))
{
FindProcShort (wglGetGPUIDsAMD);
FindProcShort (wglGetGPUInfoAMD);
FindProcShort (wglGetContextGPUIDAMD);
}
}
#elif defined(__APPLE__)
//
@@ -2560,6 +2566,21 @@ void OpenGl_Context::MemoryInfo (TColStd_IndexedDataMapOfStringString& theDict)
addInfo (theDict, "Total memory", TCollection_AsciiString() + (aValue / 1024) + " MiB");
}
}
#if defined(_WIN32)
else if (myFuncs->wglGetGPUInfoAMD != NULL
&& myFuncs->wglGetContextGPUIDAMD != NULL)
{
GLuint aTotalMemMiB = 0;
UINT anAmdId = myFuncs->wglGetContextGPUIDAMD ((HGLRC )myGContext);
if (anAmdId != 0)
{
if (myFuncs->wglGetGPUInfoAMD (anAmdId, WGL_GPU_RAM_AMD, GL_UNSIGNED_INT, sizeof(aTotalMemMiB), &aTotalMemMiB) > 0)
{
addInfo (theDict, "GPU memory", TCollection_AsciiString() + (int )aTotalMemMiB + " MiB");
}
}
}
#endif
#endif
#if !defined(GL_ES_VERSION_2_0) && !defined(__APPLE__) && !defined(_WIN32)