1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_H
5#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <graphicshelperinterface_p.h>
19#include <QtCore/qscopedpointer.h>
20
21#if !QT_CONFIG(opengles2)
22
23QT_BEGIN_NAMESPACE
24
25class QOpenGLFunctions_3_2_Core;
26
27namespace Qt3DRender {
28namespace Render {
29namespace OpenGL {
30
31class Q_AUTOTEST_EXPORT GraphicsHelperGL3_2 : public GraphicsHelperInterface
32{
33public:
34 GraphicsHelperGL3_2();
35 ~GraphicsHelperGL3_2();
36
37 // QGraphicHelperInterface interface
38 void alphaTest(GLenum mode1, GLenum mode2) override;
39 void bindBufferBase(GLenum target, GLuint index, GLuint buffer) override;
40 void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) override;
41 bool frameBufferNeedsRenderBuffer(const Attachment &attachment) override;
42 void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override;
43 void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
44 void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
45 void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
46 void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
47 void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
48 void blendEquation(GLenum mode) override;
49 void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) override;
50 void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) override;
51 void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override;
52 GLuint boundFrameBufferObject() override;
53 void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override;
54 bool checkFrameBufferComplete() override;
55 void clearBufferf(GLint drawbuffer, const QVector4D &values) override;
56 GLuint createFrameBufferObject() override;
57 void depthMask(GLenum mode) override;
58 void depthRange(GLdouble nearValue, GLdouble farValue) override;
59 void depthTest(GLenum mode) override;
60 void disableClipPlane(int clipPlane) override;
61 void disablei(GLenum cap, GLuint index) override;
62 void disablePrimitiveRestart() override;
63 void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) override;
64 char *mapBuffer(GLenum target, GLsizeiptr size) override;
65 GLboolean unmapBuffer(GLenum target) override;
66 void drawArrays(GLenum primitiveType, GLint first, GLsizei count) override;
67 void drawArraysIndirect(GLenum mode,void *indirect) override;
68 void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override;
69 void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override;
70 void drawBuffers(GLsizei n, const int *bufs) override;
71 void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) override;
72 void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override;
73 void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override;
74 void enableClipPlane(int clipPlane) override;
75 void enablei(GLenum cap, GLuint index) override;
76 void enablePrimitiveRestart(int primitiveRestartIndex) override;
77 void enableVertexAttributeArray(int location) override;
78 void frontFace(GLenum mode) override;
79 QSize getRenderBufferDimensions(GLuint renderBufferId) override;
80 QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) override;
81 void initializeHelper(QOpenGLContext *context, QAbstractOpenGLFunctions *functions) override;
82 void pointSize(bool programmable, GLfloat value) override;
83 GLint maxClipPlaneCount() override;
84 void memoryBarrier(QMemoryBarrier::Operations barriers) override;
85 std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
86 std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
87 std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
88 std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
89 void releaseFrameBufferObject(GLuint frameBufferId) override;
90 void setMSAAEnabled(bool enable) override;
91 void setAlphaCoverageEnabled(bool enable) override;
92 void setClipPlane(int clipPlane, const QVector3D &normal, float distance) override;
93 void setSeamlessCubemap(bool enable) override;
94 void setVerticesPerPatch(GLint verticesPerPatch) override;
95 bool supportsFeature(Feature feature) const override;
96 uint uniformByteSize(const ShaderUniform &description) override;
97 void useProgram(GLuint programId) override;
98 void vertexAttribDivisor(GLuint index, GLuint divisor) override;
99 void vertexAttributePointer(GLenum shaderDataType, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) override;
100 void readBuffer(GLenum mode) override;
101 void drawBuffer(GLenum mode) override;
102 void rasterMode(GLenum faceMode, GLenum rasterMode) override;
103
104 void *fenceSync() override;
105 void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
106 void waitSync(void *sync) override;
107 bool wasSyncSignaled(void *sync) override;
108 void deleteSync(void *sync) override;
109
110 void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
111 void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
112 void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
113 void glUniform4fv(GLint location, GLsizei count, const GLfloat *value) override;
114
115 void glUniform1iv(GLint location, GLsizei count, const GLint *value) override;
116 void glUniform2iv(GLint location, GLsizei count, const GLint *value) override;
117 void glUniform3iv(GLint location, GLsizei count, const GLint *value) override;
118 void glUniform4iv(GLint location, GLsizei count, const GLint *value) override;
119
120 void glUniform1uiv(GLint location, GLsizei count, const GLuint *value) override;
121 void glUniform2uiv(GLint location, GLsizei count, const GLuint *value) override;
122 void glUniform3uiv(GLint location, GLsizei count, const GLuint *value) override;
123 void glUniform4uiv(GLint location, GLsizei count, const GLuint *value) override;
124
125 void glUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value) override;
126 void glUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value) override;
127 void glUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value) override;
128 void glUniformMatrix2x3fv(GLint location, GLsizei count, const GLfloat *value) override;
129 void glUniformMatrix3x2fv(GLint location, GLsizei count, const GLfloat *value) override;
130 void glUniformMatrix2x4fv(GLint location, GLsizei count, const GLfloat *value) override;
131 void glUniformMatrix4x2fv(GLint location, GLsizei count, const GLfloat *value) override;
132 void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) override;
133 void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) override;
134
135 UniformType uniformTypeFromGLType(GLenum glType) override;
136
137private:
138 QOpenGLFunctions_3_2_Core *m_funcs;
139};
140
141} // namespace OpenGL
142} // namespace Render
143} // namespace Qt3DRender
144
145QT_END_NAMESPACE
146
147#endif // !QT_OPENGL_ES_2
148
149#endif // QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_H
150

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