From 8cc8bbb466fb871585bfa1d5c56fc8bc6d6c8a96 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 21 Jul 2023 13:48:35 +0200 Subject: QOpenGLWidget: use (and prefer) InvalidateFramebuffer Desktop GL does not have the GL_EXT_discard_framebuffer extension at all. Instead, it may have GL_ARB_invalidate_subdata. Furthermore, GLES >= 3.0 and GL >= 4.3 both support FBO invalidation through glInvalidateFramebuffer. Extend the semantics of OpenGLExtension::DiscardFramebuffer to mean that *any* possibility above is supported, and wrap it in a helper function that calls whatever support is present. (This is all private API anyhow.) Technically speaking glInvalidateFramebuffer supports a superset of what glDiscardFramebufferEXT supports, but we never use such superset, and the two APIs are otherwise identical. Then, make QOpenGLWidget call that wrapper. Change-Id: I64e042daf51493d3834c3ba1b53ae6e224bbc4ed Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglextensions_p.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/gui/opengl/qopenglextensions_p.h') diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h index 58231545c6..a6c4a68c6c 100644 --- a/src/gui/opengl/qopenglextensions_p.h +++ b/src/gui/opengl/qopenglextensions_p.h @@ -70,9 +70,9 @@ public: GLvoid *glMapBuffer(GLenum target, GLenum access); void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data); - void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); void flushShared(); + void discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments); QOpenGLExtensionsPrivate *d() const; @@ -117,14 +117,6 @@ 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 -- cgit v1.2.3