Detect and check GLX version/extensions.
svn path=/branches/work/kwin_composite/; revision=604805
This commit is contained in:
parent
e86e1cf88f
commit
1be2c4ed32
3 changed files with 11 additions and 5 deletions
12
glutils.cpp
12
glutils.cpp
|
@ -17,11 +17,11 @@ namespace KWinInternal
|
|||
{
|
||||
// Variables
|
||||
// GL version, use MAKE_OPENGL_VERSION() macro for comparing with a specific version
|
||||
int glVersion;
|
||||
static int glVersion;
|
||||
// GLX version, use MAKE_GLX_VERSION() macro for comparing with a specific version
|
||||
int glXVersion;
|
||||
// List of all supported GL extensions
|
||||
QStringList glExtensions;
|
||||
static int glXVersion;
|
||||
// List of all supported GL and GLX extensions
|
||||
static QStringList glExtensions;
|
||||
int glTextureUnitsCount;
|
||||
|
||||
// Function pointers
|
||||
|
@ -58,6 +58,9 @@ void initGLX()
|
|||
int major, minor;
|
||||
glXQueryVersion( display(), &major, &minor );
|
||||
glXVersion = MAKE_GLX_VERSION( major, minor, 0 );
|
||||
// Get list of supported GLX extensions. Simply add it to the list of OpenGL extensions.
|
||||
glExtensions += QString((const char*)glXQueryExtensionsString(
|
||||
display(), DefaultScreen( display()))).split(" ");
|
||||
}
|
||||
|
||||
void initGL()
|
||||
|
@ -94,5 +97,4 @@ bool hasGLExtension(const QString& extension)
|
|||
return glExtensions.contains(extension);
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -44,6 +44,7 @@ extern int glTextureUnitsCount;
|
|||
|
||||
bool hasGLVersion(int major, int minor, int release = 0);
|
||||
bool hasGLXVersion(int major, int minor, int release = 0);
|
||||
// use for both OpenGL and GLX extensions
|
||||
bool hasGLExtension(const QString& extension);
|
||||
|
||||
|
||||
|
|
|
@ -149,6 +149,9 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
|
|||
if( !glXQueryExtension( display(), &dummy, &dummy ))
|
||||
return;
|
||||
initGLX();
|
||||
// check for FBConfig support
|
||||
if( !hasGLXVersion( 1, 3 ) && !hasGLExtension( "GLX_SGIX_fbconfig" ))
|
||||
return;
|
||||
tfp_mode = ( glXBindTexImageEXT != NULL && glXReleaseTexImageEXT != NULL );
|
||||
// use copy buffer hack from glcompmgr (called COPY_BUFFER there) - nvidia drivers older than
|
||||
// 1.0-9xxx don't update pixmaps properly, so do a copy first
|
||||
|
|
Loading…
Reference in a new issue