qopengltexturehelper.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopengltexturehelper.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui 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#include "qopengltexturehelper_p.h"-
41-
42#include <QOpenGLContext>-
43#include <private/qopenglextensions_p.h>-
44-
45QT_BEGIN_NAMESPACE-
46-
47QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)-
48{-
49 functions = context->functions();-
50 // Resolve EXT_direct_state_access entry points if present.-
51-
52 // However, disable it on some systems where DSA is known to be unreliable.-
53 bool allowDSA = true;-
54 const char *renderer = reinterpret_cast<const char *>(context->functions()->glGetString(GL_RENDERER));-
55 // QTBUG-40653, QTBUG-44988-
56 if (renderer && strstr(renderer, "AMD Radeon HD"))
rendererDescription
TRUEnever evaluated
FALSEnever evaluated
strstr(rendere...MD Radeon HD")Description
TRUEnever evaluated
FALSEnever evaluated
0
57 allowDSA = false;
never executed: allowDSA = false;
0
58-
59 if (allowDSA && !context->isOpenGLES()
allowDSADescription
TRUEnever evaluated
FALSEnever evaluated
!context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
0
60 && context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
never executed: return ba;
context->hasEx...turn ba; }()))Description
TRUEnever evaluated
FALSEnever evaluated
0
61 TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress("glTextureParameteriEXT"));-
62 TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress("glTextureParameterivEXT"));-
63 TextureParameterfEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLfloat )>(context->getProcAddress("glTextureParameterfEXT"));-
64 TextureParameterfvEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLfloat *)>(context->getProcAddress("glTextureParameterfvEXT"));-
65 GenerateTextureMipmapEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum )>(context->getProcAddress("glGenerateTextureMipmapEXT"));-
66 TextureStorage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress("glTextureStorage3DEXT"));-
67 TextureStorage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress("glTextureStorage2DEXT"));-
68 TextureStorage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress("glTextureStorage1DEXT"));-
69 TextureStorage3DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureStorage3DMultisampleEXT"));-
70 TextureStorage2DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureStorage2DMultisampleEXT"));-
71 TextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage3DEXT"));-
72 TextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage2DEXT"));-
73 TextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage1DEXT"));-
74 TextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage3DEXT"));-
75 TextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage2DEXT"));-
76 TextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage1DEXT"));-
77 CompressedTextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage1DEXT"));-
78 CompressedTextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage2DEXT"));-
79 CompressedTextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage3DEXT"));-
80 CompressedTextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage1DEXT"));-
81 CompressedTextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage2DEXT"));-
82 CompressedTextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage3DEXT"));-
83-
84 // Use the real DSA functions-
85 TextureParameteri = &QOpenGLTextureHelper::dsa_TextureParameteri;-
86 TextureParameteriv = &QOpenGLTextureHelper::dsa_TextureParameteriv;-
87 TextureParameterf = &QOpenGLTextureHelper::dsa_TextureParameterf;-
88 TextureParameterfv = &QOpenGLTextureHelper::dsa_TextureParameterfv;-
89 GenerateTextureMipmap = &QOpenGLTextureHelper::dsa_GenerateTextureMipmap;-
90 TextureStorage3D = &QOpenGLTextureHelper::dsa_TextureStorage3D;-
91 TextureStorage2D = &QOpenGLTextureHelper::dsa_TextureStorage2D;-
92 TextureStorage1D = &QOpenGLTextureHelper::dsa_TextureStorage1D;-
93 TextureStorage3DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage3DMultisample;-
94 TextureStorage2DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage2DMultisample;-
95 TextureImage3D = &QOpenGLTextureHelper::dsa_TextureImage3D;-
96 TextureImage2D = &QOpenGLTextureHelper::dsa_TextureImage2D;-
97 TextureImage1D = &QOpenGLTextureHelper::dsa_TextureImage1D;-
98 TextureSubImage3D = &QOpenGLTextureHelper::dsa_TextureSubImage3D;-
99 TextureSubImage2D = &QOpenGLTextureHelper::dsa_TextureSubImage2D;-
100 TextureSubImage1D = &QOpenGLTextureHelper::dsa_TextureSubImage1D;-
101 CompressedTextureSubImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage1D;-
102 CompressedTextureSubImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage2D;-
103 CompressedTextureSubImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage3D;-
104 CompressedTextureImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureImage1D;-
105 CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D;-
106 CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D;-
107 } else {
never executed: end of block
0
108 // Use our own DSA emulation-
109 TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;-
110 TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;-
111 TextureParameterf = &QOpenGLTextureHelper::qt_TextureParameterf;-
112 TextureParameterfv = &QOpenGLTextureHelper::qt_TextureParameterfv;-
113 GenerateTextureMipmap = &QOpenGLTextureHelper::qt_GenerateTextureMipmap;-
114 TextureStorage3D = &QOpenGLTextureHelper::qt_TextureStorage3D;-
115 TextureStorage2D = &QOpenGLTextureHelper::qt_TextureStorage2D;-
116 TextureStorage1D = &QOpenGLTextureHelper::qt_TextureStorage1D;-
117 TextureStorage3DMultisample = &QOpenGLTextureHelper::qt_TextureStorage3DMultisample;-
118 TextureStorage2DMultisample = &QOpenGLTextureHelper::qt_TextureStorage2DMultisample;-
119 TextureImage3D = &QOpenGLTextureHelper::qt_TextureImage3D;-
120 TextureImage2D = &QOpenGLTextureHelper::qt_TextureImage2D;-
121 TextureImage1D = &QOpenGLTextureHelper::qt_TextureImage1D;-
122 TextureSubImage3D = &QOpenGLTextureHelper::qt_TextureSubImage3D;-
123 TextureSubImage2D = &QOpenGLTextureHelper::qt_TextureSubImage2D;-
124 TextureSubImage1D = &QOpenGLTextureHelper::qt_TextureSubImage1D;-
125 CompressedTextureSubImage1D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage1D;-
126 CompressedTextureSubImage2D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage2D;-
127 CompressedTextureSubImage3D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage3D;-
128 CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D;-
129 CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D;-
130 CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D;-
131 }
never executed: end of block
0
132-
133 // Some DSA functions are part of NV_texture_multisample instead-
134 if (!context->isOpenGLES()
!context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
0
135 && context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
never executed: return ba;
context->hasEx...turn ba; }()))Description
TRUEnever evaluated
FALSEnever evaluated
0
136 TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureImage3DMultisampleNV"));-
137 TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureImage2DMultisampleNV"));-
138-
139 TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;-
140 TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;-
141 } else {
never executed: end of block
0
142 TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample;-
143 TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample;-
144 }
never executed: end of block
0
145-
146#if defined(QT_OPENGL_ES_2)-
147 // Here we are targeting OpenGL ES 2.0+ only. This is likely using EGL, where,-
148 // similarly to WGL, non-extension functions (i.e. any function that is part of the-
149 // GLES spec) *may* not be queried via eglGetProcAddress.-
150-
151 // OpenGL 1.0-
152 TexImage1D = 0;-
153-
154 // OpenGL 1.1-
155 TexSubImage1D = 0;-
156-
157 // OpenGL 1.3-
158 GetCompressedTexImage = 0;-
159 CompressedTexSubImage1D = 0;-
160 CompressedTexSubImage2D = ::glCompressedTexSubImage2D;-
161 CompressedTexImage1D = 0;-
162 CompressedTexImage2D = ::glCompressedTexImage2D;-
163 ActiveTexture = ::glActiveTexture;-
164-
165 // OpenGL 3.0-
166 GenerateMipmap = ::glGenerateMipmap;-
167-
168 // OpenGL 3.2-
169 TexImage3DMultisample = 0;-
170 TexImage2DMultisample = 0;-
171-
172 // OpenGL 4.2-
173 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
174 if (ctx->format().majorVersion() >= 3) {-
175 // OpenGL ES 3.0+ has immutable storage for 2D and 3D at least.-
176 QOpenGLExtraFunctionsPrivate *extra = static_cast<QOpenGLExtensions *>(context->extraFunctions())->d();-
177 TexStorage3D = extra->f.TexStorage3D;-
178 TexStorage2D = extra->f.TexStorage2D;-
179 } else {-
180 TexStorage3D = 0;-
181 TexStorage2D = 0;-
182 }-
183 TexStorage1D = 0;-
184-
185 // OpenGL 4.3-
186 TexStorage3DMultisample = 0;-
187 TexStorage2DMultisample = 0;-
188 TexBufferRange = 0;-
189 TextureView = 0;-
190-
191#endif-
192-
193 if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
never executed: return ba;
context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
context->hasEx...turn ba; }()))Description
TRUEnever evaluated
FALSEnever evaluated
0
194 TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress("glTexImage3DOES"));-
195 TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress("glTexSubImage3DOES"));-
196 CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress("glCompressedTexImage3DOES"));-
197 CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(context->getProcAddress("glCompressedTexSubImage3DOES"));-
198 } else {
never executed: end of block
0
199 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
200 if (ctx->isOpenGLES() && ctx->format().majorVersion() >= 3) {
ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
ctx->format()....Version() >= 3Description
TRUEnever evaluated
FALSEnever evaluated
0
201 // OpenGL ES 3.0+ has glTexImage3D.-
202 QOpenGLExtraFunctionsPrivate *extra = static_cast<QOpenGLExtensions *>(context->extraFunctions())->d();-
203 TexImage3D = extra->f.TexImage3D;-
204 TexSubImage3D = extra->f.TexSubImage3D;-
205 CompressedTexImage3D = extra->f.CompressedTexImage3D;-
206 CompressedTexSubImage3D = extra->f.CompressedTexSubImage3D;-
207 } else {
never executed: end of block
0
208 // OpenGL 1.2-
209 TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage3D"));-
210 TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage3D"));-
211-
212 // OpenGL 1.3-
213 CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage3D"));-
214 CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage3D"));-
215 }
never executed: end of block
0
216 }-
217-
218#ifndef QT_OPENGL_ES_2-
219 // OpenGL 1.0 and 1.1-
220 TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage1D"));-
221 TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage1D"));\-
222-
223 // OpenGL 1.3-
224 GetCompressedTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLvoid *)>(context->getProcAddress("glGetCompressedTexImage"));-
225 CompressedTexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage1D"));-
226 CompressedTexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage2D"));-
227 CompressedTexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage1D"));-
228 CompressedTexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage2D"));-
229 ActiveTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress("glActiveTexture"));-
230-
231 // OpenGL 3.0-
232 GenerateMipmap = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress("glGenerateMipmap"));-
233-
234 // OpenGL 3.2-
235 TexImage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexImage3DMultisample"));-
236 TexImage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexImage2DMultisample"));-
237-
238 // OpenGL 4.2-
239 TexStorage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress("glTexStorage3D"));-
240 TexStorage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress("glTexStorage2D"));-
241 TexStorage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress("glTexStorage1D"));-
242-
243 // OpenGL 4.3-
244 TexStorage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexStorage3DMultisample"));-
245 TexStorage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexStorage2DMultisample"));-
246 TexBufferRange = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLuint , GLintptr , GLsizeiptr )>(context->getProcAddress("glTexBufferRange"));-
247 TextureView = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLuint , GLenum , GLuint , GLuint , GLuint , GLuint )>(context->getProcAddress("glTextureView"));-
248#endif-
249}
never executed: end of block
0
250-
251void QOpenGLTextureHelper::dsa_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)-
252{-
253 Q_UNUSED(bindingTarget);-
254 TextureParameteriEXT(texture, target, pname, param);-
255}
never executed: end of block
0
256-
257void QOpenGLTextureHelper::dsa_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params)-
258{-
259 Q_UNUSED(bindingTarget);-
260 TextureParameterivEXT(texture, target, pname, params);-
261}
never executed: end of block
0
262-
263void QOpenGLTextureHelper::dsa_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param)-
264{-
265 Q_UNUSED(bindingTarget);-
266 TextureParameterfEXT(texture, target, pname, param);-
267}
never executed: end of block
0
268-
269void QOpenGLTextureHelper::dsa_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params)-
270{-
271 Q_UNUSED(bindingTarget);-
272 TextureParameterfvEXT(texture, target, pname, params);-
273}
never executed: end of block
0
274-
275void QOpenGLTextureHelper::dsa_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget)-
276{-
277 Q_UNUSED(bindingTarget);-
278 GenerateTextureMipmapEXT(texture, target);-
279}
never executed: end of block
0
280-
281void QOpenGLTextureHelper::dsa_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)-
282{-
283 Q_UNUSED(bindingTarget);-
284 TextureStorage3DEXT(texture, target, levels, internalFormat, width, height, depth);-
285}
never executed: end of block
0
286-
287void QOpenGLTextureHelper::dsa_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)-
288{-
289 Q_UNUSED(bindingTarget);-
290 TextureStorage2DEXT(texture, target, levels, internalFormat, width, height);-
291}
never executed: end of block
0
292-
293void QOpenGLTextureHelper::dsa_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width)-
294{-
295 Q_UNUSED(bindingTarget);-
296 TextureStorage1DEXT(texture, target, levels, internalFormat, width);-
297}
never executed: end of block
0
298-
299void QOpenGLTextureHelper::dsa_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)-
300{-
301 Q_UNUSED(bindingTarget);-
302 TextureStorage3DMultisampleEXT(texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations);-
303}
never executed: end of block
0
304-
305void QOpenGLTextureHelper::dsa_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)-
306{-
307 Q_UNUSED(bindingTarget);-
308 TextureStorage2DMultisampleEXT(texture, target, samples, internalFormat, width, height, fixedSampleLocations);-
309}
never executed: end of block
0
310-
311void QOpenGLTextureHelper::dsa_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)-
312{-
313 Q_UNUSED(bindingTarget);-
314 TextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, format, type, pixels);-
315}
never executed: end of block
0
316-
317void QOpenGLTextureHelper::dsa_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)-
318{-
319 Q_UNUSED(bindingTarget);-
320 TextureImage2DEXT(texture, target, level, internalFormat, width, height, border, format, type, pixels);-
321}
never executed: end of block
0
322-
323void QOpenGLTextureHelper::dsa_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)-
324{-
325 Q_UNUSED(bindingTarget);-
326 TextureImage1DEXT(texture, target, level, internalFormat, width, border, format, type, pixels);-
327}
never executed: end of block
0
328-
329void QOpenGLTextureHelper::dsa_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)-
330{-
331 Q_UNUSED(bindingTarget);-
332 TextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);-
333}
never executed: end of block
0
334-
335void QOpenGLTextureHelper::dsa_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)-
336{-
337 Q_UNUSED(bindingTarget);-
338 TextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, type, pixels);-
339}
never executed: end of block
0
340-
341void QOpenGLTextureHelper::dsa_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)-
342{-
343 Q_UNUSED(bindingTarget);-
344 TextureSubImage1DEXT(texture, target, level, xoffset, width, format, type, pixels);-
345}
never executed: end of block
0
346-
347void QOpenGLTextureHelper::dsa_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)-
348{-
349 Q_UNUSED(bindingTarget);-
350 TextureImage3DMultisampleNV(texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations);-
351}
never executed: end of block
0
352-
353void QOpenGLTextureHelper::dsa_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)-
354{-
355 Q_UNUSED(bindingTarget);-
356 TextureImage2DMultisampleNV(texture, target, samples, internalFormat, width, height, fixedSampleLocations);-
357}
never executed: end of block
0
358-
359void QOpenGLTextureHelper::dsa_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits)-
360{-
361 Q_UNUSED(bindingTarget);-
362 CompressedTextureSubImage1DEXT(texture, target, level, xoffset, width, format, imageSize, bits);-
363}
never executed: end of block
0
364-
365void QOpenGLTextureHelper::dsa_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits)-
366{-
367 Q_UNUSED(bindingTarget);-
368 CompressedTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, imageSize, bits);-
369}
never executed: end of block
0
370-
371void QOpenGLTextureHelper::dsa_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits)-
372{-
373 Q_UNUSED(bindingTarget);-
374 CompressedTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);-
375}
never executed: end of block
0
376-
377void QOpenGLTextureHelper::dsa_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits)-
378{-
379 Q_UNUSED(bindingTarget);-
380 CompressedTextureImage1DEXT(texture, target, level, internalFormat, width, border, imageSize, bits);-
381}
never executed: end of block
0
382-
383void QOpenGLTextureHelper::dsa_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits)-
384{-
385 Q_UNUSED(bindingTarget);-
386 CompressedTextureImage2DEXT(texture, target, level, internalFormat, width, height, border, imageSize, bits);-
387}
never executed: end of block
0
388-
389void QOpenGLTextureHelper::dsa_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits)-
390{-
391 Q_UNUSED(bindingTarget);-
392 CompressedTextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, imageSize, bits);-
393}
never executed: end of block
0
394-
395namespace {-
396-
397class TextureBinder-
398{-
399public:-
400 TextureBinder(QOpenGLFunctions *functions, GLuint texture, GLenum target, GLenum bindingTarget)-
401 : m_functions(functions)-
402 {-
403 // For cubemaps we can't use the standard DSA emulation as it is illegal to-
404 // try to bind a texture to one of the cubemap face targets. So we force the-
405 // target and binding target to the cubemap values in this case.-
406 switch (target) {-
407 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
never executed: case 0x8516:
0
408 case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
never executed: case 0x8515:
0
409 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
never executed: case 0x8518:
0
410 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
never executed: case 0x8517:
0
411 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
never executed: case 0x851A:
0
412 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
never executed: case 0x8519:
0
413 bindingTarget = GL_TEXTURE_BINDING_CUBE_MAP;-
414 m_target = GL_TEXTURE_CUBE_MAP;-
415 break;
never executed: break;
0
416-
417 default:
never executed: default:
0
418 m_target = target;-
419 break;
never executed: break;
0
420 }-
421-
422 m_functions->glGetIntegerv(bindingTarget, &m_oldTexture);-
423 m_functions->glBindTexture(m_target, texture);-
424 }
never executed: end of block
0
425-
426 ~TextureBinder()-
427 {-
428 m_functions->glBindTexture(m_target, m_oldTexture);-
429 }
never executed: end of block
0
430-
431private:-
432 QOpenGLFunctions *m_functions;-
433 GLenum m_target;-
434 GLint m_oldTexture;-
435};-
436-
437} // namespace-
438-
439void QOpenGLTextureHelper::qt_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)-
440{-
441 TextureBinder binder(functions, texture, target, bindingTarget);-
442 functions->glTexParameteri(target, pname, param);-
443}
never executed: end of block
0
444-
445void QOpenGLTextureHelper::qt_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params)-
446{-
447 TextureBinder binder(functions, texture, target, bindingTarget);-
448 functions->glTexParameteriv(target, pname, params);-
449}
never executed: end of block
0
450-
451void QOpenGLTextureHelper::qt_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param)-
452{-
453 TextureBinder binder(functions, texture, target, bindingTarget);-
454 functions->glTexParameterf(target, pname, param);-
455}
never executed: end of block
0
456-
457void QOpenGLTextureHelper::qt_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params)-
458{-
459 TextureBinder binder(functions, texture, target, bindingTarget);-
460 functions->glTexParameterfv(target, pname, params);-
461}
never executed: end of block
0
462-
463void QOpenGLTextureHelper::qt_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget)-
464{-
465 TextureBinder binder(functions, texture, target, bindingTarget);-
466 functions->glGenerateMipmap(target);-
467}
never executed: end of block
0
468-
469void QOpenGLTextureHelper::qt_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)-
470{-
471 TextureBinder binder(functions, texture, target, bindingTarget);-
472 glTexStorage3D(target, levels, internalFormat, width, height, depth);-
473}
never executed: end of block
0
474-
475void QOpenGLTextureHelper::qt_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)-
476{-
477 TextureBinder binder(functions, texture, target, bindingTarget);-
478 glTexStorage2D(target, levels, internalFormat, width, height);-
479}
never executed: end of block
0
480-
481void QOpenGLTextureHelper::qt_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width)-
482{-
483 TextureBinder binder(functions, texture, target, bindingTarget);-
484 glTexStorage1D(target, levels, internalFormat, width);-
485}
never executed: end of block
0
486-
487void QOpenGLTextureHelper::qt_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)-
488{-
489 TextureBinder binder(functions, texture, target, bindingTarget);-
490 glTexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);-
491}
never executed: end of block
0
492-
493void QOpenGLTextureHelper::qt_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)-
494{-
495 TextureBinder binder(functions, texture, target, bindingTarget);-
496 glTexStorage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);-
497}
never executed: end of block
0
498-
499void QOpenGLTextureHelper::qt_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)-
500{-
501 TextureBinder binder(functions, texture, target, bindingTarget);-
502 glTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels);-
503}
never executed: end of block
0
504-
505void QOpenGLTextureHelper::qt_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)-
506{-
507 TextureBinder binder(functions, texture, target, bindingTarget);-
508 functions->glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);-
509}
never executed: end of block
0
510-
511void QOpenGLTextureHelper::qt_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)-
512{-
513 TextureBinder binder(functions, texture, target, bindingTarget);-
514 glTexImage1D(target, level, internalFormat, width, border, format, type, pixels);-
515}
never executed: end of block
0
516-
517void QOpenGLTextureHelper::qt_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)-
518{-
519 TextureBinder binder(functions, texture, target, bindingTarget);-
520 glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);-
521}
never executed: end of block
0
522-
523void QOpenGLTextureHelper::qt_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)-
524{-
525 TextureBinder binder(functions, texture, target, bindingTarget);-
526 functions->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);-
527}
never executed: end of block
0
528-
529void QOpenGLTextureHelper::qt_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)-
530{-
531 TextureBinder binder(functions, texture, target, bindingTarget);-
532 glTexSubImage1D(target, level, xoffset, width, format, type, pixels);-
533}
never executed: end of block
0
534-
535void QOpenGLTextureHelper::qt_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)-
536{-
537 TextureBinder binder(functions, texture, target, bindingTarget);-
538 glTexImage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);-
539}
never executed: end of block
0
540-
541void QOpenGLTextureHelper::qt_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)-
542{-
543 TextureBinder binder(functions, texture, target, bindingTarget);-
544 glTexImage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);-
545}
never executed: end of block
0
546-
547void QOpenGLTextureHelper::qt_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits)-
548{-
549 TextureBinder binder(functions, texture, target, bindingTarget);-
550 glCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, bits);-
551}
never executed: end of block
0
552-
553void QOpenGLTextureHelper::qt_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits)-
554{-
555 TextureBinder binder(functions, texture, target, bindingTarget);-
556 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, bits);-
557}
never executed: end of block
0
558-
559void QOpenGLTextureHelper::qt_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits)-
560{-
561 TextureBinder binder(functions, texture, target, bindingTarget);-
562 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);-
563}
never executed: end of block
0
564-
565void QOpenGLTextureHelper::qt_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits)-
566{-
567 TextureBinder binder(functions, texture, target, bindingTarget);-
568 glCompressedTexImage1D(target, level, internalFormat, width, border, imageSize, bits);-
569}
never executed: end of block
0
570-
571void QOpenGLTextureHelper::qt_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits)-
572{-
573 TextureBinder binder(functions, texture, target, bindingTarget);-
574 glCompressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, bits);-
575}
never executed: end of block
0
576-
577void QOpenGLTextureHelper::qt_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits)-
578{-
579 TextureBinder binder(functions, texture, target, bindingTarget);-
580 glCompressedTexImage3D(target, level, internalFormat, width, height, depth, border, imageSize, bits);-
581}
never executed: end of block
0
582-
583QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9