summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-01 03:07:00 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-01 03:07:00 (GMT)
commitfc944ca0cde725d263b8f28651058b3f90815de9 (patch)
tree1449a6d1c5501a5aa7b6bb29f9cbd36ef960c1d0 /src/opengl
parent0492f2249395ed4f8d86775aee18ffeb195b30b4 (diff)
parent6d20831a82a6a19ea841720e339f5f86623a9dc2 (diff)
downloadQt-fc944ca0cde725d263b8f28651058b3f90815de9.zip
Qt-fc944ca0cde725d263b8f28651058b3f90815de9.tar.gz
Qt-fc944ca0cde725d263b8f28651058b3f90815de9.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (24 commits) Stabilize tst_QGraphicsWidget::QT_BUG_13865_doublePaintWhenAddingASubItem Fixed accessing freed memory in raster engine. Build fix for -qtnamespace. Fixed parsing of SVGs with absolute font sizes. Moving QPdf::stripSpecialCharacter to fontengine Revert "Fix (implement!) hfw/wfh in QGridLayoutEngine" Fixed a layout issue where you could get NaN as dimensions QTextCodec: Fix valgrind warning when using QTextCodec in destructions functions Fix double painting when adding an item into a linear layout Fixed antialiased rasterization bug in raster engine. Fixed potential crash when loading corrupt GIFs. Work around an ATI driver problem with mutli-sampled pbuffers. tst_qstatemachine.cpp: fix compilation with Sun Studio Fixed regression in clipping.qps autotest on 64-bit. Fixed crash when using Qt::WA_DeleteOnClose on a QPrintDialog on Mac. Fixed performance regression in curve stroking. Don't disable texture_from_pixmap on GLX/X11 by default. Avoid creating copy of an image in memory when storing as png Doc update for the support of MSVC 2010 64-bit fix documentation of drawText(int, int, int, int, ... ...
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp36
-rw-r--r--src/opengl/qgl_egl.cpp1
-rw-r--r--src/opengl/qgl_p.h3
-rw-r--r--src/opengl/qglpixelbuffer_win.cpp29
-rw-r--r--src/opengl/qpaintengine_opengl.cpp4
5 files changed, 53 insertions, 20 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 0d1a66e..9e74e04 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -509,6 +509,9 @@ QGLFormat::~QGLFormat()
exchange the screen contents with the buffer. The result is
flicker-free drawing and often better performance.
+ Note that single buffered contexts are currently not supported
+ with EGL.
+
\sa doubleBuffer(), QGLContext::swapBuffers(),
QGLWidget::swapBuffers()
*/
@@ -1689,6 +1692,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
workaround_brokenFBOReadBack = false;
workaroundsCached = false;
+ workaround_brokenTextureFromPixmap = false;
+ workaround_brokenTextureFromPixmap_init = false;
+
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
vertexAttributeArraysEnabledState[i] = false;
}
@@ -2574,18 +2580,34 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
}
}
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
- // Only try to use texture_from_pixmap under X11/EGL
+#if defined(Q_WS_X11)
+ // Try to use texture_from_pixmap
const QX11Info *xinfo = qt_x11Info(paintDevice);
if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType
&& xinfo && xinfo->screen() == pixmap.x11Info().screen()
&& target == GL_TEXTURE_2D)
{
- texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
- if (texture) {
- texture->options |= QGLContext::MemoryManagedBindOption;
- texture->boundPixmap = pd;
- boundPixmaps.insert(pd, QPixmap(pixmap));
+ if (!workaround_brokenTextureFromPixmap_init) {
+ workaround_brokenTextureFromPixmap_init = true;
+
+ const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+ const int pos = versionString.indexOf("NVIDIA ");
+
+ if (pos >= 0) {
+ const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA "));
+
+ if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256"))
+ workaround_brokenTextureFromPixmap = true;
+ }
+ }
+
+ if (!workaround_brokenTextureFromPixmap) {
+ texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
+ if (texture) {
+ texture->options |= QGLContext::MemoryManagedBindOption;
+ texture->boundPixmap = pd;
+ boundPixmaps.insert(pd, QPixmap(pixmap));
+ }
}
}
#endif
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index ebd1169..c79c4cd 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -143,6 +143,7 @@ void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config)
format.setRgba(true); // EGL doesn't support colour index rendering
format.setStereo(false); // EGL doesn't support stereo buffers
format.setAccumBufferSize(0); // EGL doesn't support accululation buffers
+ format.setDoubleBuffer(true); // We don't support single buffered EGL contexts
// Clear the EGL error state because some of the above may
// have errored out because the attribute is not applicable
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 6323ce2..623eeaf 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -401,6 +401,9 @@ public:
uint workaround_brokenFBOReadBack : 1;
uint workaroundsCached : 1;
+ uint workaround_brokenTextureFromPixmap : 1;
+ uint workaround_brokenTextureFromPixmap_init : 1;
+
QPaintDevice *paintDevice;
QColor transpColor;
QGLContext *q_ptr;
diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp
index b55f383..c61d9bf 100644
--- a/src/opengl/qglpixelbuffer_win.cpp
+++ b/src/opengl/qglpixelbuffer_win.cpp
@@ -172,6 +172,10 @@ typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, con
#define WGL_SAMPLES_ARB 0x2042
#endif
+#ifndef GL_SAMPLES_ARB
+#define GL_SAMPLES_ARB 0x80A9
+#endif
+
QGLFormat pfiToQGLFormat(HDC hdc, int pfi);
static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f, int attribs[])
@@ -242,8 +246,7 @@ static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f
bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget)
{
- QGLWidget dmy;
- dmy.makeCurrent(); // needed for wglGetProcAddress() to succeed
+ QGLTemporaryContext tempContext;
PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB =
(PFNWGLCREATEPBUFFERARBPROC) wglGetProcAddress("wglCreatePbufferARB");
@@ -257,13 +260,12 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
if (!wglCreatePbufferARB) // assumes that if one can be resolved, all of them can
return false;
- dc = GetDC(dmy.winId());
+ dc = wglGetCurrentDC();
Q_ASSERT(dc);
+ has_render_texture = false;
// sample buffers doesn't work in conjunction with the render_texture extension
- if (f.sampleBuffers()) {
- has_render_texture = false;
- } else {
+ if (!f.sampleBuffers()) {
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
(PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
@@ -292,7 +294,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
if (num_formats == 0) {
qWarning("QGLPixelBuffer: Unable to find a pixel format with pbuffer - giving up.");
- ReleaseDC(dmy.winId(), dc);
return false;
}
format = pfiToQGLFormat(dc, pixel_format);
@@ -305,26 +306,32 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
pbuf = wglCreatePbufferARB(dc, pixel_format, size.width(), size.height(),
has_render_texture ? pb_attribs : 0);
- if(!pbuf) {
+ if (!pbuf) {
// try again without the render_texture extension
pbuf = wglCreatePbufferARB(dc, pixel_format, size.width(), size.height(), 0);
has_render_texture = false;
if (!pbuf) {
qWarning("QGLPixelBuffer: Unable to create pbuffer [w=%d, h=%d] - giving up.", size.width(), size.height());
- ReleaseDC(dmy.winId(), dc);
return false;
}
}
- ReleaseDC(dmy.winId(), dc);
dc = wglGetPbufferDCARB(pbuf);
ctx = wglCreateContext(dc);
-
if (!dc || !ctx) {
qWarning("QGLPixelBuffer: Unable to create pbuffer context - giving up.");
return false;
}
+ // Explicitly disable the render_texture extension if we have a
+ // multi-sampled pbuffer context. This seems to be a problem only with
+ // ATI cards if multi-sampling is forced globally in the driver.
+ wglMakeCurrent(dc, ctx);
+ GLint samples = 0;
+ glGetIntegerv(GL_SAMPLES_ARB, &samples);
+ if (has_render_texture && samples != 0)
+ has_render_texture = false;
+
HGLRC share_ctx = shareWidget ? shareWidget->d_func()->glcx->d_func()->rc : 0;
if (share_ctx && !wglShareLists(share_ctx, ctx))
qWarning("QGLPixelBuffer: Unable to share display lists - with share widget.");
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 58778ea..2f17aa6 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -506,12 +506,12 @@ struct QDrawQueueItem
////////// GL program cache: start
-typedef struct {
+struct GLProgram {
int brush; // brush index or mask index
int mode; // composition mode index
bool mask;
GLuint program;
-} GLProgram;
+};
typedef QMultiHash<const QGLContext *, GLProgram> QGLProgramHash;