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
|
// Variables
|
||||||
// GL version, use MAKE_OPENGL_VERSION() macro for comparing with a specific version
|
// 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
|
// GLX version, use MAKE_GLX_VERSION() macro for comparing with a specific version
|
||||||
int glXVersion;
|
static int glXVersion;
|
||||||
// List of all supported GL extensions
|
// List of all supported GL and GLX extensions
|
||||||
QStringList glExtensions;
|
static QStringList glExtensions;
|
||||||
int glTextureUnitsCount;
|
int glTextureUnitsCount;
|
||||||
|
|
||||||
// Function pointers
|
// Function pointers
|
||||||
|
@ -58,6 +58,9 @@ void initGLX()
|
||||||
int major, minor;
|
int major, minor;
|
||||||
glXQueryVersion( display(), &major, &minor );
|
glXQueryVersion( display(), &major, &minor );
|
||||||
glXVersion = MAKE_GLX_VERSION( major, minor, 0 );
|
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()
|
void initGL()
|
||||||
|
@ -94,5 +97,4 @@ bool hasGLExtension(const QString& extension)
|
||||||
return glExtensions.contains(extension);
|
return glExtensions.contains(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -44,6 +44,7 @@ extern int glTextureUnitsCount;
|
||||||
|
|
||||||
bool hasGLVersion(int major, int minor, int release = 0);
|
bool hasGLVersion(int major, int minor, int release = 0);
|
||||||
bool hasGLXVersion(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);
|
bool hasGLExtension(const QString& extension);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,9 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
|
||||||
if( !glXQueryExtension( display(), &dummy, &dummy ))
|
if( !glXQueryExtension( display(), &dummy, &dummy ))
|
||||||
return;
|
return;
|
||||||
initGLX();
|
initGLX();
|
||||||
|
// check for FBConfig support
|
||||||
|
if( !hasGLXVersion( 1, 3 ) && !hasGLExtension( "GLX_SGIX_fbconfig" ))
|
||||||
|
return;
|
||||||
tfp_mode = ( glXBindTexImageEXT != NULL && glXReleaseTexImageEXT != NULL );
|
tfp_mode = ( glXBindTexImageEXT != NULL && glXReleaseTexImageEXT != NULL );
|
||||||
// use copy buffer hack from glcompmgr (called COPY_BUFFER there) - nvidia drivers older than
|
// 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
|
// 1.0-9xxx don't update pixmaps properly, so do a copy first
|
||||||
|
|
Loading…
Reference in a new issue