summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopenglvertexarrayobject_p.h
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <[email protected]>2020-06-18 03:30:47 +0200
committerGiuseppe D'Angelo <[email protected]>2020-06-22 12:48:30 +0200
commit436b331b7127124b9720bf7a3f915439f2a25cf3 (patch)
treeb3cd72c2a3d59dfbefd3aa6f0fe3dfcc9b513862 /src/opengl/qopenglvertexarrayobject_p.h
parentf1f0aa4a3a7d364b5110122a8f77079a7742c4e9 (diff)
Enable access to the VAO resolvers through QOpenGLContextPrivate
This is a commit in preparation for an upcoming change in QtQuick. We want to store the resolved functions for managing VAOs somewhere; the "least worst" choice is next to the all other function resolvers, which are in QOpenGLContext(Private). To avoid moving the VAO resolvers themselves, leave a hook in QOGLCPrivate, similar to e.g. the texture function resolvers. The hook gets populated when the VAO resolvers for a given context are requested. This removes memory management burden from the users of those functions (again, just like other function resolvers), and makes the initialization of the functions automatic. Change-Id: I0eba30a85bf8ad82946a5d68e91009d8b4bd91cf Reviewed-by: Laszlo Agocs <[email protected]>
Diffstat (limited to 'src/opengl/qopenglvertexarrayobject_p.h')
-rw-r--r--src/opengl/qopenglvertexarrayobject_p.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/opengl/qopenglvertexarrayobject_p.h b/src/opengl/qopenglvertexarrayobject_p.h
index 0d0fca4d81f..bd50d860733 100644
--- a/src/opengl/qopenglvertexarrayobject_p.h
+++ b/src/opengl/qopenglvertexarrayobject_p.h
@@ -57,25 +57,27 @@
QT_BEGIN_NAMESPACE
-class QOpenGLVertexArrayObjectHelper;
class QOpenGLContext;
-void Q_OPENGL_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);
-
class QOpenGLVertexArrayObjectHelper
{
Q_DISABLE_COPY(QOpenGLVertexArrayObjectHelper)
-public:
+private:
explicit inline QOpenGLVertexArrayObjectHelper(QOpenGLContext *context)
: GenVertexArrays(nullptr)
, DeleteVertexArrays(nullptr)
, BindVertexArray(nullptr)
, IsVertexArray(nullptr)
{
- qtInitializeVertexArrayObjectHelper(this, context);
+ initializeFromContext(context);
}
+ void Q_OPENGL_EXPORT initializeFromContext(QOpenGLContext *context);
+
+public:
+ static Q_OPENGL_EXPORT QOpenGLVertexArrayObjectHelper *vertexArrayObjectHelperForContext(QOpenGLContext *context);
+
inline bool isValid() const
{
return GenVertexArrays && DeleteVertexArrays && BindVertexArray && IsVertexArray;
@@ -101,9 +103,6 @@ public:
return IsVertexArray(array);
}
-private:
- friend void Q_OPENGL_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);
-
// Function signatures are equivalent between desktop core, ARB, APPLE, ES 3 and ES 2 extensions
typedef void (QOPENGLF_APIENTRYP qt_GenVertexArrays_t)(GLsizei n, GLuint *arrays);
typedef void (QOPENGLF_APIENTRYP qt_DeleteVertexArrays_t)(GLsizei n, const GLuint *arrays);