summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-20 11:53:27 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-20 11:56:05 (GMT)
commitde808f3c91afaecfc9d7a9a7ea6ff7533dfd1e1b (patch)
treec9afbaac140849c18318cb5e30ee8771d67574a9 /src/opengl
parentbbf11b714f6430fea2a35dc370c3530afcddf8ab (diff)
downloadQt-de808f3c91afaecfc9d7a9a7ea6ff7533dfd1e1b.zip
Qt-de808f3c91afaecfc9d7a9a7ea6ff7533dfd1e1b.tar.gz
Qt-de808f3c91afaecfc9d7a9a7ea6ff7533dfd1e1b.tar.bz2
Support multisampled pbuffers under Windows.
Multisampled pbuffers don't work in conjunction with the render_texture extension. Now we turn off the render_texture extension if a multi- sampled format is requested. Task-number: QTBUG-13503 Reviewed-by: Samuel
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qglpixelbuffer.cpp8
-rw-r--r--src/opengl/qglpixelbuffer_win.cpp34
2 files changed, 28 insertions, 14 deletions
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 9a8b243..994947b 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -67,7 +67,13 @@
when the pbuffer contents change, eliminating the need for
additional copy operations. This is supported only on Windows
and Mac OS X systems that provide the \c render_texture
- extension.
+ extension. Note that under Windows, a multi-sampled pbuffer
+ can't be used in conjunction with the \c render_texture
+ extension. If a multi-sampled pbuffer is requested under
+ Windows, the \c render_texture extension is turned off for that
+ pbuffer.
+
+
\endlist
Pbuffers are provided by the OpenGL \c pbuffer extension; call
diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp
index 8d0d105..b55f383 100644
--- a/src/opengl/qglpixelbuffer_win.cpp
+++ b/src/opengl/qglpixelbuffer_win.cpp
@@ -167,6 +167,11 @@ typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, con
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#endif
+#ifndef WGL_ARB_multisample
+#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLES_ARB 0x2042
+#endif
+
QGLFormat pfiToQGLFormat(HDC hdc, int pfi);
static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f, int attribs[])
@@ -226,14 +231,12 @@ static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f
attribs[i++] = WGL_FLOAT_COMPONENTS_NV;
attribs[i++] = TRUE;
}
- // sample buffers doesn't work in conjunction with the render_texture extension
- // so igonre that for now
- // if (f.sampleBuffers()) {
- // attribs[i++] = WGL_SAMPLE_BUFFERS_ARB;
- // attribs[i++] = 1;
- // attribs[i++] = WGL_SAMPLES_ARB;
- // attribs[i++] = f.samples() == -1 ? 16 : f.samples();
- // }
+ if (f.sampleBuffers()) {
+ attribs[i++] = WGL_SAMPLE_BUFFERS_ARB;
+ attribs[i++] = 1;
+ attribs[i++] = WGL_SAMPLES_ARB;
+ attribs[i++] = f.samples() == -1 ? 16 : f.samples();
+ }
attribs[i] = 0;
}
@@ -257,12 +260,17 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
dc = GetDC(dmy.winId());
Q_ASSERT(dc);
- PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
- (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
+ // sample buffers doesn't work in conjunction with the render_texture extension
+ if (f.sampleBuffers()) {
+ has_render_texture = false;
+ } else {
+ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
+ (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
- if (wglGetExtensionsStringARB) {
- QString extensions(QLatin1String(wglGetExtensionsStringARB(dc)));
- has_render_texture = extensions.contains(QLatin1String("WGL_ARB_render_texture"));
+ if (wglGetExtensionsStringARB) {
+ QString extensions(QLatin1String(wglGetExtensionsStringARB(dc)));
+ has_render_texture = extensions.contains(QLatin1String("WGL_ARB_render_texture"));
+ }
}
int attribs[40];