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 #ifndef QSSG_RENDER_BACKEND_GL4_H
32 #define QSSG_RENDER_BACKEND_GL4_H
33 
34 //
35 //  W A R N I N G
36 //  -------------
37 //
38 // This file is not part of the Qt API.  It exists purely as an
39 // implementation detail.  This header file may change from version to
40 // version without notice, or even be removed.
41 //
42 // We mean it.
43 //
44 
45 /// @file QSSGrenderbackendgl4.h
46 ///       NVRender OpenGL 4 backend definition.
47 
48 #include <QtQuick3DRender/private/qssgrenderbackendgl3_p.h>
49 
50 QT_BEGIN_NAMESPACE
51 
52 #if !defined(QT_OPENGL_ES)
53     class QOpenGLExtension_EXT_direct_state_access;
54 #endif
55 
56 class QSSGRenderBackendGL4Impl : public QSSGRenderBackendGL3Impl
57 {
58 public:
59     /// constructor
60     QSSGRenderBackendGL4Impl(const QSurfaceFormat &format);
61     /// destructor
62     virtual ~QSSGRenderBackendGL4Impl() override;
63 
64     QByteArray getShadingLanguageVersion() final;
65     QSSGRenderContextType getRenderContextType() const final;
66 
67     void createTextureStorage2D(QSSGRenderBackendTextureObject to,
68                                 QSSGRenderTextureTargetType target,
69                                 qint32 levels,
70                                 QSSGRenderTextureFormat internalFormat,
71                                 qint32 width,
72                                 qint32 height) override;
73 
74     void setMultisampledTextureData2D(QSSGRenderBackendTextureObject to,
75                                       QSSGRenderTextureTargetType target,
76                                       qint32 samples,
77                                       QSSGRenderTextureFormat internalFormat,
78                                       qint32 width,
79                                       qint32 height,
80                                       bool fixedsamplelocations) override;
81 
82     void setConstantValue(QSSGRenderBackendShaderProgramObject po,
83                           quint32 id,
84                           QSSGRenderShaderDataType type,
85                           qint32 count,
86                           const void *value,
87                           bool transpose) override;
88 
89     void setPatchVertexCount(QSSGRenderBackendInputAssemblerObject iao, quint32 count) override;
90     virtual QSSGRenderBackendTessControlShaderObject createTessControlShader(QSSGByteView source,
91                                                                                QByteArray &errorMessage,
92                                                                                bool binary) override;
93     virtual QSSGRenderBackendTessEvaluationShaderObject createTessEvaluationShader(QSSGByteView source,
94                                                                                      QByteArray &errorMessage,
95                                                                                      bool binary) override;
96     virtual QSSGRenderBackendGeometryShaderObject createGeometryShader(QSSGByteView source,
97                                                                          QByteArray &errorMessage,
98                                                                          bool binary) override;
99 
100     qint32 getStorageBufferCount(QSSGRenderBackendShaderProgramObject po) override;
101     qint32 getStorageBufferInfoByID(QSSGRenderBackendShaderProgramObject po,
102                                     quint32 id,
103                                     quint32 nameBufSize,
104                                     qint32 *paramCount,
105                                     qint32 *bufferSize,
106                                     qint32 *length,
107                                     char *nameBuf) override;
108     void programSetStorageBuffer(quint32 index, QSSGRenderBackendBufferObject bo) override;
109 
110     void setMemoryBarrier(QSSGRenderBufferBarrierFlags barriers) override;
111     void bindImageTexture(QSSGRenderBackendTextureObject to,
112                           quint32 unit,
113                           qint32 level,
114                           bool layered,
115                           qint32 layer,
116                           QSSGRenderImageAccessType access,
117                           QSSGRenderTextureFormat format) override;
118 
119     virtual QSSGRenderBackendComputeShaderObject createComputeShader(QSSGByteView source,
120                                                                        QByteArray &errorMessage,
121                                                                        bool binary) override;
122     void dispatchCompute(QSSGRenderBackendShaderProgramObject po, quint32 numGroupsX, quint32 numGroupsY, quint32 numGroupsZ) override;
123 
124     QSSGRenderBackendProgramPipeline createProgramPipeline() override;
125     void releaseProgramPipeline(QSSGRenderBackendProgramPipeline ppo) override;
126     void setActiveProgramPipeline(QSSGRenderBackendProgramPipeline ppo) override;
127     void setProgramStages(QSSGRenderBackendProgramPipeline ppo,
128                           QSSGRenderShaderTypeFlags flags,
129                           QSSGRenderBackendShaderProgramObject po) override;
130 
131     void setBlendEquation(const QSSGRenderBlendEquationArgument &pBlendEquArg) override;
132     void setBlendBarrier(void) override;
133 
134 
135 
136 private:
137 #if !defined(QT_OPENGL_ES)
138     QOpenGLExtension_EXT_direct_state_access *m_directStateAccess;
139 #endif
140 };
141 
142 QT_END_NAMESPACE
143 
144 #endif
145