summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/glxconvenience
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-02-10 10:23:15 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-10 16:24:47 +0100
commit38257651b7e2085ae66c1c67ee9e33e93587b573 (patch)
tree28a27f3a1f1faf410e37182ad7e30597745df78a /src/platformsupport/glxconvenience
parent7dca7c3c571ec595b792bbc2d2d448aac587886a (diff)
Properly read back the actual format in xcb and xlib plugins.
Change-Id: Iccef2c4a87863b93914b84edf3a6015dad5e512a Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/platformsupport/glxconvenience')
-rw-r--r--src/platformsupport/glxconvenience/qglxconvenience.cpp15
-rw-r--r--src/platformsupport/glxconvenience/qglxconvenience_p.h4
2 files changed, 12 insertions, 7 deletions
diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp
index 11d8a5901f..f619bf53b8 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience.cpp
+++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp
@@ -153,23 +153,28 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QSurfaceFormat
XFree(configs);
}
- reducedFormat = qglx_reduceSurfaceFormat(reducedFormat,&reduced);
+ if (!chosenConfig)
+ reducedFormat = qglx_reduceSurfaceFormat(reducedFormat,&reduced);
}
return chosenConfig;
}
-XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QSurfaceFormat &format)
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format)
{
+ Q_ASSERT(format);
+
XVisualInfo *visualInfo = 0;
- GLXFBConfig config = qglx_findConfig(display,screen,format);
- if (config)
+ GLXFBConfig config = qglx_findConfig(display,screen,*format);
+ if (config) {
visualInfo = glXGetVisualFromFBConfig(display, config);
+ *format = qglx_surfaceFormatFromGLXFBConfig(display, config);
+ }
// attempt to fall back to glXChooseVisual
bool reduced = true;
- QSurfaceFormat reducedFormat = format;
+ QSurfaceFormat reducedFormat = *format;
while (!visualInfo && reduced) {
QVarLengthArray<int, 13> attribs;
attribs.append(GLX_RGBA);
diff --git a/src/platformsupport/glxconvenience/qglxconvenience_p.h b/src/platformsupport/glxconvenience/qglxconvenience_p.h
index 6d4cecfbe6..a60f789a85 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience_p.h
+++ b/src/platformsupport/glxconvenience/qglxconvenience_p.h
@@ -48,9 +48,9 @@
#include <X11/Xlib.h>
#include <GL/glx.h>
-XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QSurfaceFormat &format);
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format);
GLXFBConfig qglx_findConfig(Display *display, int screen, const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT);
-QSurfaceFormat qglx_surfaceFormatFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
+QSurfaceFormat qglx_surfaceFormatFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context = 0);
QVector<int> qglx_buildSpec(const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT);
QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *reduced);