1 /****************************************************************************
2 **
3 ** Copyright (C) 2008-2012 NVIDIA Corporation.
4 ** Copyright (C) 2019 The Qt Company Ltd.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of Qt Quick 3D.
8 **
9 ** $QT_BEGIN_LICENSE:GPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU
20 ** General Public License version 3 or (at your option) any later version
21 ** approved by the KDE Free Qt Foundation. The licenses are as published by
22 ** the Free Software Foundation and appearing in the file LICENSE.GPL3
23 ** included in the packaging of this file. Please review the following
24 ** information to ensure the GNU General Public License requirements will
25 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
26 **
27 ** $QT_END_LICENSE$
28 **
29 ****************************************************************************/
30 
31 
32 #ifndef QSSGOPENGLEXTENSIONS_H
33 #define QSSGOPENGLEXTENSIONS_H
34 
35 //
36 //  W A R N I N G
37 //  -------------
38 //
39 // This file is not part of the Qt API.  It exists purely as an
40 // implementation detail.  This header file may change from version to
41 // version without notice, or even be removed.
42 //
43 // We mean it.
44 //
45 
46 #include <QtOpenGLExtensions/QtOpenGLExtensions>
47 
48 QT_BEGIN_NAMESPACE
49 
50 /* Some OpenGL extensions that are not (yet) found in Qt's OpenGL extensions.
51  * These should be auto-generated and added to QtOpenGLExtensions module */
52 class QSSGOpenGLExtensionsPrivate : public QAbstractOpenGLExtensionPrivate
53 {
54 public:
55     void(QOPENGLF_APIENTRYP BlendBarrierNV)();
56 
57 #if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2_ANGLE)
58     void(QOPENGLF_APIENTRYP PatchParameteriEXT)(GLenum, GLint);
59     void(QOPENGLF_APIENTRYP QueryCounterEXT)(GLuint, GLenum);
60     void(QOPENGLF_APIENTRYP GetQueryObjectui64vEXT)(GLuint, GLenum, GLuint64 *);
61     void(QOPENGLF_APIENTRYP BindVertexArrayOES)(GLuint array);
62     void(QOPENGLF_APIENTRYP DeleteVertexArraysOES)(GLsizei n, const GLuint *arrays);
63     void(QOPENGLF_APIENTRYP GenVertexArraysOES)(GLsizei n, GLuint *arrays);
64     GLboolean(QOPENGLF_APIENTRYP IsVertexArrayOES)(GLuint array);
65 #endif
66 };
67 
68 class QSSGOpenGLExtensions : public QAbstractOpenGLExtension
69 {
70 public:
71     QSSGOpenGLExtensions();
72 
73     bool initializeOpenGLFunctions() override;
74 
75     void glBlendBarrierNV();
76 
77 protected:
78     Q_DECLARE_PRIVATE(QSSGOpenGLExtensions)
79 };
80 
glBlendBarrierNV()81 inline void QSSGOpenGLExtensions::glBlendBarrierNV()
82 {
83     Q_D(QSSGOpenGLExtensions);
84     d->BlendBarrierNV();
85 }
86 
87 #if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2_ANGLE)
88 class QSSGOpenGLES2Extensions : public QSSGOpenGLExtensions
89 {
90 public:
91     QSSGOpenGLES2Extensions();
92 
93     // tesselation shader
94     void glPatchParameteriEXT(GLenum pname, GLint value);
95 
96     // timer
97     void glQueryCounterEXT(GLuint id, GLenum target);
98     void glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params);
99 
100     void glBindVertexArrayOES(GLuint array);
101     void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays);
102     void glGenVertexArraysOES(GLsizei n, GLuint *arrays);
103     GLboolean glIsVertexArrayOES(GLuint array);
104 
105     bool initializeOpenGLFunctions() Q_DECL_FINAL;
106 };
107 
glPatchParameteriEXT(GLenum pname,GLint value)108 inline void QSSGOpenGLES2Extensions::glPatchParameteriEXT(GLenum pname, GLint value)
109 {
110     Q_D(QSSGOpenGLExtensions);
111     d->PatchParameteriEXT(pname, value);
112 }
113 
glQueryCounterEXT(GLuint id,GLenum target)114 inline void QSSGOpenGLES2Extensions::glQueryCounterEXT(GLuint id, GLenum target)
115 {
116     Q_D(QSSGOpenGLExtensions);
117     d->QueryCounterEXT(id, target);
118 }
119 
glGetQueryObjectui64vEXT(GLuint id,GLenum pname,GLuint64 * params)120 inline void QSSGOpenGLES2Extensions::glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
121 {
122     Q_D(QSSGOpenGLExtensions);
123     d->GetQueryObjectui64vEXT(id, pname, params);
124 }
125 
glBindVertexArrayOES(GLuint array)126 inline void QSSGOpenGLES2Extensions::glBindVertexArrayOES(GLuint array)
127 {
128     Q_D(QSSGOpenGLExtensions);
129     d->BindVertexArrayOES(array);
130 }
131 
glDeleteVertexArraysOES(GLsizei n,const GLuint * arrays)132 inline void QSSGOpenGLES2Extensions::glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
133 {
134     Q_D(QSSGOpenGLExtensions);
135     d->DeleteVertexArraysOES(n, arrays);
136 }
137 
glGenVertexArraysOES(GLsizei n,GLuint * arrays)138 inline void QSSGOpenGLES2Extensions::glGenVertexArraysOES(GLsizei n, GLuint *arrays)
139 {
140     Q_D(QSSGOpenGLExtensions);
141     d->GenVertexArraysOES(n, arrays);
142 }
143 
glIsVertexArrayOES(GLuint array)144 inline GLboolean QSSGOpenGLES2Extensions::glIsVertexArrayOES(GLuint array)
145 {
146     Q_D(QSSGOpenGLExtensions);
147     return d->IsVertexArrayOES(array);
148 }
149 
150 #endif // QT_OPENGL_ES
151 
152 QT_END_NAMESPACE
153 
154 #endif // QSSGOPENGLEXTENSIONS_H
155