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_SHADERVARIABLES_P_H
5#define QT3DRENDER_RENDER_OPENGL_SHADERVARIABLES_P_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 <Qt3DRender/qt3drender_global.h>
19#include <QOpenGLContext>
20
21QT_BEGIN_NAMESPACE
22
23namespace Qt3DRender {
24
25namespace Render {
26
27namespace OpenGL {
28
29struct ShaderAttribute
30{
31 ShaderAttribute()
32 : m_nameId(-1)
33 , m_type(0)
34 , m_size(0)
35 , m_location(-1)
36 {}
37
38 QString m_name;
39 int m_nameId;
40 GLenum m_type;
41 int m_size;
42 int m_location;
43};
44QT3D_DECLARE_TYPEINFO_3(Qt3DRender, Render, OpenGL, ShaderAttribute, Q_RELOCATABLE_TYPE)
45
46struct Q_AUTOTEST_EXPORT ShaderUniform
47{
48 ShaderUniform()
49 : m_nameId(-1)
50 , m_type(GL_NONE)
51 , m_size(0)
52 , m_offset(-1)
53 , m_location(-1)
54 , m_blockIndex(-1)
55 , m_arrayStride(-1)
56 , m_matrixStride(-1)
57 , m_rawByteSize(0)
58 {}
59
60 QString m_name;
61 int m_nameId;
62 GLenum m_type;
63 int m_size;
64 int m_offset; // -1 default, >= 0 if uniform defined in uniform block
65 int m_location; // -1 if uniform defined in a uniform block
66 int m_blockIndex; // -1 is the default, >= 0 if uniform defined in uniform block
67 int m_arrayStride; // -1 is the default, >= 0 if uniform defined in uniform block and if it's an array
68 int m_matrixStride; // -1 is the default, >= 0 uniform defined in uniform block and is a matrix
69 uint m_rawByteSize; // contains byte size (size / type / strides)
70 // size, offset and strides are in bytes
71};
72QT3D_DECLARE_TYPEINFO_3(Qt3DRender, Render, OpenGL, ShaderUniform, Q_RELOCATABLE_TYPE)
73
74struct Q_AUTOTEST_EXPORT ShaderUniformBlock
75{
76 ShaderUniformBlock()
77 : m_nameId(-1)
78 , m_index(-1)
79 , m_binding(-1)
80 , m_activeUniformsCount(0)
81 , m_size(0)
82 {}
83
84 QString m_name;
85 int m_nameId;
86 int m_index;
87 int m_binding;
88 int m_activeUniformsCount;
89 int m_size;
90};
91QT3D_DECLARE_TYPEINFO_3(Qt3DRender, Render, OpenGL, ShaderUniformBlock, Q_RELOCATABLE_TYPE)
92
93struct Q_AUTOTEST_EXPORT ShaderStorageBlock
94{
95 ShaderStorageBlock()
96 : m_nameId(-1)
97 , m_index(-1)
98 , m_binding(-1)
99 , m_size(0)
100 , m_activeVariablesCount(0)
101 {}
102
103 QString m_name;
104 int m_nameId;
105 int m_index;
106 int m_binding;
107 int m_size;
108 int m_activeVariablesCount;
109};
110QT3D_DECLARE_TYPEINFO_3(Qt3DRender, Render, OpenGL, ShaderStorageBlock, Q_RELOCATABLE_TYPE)
111
112} // namespace OpenGL
113
114} // namespace Render
115
116} // namespace Qt3DRender
117
118QT_END_NAMESPACE
119
120#endif // QT3DRENDER_RENDER_OPENGL_SHADERVARIABLES_P_H
121

source code of qt3d/src/plugins/renderers/opengl/renderer/shadervariables_p.h