From f14c5628b81367e1adec346559fb120cfaa8174d Mon Sep 17 00:00:00 2001 From: hybrid Date: Fri, 26 Mar 2010 17:49:08 +0000 Subject: [PATCH] Add some gpu memory info output where possible. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3259 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COpenGLExtensionHandler.cpp | 25 +++++++++++++++++++++ source/Irrlicht/COpenGLExtensionHandler.h | 5 ++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/source/Irrlicht/COpenGLExtensionHandler.cpp b/source/Irrlicht/COpenGLExtensionHandler.cpp index da83dfda..f3b5ab55 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.cpp +++ b/source/Irrlicht/COpenGLExtensionHandler.cpp @@ -626,6 +626,31 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) } MaxTextureUnits = core::min_(MaxTextureUnits,static_cast(MATERIAL_MAX_TEXTURES)); +#ifdef _DEBUG + if (FeatureAvailable[IRR_NVX_gpu_memory_info]) + { + // undocumented flags, so use the RAW values + GLint val; + glGetIntegerv(0x9047, &val); + os::Printer::log("Dedicated video memory (kB)", core::stringc(val)); + glGetIntegerv(0x9048, &val); + os::Printer::log("Total video memory (kB)", core::stringc(val)); + glGetIntegerv(0x9049, &val); + os::Printer::log("Available video memory (kB)", core::stringc(val)); + } +#ifdef GL_ATI_meminfo + if (FeatureAvailable[IRR_ATI_meminfo]) + { + GLint val[4]; + glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, val); + os::Printer::log("Free texture memory (kB)", core::stringc(val[0])); + glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, val); + os::Printer::log("Free VBO memory (kB)", core::stringc(val[0])); + glGetIntegerv(GL_RENDERBUFFER_FREE_MEMORY_ATI, val); + os::Printer::log("Free render buffer memory (kB)", core::stringc(val[0])); + } +#endif +#endif } bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h index b659b8d7..e14b7c91 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.h +++ b/source/Irrlicht/COpenGLExtensionHandler.h @@ -433,7 +433,9 @@ static const char* const OpenGLFeatureStrings[] = { "GL_SUN_vertex", "GL_SUNX_constant_data", "GL_WIN_phong_shading", - "GL_WIN_specular_fog" + "GL_WIN_specular_fog", + // unofficial stuff + "GL_NVX_gpu_memory_info" }; @@ -800,6 +802,7 @@ class COpenGLExtensionHandler IRR_SUNX_constant_data, IRR_WIN_phong_shading, IRR_WIN_specular_fog, + IRR_NVX_gpu_memory_info, IRR_OpenGL_Feature_Count };