Add GL_EXT_discard_framebuffer to QOpenGLExtensions

Change-Id: I57e8dd2ea2e6f018a46eaabed2ca8b6d417358a3
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Jørgen Lind 2014-09-08 15:34:31 +02:00 committed by Jørgen Lind
parent 53022e04bb
commit d46d3ef044
2 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -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