diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-09-18 06:55:33 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 22:00:49 +0200 |
commit | 16c47c3b343e2024cce3acd50f2dfe10ae5c40c7 (patch) | |
tree | 5b6c02298359b23792f1fea0bf8835b2547f03fd /src/gui/opengl/qopenglframebufferobject.cpp | |
parent | 03520d7fde2f6dced73c69744ab0bc1d3b166862 (diff) |
Don't try to allocate a msaa FBO when it is not supported.
Change-Id: Ib4bdabcfa4e9b76156d7188da82fe2173b4b997e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/opengl/qopenglframebufferobject.cpp')
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 247ecf7351..8d7b525929 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -425,6 +425,17 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi if (!funcs.hasOpenGLFeature(QOpenGLFunctions::Framebuffers)) return; + + // Fall back to using a normal non-msaa FBO if we don't have support for MSAA + if (!funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) + || !funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)) { + samples = 0; + } + + GLint maxSamples; + glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); + samples = qBound(0, int(samples), int(maxSamples)); + size = sz; target = texture_target; // texture dimensions @@ -473,25 +484,11 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi color_buffer = 0; } else { mipmap = false; - GLint maxSamples; - glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); - - samples = qBound(0, int(samples), int(maxSamples)); - funcs.glGenRenderbuffers(1, &color_buffer); funcs.glBindRenderbuffer(GL_RENDERBUFFER, color_buffer); - if (funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) && samples > 0) { - funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, - internal_format, size.width(), size.height()); - } else { - samples = 0; - funcs.glRenderbufferStorage(GL_RENDERBUFFER, internal_format, - size.width(), size.height()); - } - + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, internal_format, size.width(), size.height()); funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, color_buffer); - QT_CHECK_GLERROR(); valid = checkFramebufferStatus(ctx); |