Add memory total for NVIDIA cards in the logs (#4315)

* Add memory total for NVIDIA cards in the logs

* define the GL request ID
This commit is contained in:
David CARLIER 2020-06-20 19:44:13 +01:00 committed by GitHub
parent 0b66f84755
commit 485a346198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -33,6 +33,7 @@ void CentralVideoSettings::init()
{ {
m_gl_major_version = 2; m_gl_major_version = 2;
m_gl_minor_version = 1; m_gl_minor_version = 1;
m_gl_mem = 0;
// Parse extensions // Parse extensions
hasBufferStorage = false; hasBufferStorage = false;
@ -64,10 +65,19 @@ void CentralVideoSettings::init()
{ {
glGetIntegerv(GL_MAJOR_VERSION, &m_gl_major_version); glGetIntegerv(GL_MAJOR_VERSION, &m_gl_major_version);
glGetIntegerv(GL_MINOR_VERSION, &m_gl_minor_version); glGetIntegerv(GL_MINOR_VERSION, &m_gl_minor_version);
const char *vendor = (const char *)glGetString(GL_VENDOR);
const char *renderer = (const char *)glGetString(GL_RENDERER);
const char *version = (const char *)glGetString(GL_VERSION);
Log::info("IrrDriver", "OpenGL version: %d.%d", m_gl_major_version, m_gl_minor_version); Log::info("IrrDriver", "OpenGL version: %d.%d", m_gl_major_version, m_gl_minor_version);
Log::info("IrrDriver", "OpenGL vendor: %s", glGetString(GL_VENDOR)); Log::info("IrrDriver", "OpenGL vendor: %s", vendor);
Log::info("IrrDriver", "OpenGL renderer: %s", glGetString(GL_RENDERER)); Log::info("IrrDriver", "OpenGL renderer: %s", renderer);
Log::info("IrrDriver", "OpenGL version string: %s", glGetString(GL_VERSION)); Log::info("IrrDriver", "OpenGL version string: %s", version);
if (strstr(vendor, "NVIDIA"))
glGetIntegerv(GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX, &m_gl_mem);
if (m_gl_mem > 0)
Log::info("IrrDriver", "OpenGL total memory: %d", m_gl_mem/1024);
} }
#if !defined(USE_GLES2) #if !defined(USE_GLES2)
m_glsl = (m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 1)) m_glsl = (m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 1))

View File

@ -26,7 +26,7 @@ private:
/** Supports GLSL */ /** Supports GLSL */
bool m_glsl; bool m_glsl;
int m_gl_major_version, m_gl_minor_version; int m_gl_major_version, m_gl_minor_version, m_gl_mem;
bool hasBufferStorage; bool hasBufferStorage;
bool hasComputeShaders; bool hasComputeShaders;
bool hasArraysOfArrays; bool hasArraysOfArrays;

View File

@ -91,5 +91,9 @@ extern "C" {
#endif // server only #endif // server only
#ifndef GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX
#define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX 0x9048
#endif
#endif #endif