diff options
| author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-01 18:41:14 +0200 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-07-01 18:41:14 +0200 |
| commit | e6a94778d0c26b59e367e9f9fe4f401725fc9c4e (patch) | |
| tree | c7597213d7eac14863bc3cfd7bccd247c8950710 /src/gui/opengl/qopenglframebufferobject.cpp | |
| parent | 605ba2c2268b2dce3d0b06899101d03a67e7f251 (diff) | |
| parent | a09a8d509a69ed16d8afbe15296b8332cacd6c66 (diff) | |
| download | qtbase-e6a94778d0c26b59e367e9f9fe4f401725fc9c4e.tar.gz | |
Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui/opengl/qopenglframebufferobject.cpp')
| -rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 2651c23665..97b006b4fc 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -443,9 +443,10 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi samples = qBound(0, int(samples), int(maxSamples)); } + samples = qMax(0, samples); + requestedSamples = samples; size = sz; target = texture_target; - // texture dimensions QT_RESET_GLERROR(); // reset error state GLuint fbo = 0; @@ -477,6 +478,9 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi valid = checkFramebufferStatus(ctx); if (valid) { + // Query the actual number of samples. This can be greater than the requested + // value since the typically supported values are 0, 4, 8, ..., and the + // requests are mapped to the next supported value. funcs.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &samples); color_buffer_guard = new QOpenGLSharedResourceGuard(ctx, color_buffer, freeRenderbufferFunc); } @@ -546,7 +550,10 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment) { - int samples = format.samples(); + // Use the same sample count for all attachments. format.samples() already contains + // the actual number of samples for the color attachment and is not suitable. Use + // requestedSamples instead. + const int samples = requestedSamples; // free existing attachments if (depth_buffer_guard) { |
