1/****************************************************************************
2**
3** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL4_H
41#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL4_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists for the convenience
48// of other Qt classes. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <graphicshelperinterface_p.h>
55#include <QtCore/qscopedpointer.h>
56
57#ifndef QT_OPENGL_ES_2
58
59QT_BEGIN_NAMESPACE
60
61class QOpenGLFunctions_4_3_Core;
62
63namespace Qt3DRender {
64namespace Render {
65namespace OpenGL {
66
67class Q_AUTOTEST_EXPORT GraphicsHelperGL4 : public GraphicsHelperInterface
68{
69public:
70 GraphicsHelperGL4();
71
72 // QGraphicHelperInterface interface
73 void alphaTest(GLenum mode1, GLenum mode2) override;
74 void bindBufferBase(GLenum target, GLuint index, GLuint buffer) override;
75 void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) override;
76 bool frameBufferNeedsRenderBuffer(const Attachment &attachment) override;
77 void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override;
78 void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
79 void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
80 void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
81 void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
82 void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
83 void blendEquation(GLenum mode) override;
84 void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) override;
85 void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) override;
86 void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override;
87 GLuint boundFrameBufferObject() override;
88 void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override;
89 bool checkFrameBufferComplete() override;
90 void clearBufferf(GLint drawbuffer, const QVector4D &values) override;
91 GLuint createFrameBufferObject() override;
92 void depthMask(GLenum mode) override;
93 void depthRange(GLdouble nearValue, GLdouble farValue) override;
94 void depthTest(GLenum mode) override;
95 void disableClipPlane(int clipPlane) override;
96 void disablei(GLenum cap, GLuint index) override;
97 void disablePrimitiveRestart() override;
98 void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) override;
99 char *mapBuffer(GLenum target, GLsizeiptr size) override;
100 GLboolean unmapBuffer(GLenum target) override;
101 void drawArrays(GLenum primitiveType, GLint first, GLsizei count) override;
102 void drawArraysIndirect(GLenum mode,void *indirect) override;
103 void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override;
104 void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override;
105 void drawBuffers(GLsizei n, const int *bufs) override;
106 void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override;
107 void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override;
108 void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override;
109 void enableClipPlane(int clipPlane) override;
110 void enablei(GLenum cap, GLuint index) override;
111 void enablePrimitiveRestart(int primitiveRestartIndex) override;
112 void enableVertexAttributeArray(int location) override;
113 void frontFace(GLenum mode) override;
114 QSize getRenderBufferDimensions(GLuint renderBufferId) override;
115 QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) override;
116 void initializeHelper(QOpenGLContext *context, QAbstractOpenGLFunctions *functions) override;
117 void pointSize(bool programmable, GLfloat value) override;
118 GLint maxClipPlaneCount() override;
119 void memoryBarrier(QMemoryBarrier::Operations barriers) override;
120 QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
121 QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
122 QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
123 QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
124 void releaseFrameBufferObject(GLuint frameBufferId) override;
125 void setMSAAEnabled(bool enable) override;
126 void setAlphaCoverageEnabled(bool enable) override;
127 void setClipPlane(int clipPlane, const QVector3D &normal, float distance) override;
128 void setSeamlessCubemap(bool enable) override;
129 void setVerticesPerPatch(GLint verticesPerPatch) override;
130 bool supportsFeature(Feature feature) const override;
131 uint uniformByteSize(const ShaderUniform &description) override;
132 void useProgram(GLuint programId) override;
133 void vertexAttribDivisor(GLuint index, GLuint divisor) override;
134 void vertexAttributePointer(GLenum shaderDataType, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) override;
135 void readBuffer(GLenum mode) override;
136 void drawBuffer(GLenum mode) override;
137 void rasterMode(GLenum faceMode, GLenum rasterMode) override;
138
139 void *fenceSync() override;
140 void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
141 void waitSync(void *sync) override;
142 bool wasSyncSignaled(void *sync) override;
143 void deleteSync(void *sync) override;
144
145 void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
146 void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
147 void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
148 void glUniform4fv(GLint location, GLsizei count, const GLfloat *value) override;
149
150 void glUniform1iv(GLint location, GLsizei count, const GLint *value) override;
151 void glUniform2iv(GLint location, GLsizei count, const GLint *value) override;
152 void glUniform3iv(GLint location, GLsizei count, const GLint *value) override;
153 void glUniform4iv(GLint location, GLsizei count, const GLint *value) override;
154
155 void glUniform1uiv(GLint location, GLsizei count, const GLuint *value) override;
156 void glUniform2uiv(GLint location, GLsizei count, const GLuint *value) override;
157 void glUniform3uiv(GLint location, GLsizei count, const GLuint *value) override;
158 void glUniform4uiv(GLint location, GLsizei count, const GLuint *value) override;
159
160 void glUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value) override;
161 void glUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value) override;
162 void glUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value) override;
163 void glUniformMatrix2x3fv(GLint location, GLsizei count, const GLfloat *value) override;
164 void glUniformMatrix3x2fv(GLint location, GLsizei count, const GLfloat *value) override;
165 void glUniformMatrix2x4fv(GLint location, GLsizei count, const GLfloat *value) override;
166 void glUniformMatrix4x2fv(GLint location, GLsizei count, const GLfloat *value) override;
167 void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) override;
168 void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) override;
169
170 UniformType uniformTypeFromGLType(GLenum glType) override;
171
172private:
173 QOpenGLFunctions_4_3_Core *m_funcs;
174};
175
176} // namespace OpenGL
177} // namespace Render
178} // namespace Qt3DRender
179
180QT_END_NAMESPACE
181
182#endif // !QT_OPENGL_ES_2
183
184#endif // QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL4_H
185

source code of qt3d/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h