summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@digia.com>2014-09-08 15:34:31 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2014-12-11 10:36:39 +0100
commitd46d3ef044c6f2a03d2eb5446420ecf5940d57a8 (patch)
treedc0c57f49b3afda1778047848aa3e2dedf5afeec /src/gui/opengl
parent53022e04bb578c12cdc9460d7ce4eedefbc8c2e4 (diff)
Add GL_EXT_discard_framebuffer to QOpenGLExtensions
Change-Id: I57e8dd2ea2e6f018a46eaabed2ca8b6d417358a3 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/qopenglextensions_p.h14
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp9
2 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index 23cfe16467..0d0cfd26ba 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -81,7 +81,8 @@ public:
MapBuffer = 0x00040000,
GeometryShaders = 0x00080000,
MapBufferRange = 0x00100000,
- Sized8Formats = 0x00200000
+ Sized8Formats = 0x00200000,
+ DiscardFramebuffer = 0x00400000
};
Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension)
@@ -102,6 +103,8 @@ public:
void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
+ void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+
private:
static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; }
};
@@ -124,6 +127,7 @@ public:
GLenum internalFormat,
GLsizei width, GLsizei height);
void (QOPENGLF_APIENTRYP GetBufferSubData)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
+ void (QOPENGLF_APIENTRYP DiscardFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
};
inline GLvoid *QOpenGLExtensions::glMapBuffer(GLenum target, GLenum access)
@@ -182,6 +186,14 @@ inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, qopengl_GLintpt
Q_OPENGL_FUNCTIONS_DEBUG
}
+
+inline void QOpenGLExtensions::glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments)
+{
+ Q_D(QOpenGLExtensions);
+ Q_ASSERT(QOpenGLExtensions::isInitialized(d));
+ d->DiscardFramebuffer(target,numAttachments, attachments);
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
QT_END_NAMESPACE
#endif // QOPENGL_EXTENSIONS_P_H
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 3631c019d3..99604ca8b2 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -415,6 +415,9 @@ static int qt_gl_resolve_extensions()
// We don't match GL_APPLE_texture_format_BGRA8888 here because it has different semantics.
if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
+
+ if (extensionMatcher.match("GL_EXT_discard_framebuffer"))
+ extensions |= QOpenGLExtensions::DiscardFramebuffer;
} else {
extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer;
@@ -3257,6 +3260,11 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop
(target, offset, size, data);
}
+static void QOPENGLF_APIENTRY qopenglfResolveDiscardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+{
+ RESOLVE_FUNC_VOID(ResolveEXT, DiscardFramebuffer)(target, numAttachments, attachments);
+}
+
#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
// Special translation functions for ES-specific calls on desktop GL
@@ -3495,6 +3503,7 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx)
BlitFramebuffer = qopenglfResolveBlitFramebuffer;
RenderbufferStorageMultisample = qopenglfResolveRenderbufferStorageMultisample;
GetBufferSubData = qopenglfResolveGetBufferSubData;
+ DiscardFramebuffer = qopenglfResolveDiscardFramebuffer;
}
QT_END_NAMESPACE