diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-06-10 17:43:59 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-07-29 07:54:13 +0000 |
commit | 06b86f68e8ddb1bbadd5adc14067f92c896ead93 (patch) | |
tree | 58242a9c91fc41eb393d95b36f4531f7bd5c56f5 /src/gui/opengl/qopenglframebufferobject_p.h | |
parent | c173a5071906867de9da26ee8f49224b23c2ef1d (diff) |
Support MRT in QOpenGLFramebufferObject
Introduce overloads in the API to allow specifying multiple color
attachment sizes and formats. When these are in use and MRT is supported,
a texture or renderbuffer is created for each of GL_COLOR_ATTACHMENT0, 1, 2, ...
[ChangeLog] Added support for multiple render targets in QOpenGLFramebufferObject
Task-number: QTBUG-39235
Change-Id: Ie7cfd81d1b796a9166b80dff7513aafe0120d53d
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/gui/opengl/qopenglframebufferobject_p.h')
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject_p.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h index 7f0068dfc4..6c45fda57f 100644 --- a/src/gui/opengl/qopenglframebufferobject_p.h +++ b/src/gui/opengl/qopenglframebufferobject_p.h @@ -102,32 +102,41 @@ public: class QOpenGLFramebufferObjectPrivate { public: - QOpenGLFramebufferObjectPrivate() : fbo_guard(0), texture_guard(0), depth_buffer_guard(0) - , stencil_buffer_guard(0), color_buffer_guard(0) + QOpenGLFramebufferObjectPrivate() : fbo_guard(0), depth_buffer_guard(0) + , stencil_buffer_guard(0) , valid(false) {} ~QOpenGLFramebufferObjectPrivate() {} - void init(QOpenGLFramebufferObject *q, const QSize& sz, + void init(QOpenGLFramebufferObject *q, const QSize &size, QOpenGLFramebufferObject::Attachment attachment, - GLenum internal_format, GLenum texture_target, + GLenum texture_target, GLenum internal_format, GLint samples = 0, bool mipmap = false); - void initTexture(GLenum target, GLenum internal_format, const QSize &size, bool mipmap); - void initAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment); + void initTexture(int idx); + void initColorBuffer(int idx, GLint *samples); + void initDepthStencilAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment); bool checkFramebufferStatus(QOpenGLContext *ctx) const; QOpenGLSharedResourceGuard *fbo_guard; - QOpenGLSharedResourceGuard *texture_guard; QOpenGLSharedResourceGuard *depth_buffer_guard; QOpenGLSharedResourceGuard *stencil_buffer_guard; - QOpenGLSharedResourceGuard *color_buffer_guard; GLenum target; - QSize size; + QSize dsSize; QOpenGLFramebufferObjectFormat format; int requestedSamples; uint valid : 1; QOpenGLFramebufferObject::Attachment fbo_attachment; QOpenGLExtensions funcs; + struct ColorAttachment { + ColorAttachment() : internalFormat(0), guard(0) { } + ColorAttachment(const QSize &size, GLenum internalFormat) + : size(size), internalFormat(internalFormat), guard(0) { } + QSize size; + GLenum internalFormat; + QOpenGLSharedResourceGuard *guard; + }; + QVector<ColorAttachment> colorAttachments; + inline GLuint fbo() const { return fbo_guard ? fbo_guard->id() : 0; } }; |