Changed: Support for GLX_MESA_query_renderer to detect video memory
--HG-- branch : develop
This commit is contained in:
parent
57859636cd
commit
ba7c4ae4d4
3 changed files with 37 additions and 0 deletions
|
@ -1293,6 +1293,17 @@ sint CDriverGL::getTotalVideoMemory() const
|
||||||
{
|
{
|
||||||
nlerror("3D: Unable to get current renderer ID (%s)", CGLErrorString(error));
|
nlerror("3D: Unable to get current renderer ID (%s)", CGLErrorString(error));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (_Extensions.GLXMESAQueryRenderer)
|
||||||
|
{
|
||||||
|
uint32 memoryInMiB = 0;
|
||||||
|
|
||||||
|
if (nglXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &memoryInMiB))
|
||||||
|
{
|
||||||
|
nlinfo("3D: GLX_RENDERER_VIDEO_MEMORY_MESA returned %u MiB", memoryInMiB);
|
||||||
|
return memoryInMiB * 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -541,6 +541,9 @@ PFNGLXSWAPINTERVALSGIPROC nglXSwapIntervalSGI;
|
||||||
PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
|
PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
|
||||||
PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
|
PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
|
||||||
|
|
||||||
|
// GLX_MESA_query_renderer
|
||||||
|
// =======================
|
||||||
|
PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC nglXQueryCurrentRendererIntegerMESA;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // USE_OPENGLES
|
#endif // USE_OPENGLES
|
||||||
|
@ -1888,6 +1891,19 @@ static bool setupGLXMESASwapControl(const char *glext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *********************************
|
||||||
|
static bool setupGLXMESAQueryRenderer(const char *glext)
|
||||||
|
{
|
||||||
|
H_AUTO_OGL(setupGLXMESAQueryRenderer);
|
||||||
|
CHECK_EXT("GLX_MESA_query_renderer");
|
||||||
|
|
||||||
|
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||||
|
CHECK_ADDRESS(PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC, glXQueryCurrentRendererIntegerMESA);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy)
|
bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy)
|
||||||
|
@ -2030,6 +2046,9 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen)
|
||||||
ext.GLXSGISwapControl= setupGLXSGISwapControl(glext);
|
ext.GLXSGISwapControl= setupGLXSGISwapControl(glext);
|
||||||
ext.GLXMESASwapControl= setupGLXMESASwapControl(glext);
|
ext.GLXMESASwapControl= setupGLXMESASwapControl(glext);
|
||||||
|
|
||||||
|
// check for renderer information
|
||||||
|
ext.GLXMESAQueryRenderer= setupGLXMESAQueryRenderer(glext);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // USE_OPENGLES
|
#endif // USE_OPENGLES
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct CGlExtensions
|
||||||
bool GLXEXTSwapControl;
|
bool GLXEXTSwapControl;
|
||||||
bool GLXSGISwapControl;
|
bool GLXSGISwapControl;
|
||||||
bool GLXMESASwapControl;
|
bool GLXMESASwapControl;
|
||||||
|
bool GLXMESAQueryRenderer;
|
||||||
|
|
||||||
// ATI Extensions.
|
// ATI Extensions.
|
||||||
bool ATIVertexArrayObject;
|
bool ATIVertexArrayObject;
|
||||||
|
@ -164,6 +165,7 @@ public:
|
||||||
GLXEXTSwapControl= false;
|
GLXEXTSwapControl= false;
|
||||||
GLXSGISwapControl= false;
|
GLXSGISwapControl= false;
|
||||||
GLXMESASwapControl= false;
|
GLXMESASwapControl= false;
|
||||||
|
GLXMESAQueryRenderer= false;
|
||||||
EXTBlendColor= false;
|
EXTBlendColor= false;
|
||||||
ATIVertexArrayObject= false;
|
ATIVertexArrayObject= false;
|
||||||
ATIEnvMapBumpMap = false;
|
ATIEnvMapBumpMap = false;
|
||||||
|
@ -264,6 +266,7 @@ public:
|
||||||
result += GLXEXTSwapControl ? "GLXEXTSwapControl " : "";
|
result += GLXEXTSwapControl ? "GLXEXTSwapControl " : "";
|
||||||
result += GLXSGISwapControl ? "GLXSGISwapControl " : "";
|
result += GLXSGISwapControl ? "GLXSGISwapControl " : "";
|
||||||
result += GLXMESASwapControl ? "GLXMESASwapControl " : "";
|
result += GLXMESASwapControl ? "GLXMESASwapControl " : "";
|
||||||
|
result += GLXMESAQueryRenderer ? "GLXMESAQueryRenderer " : "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result += "\n Array/VBO: ";
|
result += "\n Array/VBO: ";
|
||||||
|
@ -816,6 +819,10 @@ extern PFNGLXSWAPINTERVALSGIPROC nglXSwapIntervalSGI;
|
||||||
extern PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
|
extern PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
|
||||||
extern PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
|
extern PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
|
||||||
|
|
||||||
|
// GLX_MESA_query_renderer
|
||||||
|
// =======================
|
||||||
|
extern PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC nglXQueryCurrentRendererIntegerMESA;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GL_EXT_framebuffer_object
|
// GL_EXT_framebuffer_object
|
||||||
|
|
Loading…
Reference in a new issue