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 #ifndef QOPENGLTEXTUREHELPER_P_H 41 #define QOPENGLTEXTUREHELPER_P_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 purely as an 48 // implementation detail. 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 <QtGui/private/qtguiglobal_p.h> 55 56 #ifndef QT_NO_OPENGL 57 58 #include "qopengl.h" 59 #include "qopenglpixeltransferoptions.h" 60 #include "qopengltexture.h" 61 #include "qopenglfunctions.h" 62 63 QT_BEGIN_NAMESPACE 64 65 // Constants for OpenGL and OpenGL ES 3.0+ which are not available with OpenGL ES 2.0. 66 #ifndef GL_TEXTURE_BASE_LEVEL 67 #define GL_TEXTURE_BASE_LEVEL 0x813C 68 #endif 69 #ifndef GL_TEXTURE_MAX_LEVEL 70 #define GL_TEXTURE_MAX_LEVEL 0x813D 71 #endif 72 #ifndef GL_TEXTURE_COMPARE_MODE 73 #define GL_TEXTURE_COMPARE_MODE 0x884C 74 #endif 75 #ifndef GL_TEXTURE_COMPARE_FUNC 76 #define GL_TEXTURE_COMPARE_FUNC 0x884D 77 #endif 78 79 // use GL_APICALL only on Android + __clang__ 80 #if !defined(Q_OS_ANDROID) || !defined(__clang__) 81 # undef GL_APICALL 82 # define GL_APICALL 83 #elif !defined(GL_APICALL) 84 # define GL_APICALL 85 #endif 86 87 class QOpenGLContext; 88 89 class QOpenGLTextureHelper 90 { 91 public: 92 QOpenGLTextureHelper(QOpenGLContext *context); 93 94 // DSA-like API. Will either use real DSA or our emulation glTextureParameteri(GLuint texture,GLenum target,GLenum bindingTarget,GLenum pname,GLint param)95 inline void glTextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param) 96 { 97 (this->*TextureParameteri)(texture, target, bindingTarget, pname, param); 98 } 99 glTextureParameteriv(GLuint texture,GLenum target,GLenum bindingTarget,GLenum pname,const GLint * params)100 inline void glTextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params) 101 { 102 (this->*TextureParameteriv)(texture, target, bindingTarget, pname, params); 103 } 104 glTextureParameterf(GLuint texture,GLenum target,GLenum bindingTarget,GLenum pname,GLfloat param)105 inline void glTextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param) 106 { 107 (this->*TextureParameterf)(texture, target, bindingTarget, pname, param); 108 } 109 glTextureParameterfv(GLuint texture,GLenum target,GLenum bindingTarget,GLenum pname,const GLfloat * params)110 inline void glTextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params) 111 { 112 (this->*TextureParameterfv)(texture, target, bindingTarget, pname, params); 113 } 114 glGenerateTextureMipmap(GLuint texture,GLenum target,GLenum bindingTarget)115 inline void glGenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget) 116 { 117 (this->*GenerateTextureMipmap)(texture, target, bindingTarget); 118 } 119 glTextureStorage3D(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth)120 inline void glTextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, 121 GLsizei width, GLsizei height, GLsizei depth) 122 { 123 (this->*TextureStorage3D)(texture, target, bindingTarget, levels, internalFormat, width, height, depth); 124 } 125 glTextureStorage2D(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height)126 inline void glTextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, 127 GLsizei width, GLsizei height) 128 { 129 (this->*TextureStorage2D)(texture, target, bindingTarget, levels, internalFormat, width, height); 130 } 131 glTextureStorage1D(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei levels,GLenum internalFormat,GLsizei width)132 inline void glTextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, 133 GLsizei width) 134 { 135 (this->*TextureStorage1D)(texture, target, bindingTarget, levels, internalFormat, width); 136 } 137 glTextureStorage3DMultisample(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations)138 inline void glTextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, 139 GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) 140 { 141 (this->*TextureStorage3DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, depth, fixedSampleLocations); 142 } 143 glTextureStorage2DMultisample(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations)144 inline void glTextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, 145 GLsizei width, GLsizei height, GLboolean fixedSampleLocations) 146 { 147 (this->*TextureStorage2DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, fixedSampleLocations); 148 } 149 glTextureImage3D(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)150 inline void glTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 151 GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) 152 { 153 (this->*TextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, format, type, pixels); 154 } 155 glTextureImage2D(GLuint texture,GLenum target,GLenum bindingTarget,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)156 inline void glTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 157 GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) 158 { 159 (this->*TextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, format, type, pixels); 160 } 161 glTextureImage1D(GLuint texture,GLenum target,GLenum bindingTarget,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)162 inline void glTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 163 GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) 164 { 165 (this->*TextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, format, type, pixels); 166 } 167 168 inline void glTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 169 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 170 const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr) 171 { 172 if (options) { 173 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 174 setPixelUploadOptions(*options); 175 (this->*TextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); 176 setPixelUploadOptions(oldOptions); 177 } else { 178 (this->*TextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); 179 } 180 } 181 182 inline void glTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, 183 GLsizei width, GLsizei height, GLenum format, GLenum type, 184 const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr) 185 { 186 if (options) { 187 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 188 setPixelUploadOptions(*options); 189 (this->*TextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, type, pixels); 190 setPixelUploadOptions(oldOptions); 191 } else { 192 (this->*TextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, type, pixels); 193 } 194 } 195 196 inline void glTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, 197 GLsizei width, GLenum format, GLenum type, 198 const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr) 199 { 200 if (options) { 201 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 202 setPixelUploadOptions(*options); 203 (this->*TextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, type, pixels); 204 setPixelUploadOptions(oldOptions); 205 } else { 206 (this->*TextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, type, pixels); 207 } 208 } 209 glTextureImage3DMultisample(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei samples,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations)210 inline void glTextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, 211 GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) 212 { 213 (this->*TextureImage3DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, depth, fixedSampleLocations); 214 } 215 glTextureImage2DMultisample(GLuint texture,GLenum target,GLenum bindingTarget,GLsizei samples,GLint internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations)216 inline void glTextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, 217 GLsizei width, GLsizei height, GLboolean fixedSampleLocations) 218 { 219 (this->*TextureImage2DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, fixedSampleLocations); 220 } 221 222 inline void glCompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 223 GLint xoffset, GLsizei width, 224 GLenum format, GLsizei imageSize, const GLvoid *bits, 225 const QOpenGLPixelTransferOptions * const options = nullptr) 226 { 227 if (options) { 228 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 229 setPixelUploadOptions(*options); 230 (this->*CompressedTextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, imageSize, bits); 231 setPixelUploadOptions(oldOptions); 232 } else { 233 (this->*CompressedTextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, imageSize, bits); 234 } 235 } 236 237 inline void glCompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 238 GLint xoffset, GLint yoffset, 239 GLsizei width, GLsizei height, 240 GLenum format, GLsizei imageSize, const GLvoid *bits, 241 const QOpenGLPixelTransferOptions * const options = nullptr) 242 { 243 if (options) { 244 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 245 setPixelUploadOptions(*options); 246 (this->*CompressedTextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, imageSize, bits); 247 setPixelUploadOptions(oldOptions); 248 } else { 249 (this->*CompressedTextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, imageSize, bits); 250 } 251 } 252 253 inline void glCompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 254 GLint xoffset, GLint yoffset, GLint zoffset, 255 GLsizei width, GLsizei height, GLsizei depth, 256 GLenum format, GLsizei imageSize, const GLvoid *bits, 257 const QOpenGLPixelTransferOptions * const options = nullptr) 258 { 259 if (options) { 260 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 261 setPixelUploadOptions(*options); 262 (this->*CompressedTextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits); 263 setPixelUploadOptions(oldOptions); 264 } else { 265 (this->*CompressedTextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits); 266 } 267 } 268 269 inline void glCompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 270 GLenum internalFormat, GLsizei width, 271 GLint border, GLsizei imageSize, const GLvoid *bits, 272 const QOpenGLPixelTransferOptions * const options = nullptr) 273 { 274 if (options) { 275 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 276 setPixelUploadOptions(*options); 277 (this->*CompressedTextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, imageSize, bits); 278 setPixelUploadOptions(oldOptions); 279 } else { 280 (this->*CompressedTextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, imageSize, bits); 281 } 282 } 283 284 inline void glCompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 285 GLenum internalFormat, GLsizei width, GLsizei height, 286 GLint border, GLsizei imageSize, const GLvoid *bits, 287 const QOpenGLPixelTransferOptions * const options = nullptr) 288 289 { 290 if (options) { 291 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 292 setPixelUploadOptions(*options); 293 (this->*CompressedTextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, imageSize, bits); 294 setPixelUploadOptions(oldOptions); 295 } else { 296 (this->*CompressedTextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, imageSize, bits); 297 } 298 } 299 300 inline void glCompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 301 GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, 302 GLint border, GLsizei imageSize, const GLvoid *bits, 303 const QOpenGLPixelTransferOptions * const options = nullptr) 304 { 305 if (options) { 306 QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions(); 307 setPixelUploadOptions(*options); 308 (this->*CompressedTextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, imageSize, bits); 309 setPixelUploadOptions(oldOptions); 310 } else { 311 (this->*CompressedTextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, imageSize, bits); 312 } 313 } 314 315 private: 316 // DSA wrapper (so we can use pointer to member function as switch) 317 void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param); 318 319 void dsa_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params); 320 321 void dsa_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param); 322 323 void dsa_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params); 324 325 void dsa_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget); 326 327 void dsa_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, 328 GLsizei width, GLsizei height, GLsizei depth); 329 330 void dsa_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, 331 GLsizei width, GLsizei height); 332 333 void dsa_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, 334 GLsizei width); 335 336 void dsa_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, 337 GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 338 339 void dsa_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, 340 GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 341 342 void dsa_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 343 GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 344 345 void dsa_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 346 GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 347 348 void dsa_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 349 GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 350 351 void dsa_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 352 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); 353 354 void dsa_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, 355 GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); 356 357 void dsa_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, 358 GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); 359 360 void dsa_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, 361 GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 362 363 void dsa_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, 364 GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 365 366 void dsa_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 367 GLint xoffset, GLsizei width, 368 GLenum format, GLsizei imageSize, const GLvoid *bits); 369 370 void dsa_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 371 GLint xoffset, GLint yoffset, 372 GLsizei width, GLsizei height, 373 GLenum format, GLsizei imageSize, const GLvoid *bits); 374 375 void dsa_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 376 GLint xoffset, GLint yoffset, GLint zoffset, 377 GLsizei width, GLsizei height, GLsizei depth, 378 GLenum format, GLsizei imageSize, const GLvoid *bits); 379 380 void dsa_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 381 GLenum internalFormat, GLsizei width, 382 GLint border, GLsizei imageSize, const GLvoid *bits); 383 384 void dsa_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 385 GLenum internalFormat, GLsizei width, GLsizei height, 386 GLint border, GLsizei imageSize, const GLvoid *bits); 387 388 void dsa_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 389 GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, 390 GLint border, GLsizei imageSize, const GLvoid *bits); 391 392 // DSA emulation API 393 void qt_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param); 394 395 void qt_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params); 396 397 void qt_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param); 398 399 void qt_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params); 400 401 void qt_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget); 402 403 void qt_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, 404 GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); 405 406 void qt_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, 407 GLenum internalFormat, GLsizei width, GLsizei height); 408 409 void qt_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, 410 GLenum internalFormat, GLsizei width); 411 412 void qt_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, 413 GLenum internalFormat, GLsizei width, GLsizei height, 414 GLsizei depth, GLboolean fixedSampleLocations); 415 416 void qt_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, 417 GLenum internalFormat, GLsizei width, GLsizei height, 418 GLboolean fixedSampleLocations); 419 420 void qt_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 421 GLsizei width, GLsizei height, GLsizei depth, 422 GLint border, GLenum format, GLenum type, 423 const GLvoid *pixels); 424 425 void qt_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 426 GLsizei width, GLsizei height, 427 GLint border, GLenum format, GLenum type, 428 const GLvoid *pixels); 429 430 void qt_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 431 GLsizei width, GLint border, GLenum format, GLenum type, 432 const GLvoid *pixels); 433 434 void qt_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 435 GLint xoffset, GLint yoffset, GLint zoffset, 436 GLsizei width, GLsizei height, GLsizei depth, 437 GLenum format, GLenum type, const GLvoid *pixels); 438 439 void qt_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 440 GLint xoffset, GLint yoffset, 441 GLsizei width, GLsizei height, 442 GLenum format, GLenum type, const GLvoid *pixels); 443 444 void qt_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 445 GLint xoffset, GLsizei width, 446 GLenum format, GLenum type, const GLvoid *pixels); 447 448 void qt_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, 449 GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, 450 GLboolean fixedSampleLocations); 451 452 void qt_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, 453 GLint internalFormat, GLsizei width, GLsizei height, 454 GLboolean fixedSampleLocations); 455 456 void qt_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 457 GLint xoffset, GLsizei width, GLenum format, 458 GLsizei imageSize, const GLvoid *bits); 459 460 void qt_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 461 GLint xoffset, GLint yoffset, 462 GLsizei width, GLsizei height, 463 GLenum format, GLsizei imageSize, const GLvoid *bits); 464 465 void qt_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, 466 GLint xoffset, GLint yoffset, GLint zoffset, 467 GLsizei width, GLsizei height, GLsizei depth, 468 GLenum format, GLsizei imageSize, const GLvoid *bits); 469 470 void qt_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 471 GLsizei width, GLint border, 472 GLsizei imageSize, const GLvoid *bits); 473 474 void qt_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 475 GLsizei width, GLsizei height, GLint border, 476 GLsizei imageSize, const GLvoid *bits); 477 478 void qt_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, 479 GLsizei width, GLsizei height, GLsizei depth, GLint border, 480 GLsizei imageSize, const GLvoid *bits); 481 482 public: 483 // Raw OpenGL functions, resolved and used by our DSA-like static functions if no EXT_direct_state_access is available 484 485 // OpenGL 1.0 glTexImage1D(GLenum target,GLint level,GLint internalFormat,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)486 inline void glTexImage1D(GLenum target, GLint level, GLint internalFormat, 487 GLsizei width, GLint border, 488 GLenum format, GLenum type, const GLvoid *pixels) 489 { 490 TexImage1D(target, level, internalFormat, width, border, format, type, pixels); 491 } 492 493 // OpenGL 1.1 glTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)494 inline void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, 495 GLenum format, GLenum type, const GLvoid *pixels) 496 { 497 TexSubImage1D(target, level, xoffset, width, format, type, pixels); 498 } 499 500 // OpenGL 1.2 glTexImage3D(GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const GLvoid * pixels)501 inline void glTexImage3D(GLenum target, GLint level, GLint internalFormat, 502 GLsizei width, GLsizei height, GLsizei depth, GLint border, 503 GLenum format, GLenum type, const GLvoid *pixels) 504 { 505 TexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels); 506 } 507 glTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * pixels)508 inline void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 509 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) 510 { 511 TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); 512 } 513 514 // OpenGL 1.3 glGetCompressedTexImage(GLenum target,GLint level,GLvoid * img)515 inline void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img) 516 { 517 GetCompressedTexImage(target, level, img); 518 } 519 glCompressedTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)520 inline void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, 521 GLenum format, GLsizei imageSize, const GLvoid *data) 522 { 523 CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data); 524 } 525 glCompressedTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)526 inline void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 527 GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) 528 { 529 CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); 530 } 531 glCompressedTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)532 inline void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 533 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) 534 { 535 CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); 536 } 537 glCompressedTexImage1D(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)538 inline void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, 539 GLint border, GLsizei imageSize, const GLvoid *data) 540 { 541 CompressedTexImage1D(target, level, internalFormat, width, border, imageSize, data); 542 } 543 glCompressedTexImage2D(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)544 inline void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, 545 GLint border, GLsizei imageSize, const GLvoid *data) 546 { 547 CompressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data); 548 } 549 glCompressedTexImage3D(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)550 inline void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat, 551 GLsizei width, GLsizei height, GLsizei depth, 552 GLint border, GLsizei imageSize, const GLvoid *data) 553 { 554 CompressedTexImage3D(target, level, internalFormat, width, height, depth, border, imageSize, data); 555 } 556 glActiveTexture(GLenum texture)557 inline void glActiveTexture(GLenum texture) 558 { 559 ActiveTexture(texture); 560 } 561 562 // OpenGL 3.0 glGenerateMipmap(GLenum target)563 inline void glGenerateMipmap(GLenum target) 564 { 565 GenerateMipmap(target); 566 } 567 568 // OpenGL 3.2 glTexImage3DMultisample(GLenum target,GLsizei samples,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations)569 inline void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalFormat, 570 GLsizei width, GLsizei height, GLsizei depth, 571 GLboolean fixedSampleLocations) 572 { 573 TexImage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations); 574 } 575 glTexImage2DMultisample(GLenum target,GLsizei samples,GLint internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations)576 inline void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalFormat, 577 GLsizei width, GLsizei height, 578 GLboolean fixedSampleLocations) 579 { 580 TexImage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations); 581 } 582 583 // OpenGL 4.2 glTexStorage3D(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth)584 inline void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth) 585 { 586 TexStorage3D(target, levels, internalFormat, width, height, depth); 587 } 588 glTexStorage2D(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height)589 inline void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height) 590 { 591 TexStorage2D(target, levels, internalFormat, width, height); 592 } 593 glTexStorage1D(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width)594 inline void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width) 595 { 596 TexStorage1D(target, levels, internalFormat, width); 597 } 598 599 // OpenGL 4.3 glTexStorage3DMultisample(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations)600 inline void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalFormat, 601 GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations) 602 { 603 TexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations); 604 } 605 glTexStorage2DMultisample(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations)606 inline void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalFormat, 607 GLsizei width, GLsizei height, GLboolean fixedSampleLocations) 608 { 609 TexStorage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations); 610 } 611 glTexBufferRange(GLenum target,GLenum internalFormat,GLuint buffer,GLintptr offset,GLsizeiptr size)612 inline void glTexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, 613 GLintptr offset, GLsizeiptr size) 614 { 615 TexBufferRange(target, internalFormat, buffer, offset, size); 616 } 617 glTextureView(GLuint texture,GLenum target,GLuint origTexture,GLenum internalFormat,GLuint minLevel,GLuint numLevels,GLuint minLayer,GLuint numLayers)618 inline void glTextureView(GLuint texture, GLenum target, GLuint origTexture, GLenum internalFormat, 619 GLuint minLevel, GLuint numLevels, GLuint minLayer, GLuint numLayers) 620 { 621 TextureView(texture, target, origTexture, internalFormat, minLevel, numLevels, minLayer, numLayers); 622 } 623 624 // Helper functions savePixelUploadOptions()625 inline QOpenGLPixelTransferOptions savePixelUploadOptions() 626 { 627 QOpenGLPixelTransferOptions options; 628 int val = 0; 629 functions->glGetIntegerv(GL_UNPACK_ALIGNMENT, &val); 630 options.setAlignment(val); 631 #if !defined(QT_OPENGL_ES_2) 632 functions->glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &val); 633 options.setSkipImages(val); 634 functions->glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val); 635 options.setSkipRows(val); 636 functions->glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &val); 637 options.setSkipPixels(val); 638 functions->glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &val); 639 options.setImageHeight(val); 640 functions->glGetIntegerv(GL_UNPACK_ROW_LENGTH, &val); 641 options.setRowLength(val); 642 GLboolean b = GL_FALSE; 643 functions->glGetBooleanv(GL_UNPACK_LSB_FIRST, &b); 644 options.setLeastSignificantByteFirst(b); 645 functions->glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b); 646 options.setSwapBytesEnabled(b); 647 #endif 648 return options; 649 } 650 setPixelUploadOptions(const QOpenGLPixelTransferOptions & options)651 inline void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options) 652 { 653 functions->glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment()); 654 #if !defined(QT_OPENGL_ES_2) 655 functions->glPixelStorei(GL_UNPACK_SKIP_IMAGES, options.skipImages()); 656 functions->glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows()); 657 functions->glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels()); 658 functions->glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, options.imageHeight()); 659 functions->glPixelStorei(GL_UNPACK_ROW_LENGTH, options.rowLength()); 660 functions->glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst()); 661 functions->glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled()); 662 #endif 663 } 664 665 QOpenGLFunctions *functions; 666 private: 667 // Typedefs and pointers to member functions used to switch between EXT_direct_state_access and our own emulated DSA. 668 // The argument match the corresponding GL function, but there's an extra "GLenum bindingTarget" which gets used with 669 // the DSA emulation -- it contains the right GL_BINDING_TEXTURE_X to use. 670 typedef void (QOpenGLTextureHelper::*TextureParameteriMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param); 671 typedef void (QOpenGLTextureHelper::*TextureParameterivMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params); 672 typedef void (QOpenGLTextureHelper::*TextureParameterfMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param); 673 typedef void (QOpenGLTextureHelper::*TextureParameterfvMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params); 674 typedef void (QOpenGLTextureHelper::*GenerateTextureMipmapMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget); 675 typedef void (QOpenGLTextureHelper::*TextureStorage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); 676 typedef void (QOpenGLTextureHelper::*TextureStorage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); 677 typedef void (QOpenGLTextureHelper::*TextureStorage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width); 678 typedef void (QOpenGLTextureHelper::*TextureStorage3DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 679 typedef void (QOpenGLTextureHelper::*TextureStorage2DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 680 typedef void (QOpenGLTextureHelper::*TextureImage3DMemberFunc)(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); 681 typedef void (QOpenGLTextureHelper::*TextureImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 682 typedef void (QOpenGLTextureHelper::*TextureImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 683 typedef void (QOpenGLTextureHelper::*TextureSubImage3DMemberFunc)(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); 684 typedef void (QOpenGLTextureHelper::*TextureSubImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); 685 typedef void (QOpenGLTextureHelper::*TextureSubImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); 686 typedef void (QOpenGLTextureHelper::*TextureImage3DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 687 typedef void (QOpenGLTextureHelper::*TextureImage2DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 688 typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); 689 typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); 690 typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage3DMemberFunc)(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); 691 typedef void (QOpenGLTextureHelper::*CompressedTextureImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); 692 typedef void (QOpenGLTextureHelper::*CompressedTextureImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); 693 typedef void (QOpenGLTextureHelper::*CompressedTextureImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); 694 695 696 TextureParameteriMemberFunc TextureParameteri; 697 TextureParameterivMemberFunc TextureParameteriv; 698 TextureParameterfMemberFunc TextureParameterf; 699 TextureParameterfvMemberFunc TextureParameterfv; 700 GenerateTextureMipmapMemberFunc GenerateTextureMipmap; 701 TextureStorage3DMemberFunc TextureStorage3D; 702 TextureStorage2DMemberFunc TextureStorage2D; 703 TextureStorage1DMemberFunc TextureStorage1D; 704 TextureStorage3DMultisampleMemberFunc TextureStorage3DMultisample; 705 TextureStorage2DMultisampleMemberFunc TextureStorage2DMultisample; 706 TextureImage3DMemberFunc TextureImage3D; 707 TextureImage2DMemberFunc TextureImage2D; 708 TextureImage1DMemberFunc TextureImage1D; 709 TextureSubImage3DMemberFunc TextureSubImage3D; 710 TextureSubImage2DMemberFunc TextureSubImage2D; 711 TextureSubImage1DMemberFunc TextureSubImage1D; 712 TextureImage3DMultisampleMemberFunc TextureImage3DMultisample; 713 TextureImage2DMultisampleMemberFunc TextureImage2DMultisample; 714 CompressedTextureSubImage1DMemberFunc CompressedTextureSubImage1D; 715 CompressedTextureSubImage2DMemberFunc CompressedTextureSubImage2D; 716 CompressedTextureSubImage3DMemberFunc CompressedTextureSubImage3D; 717 CompressedTextureImage1DMemberFunc CompressedTextureImage1D; 718 CompressedTextureImage2DMemberFunc CompressedTextureImage2D; 719 CompressedTextureImage3DMemberFunc CompressedTextureImage3D; 720 721 // Raw function pointers for core and DSA functions 722 723 // EXT_direct_state_access used when DSA is available 724 void (QOPENGLF_APIENTRYP TextureParameteriEXT)(GLuint texture, GLenum target, GLenum pname, GLint param); 725 void (QOPENGLF_APIENTRYP TextureParameterivEXT)(GLuint texture, GLenum target, GLenum pname, const GLint *params); 726 void (QOPENGLF_APIENTRYP TextureParameterfEXT)(GLuint texture, GLenum target, GLenum pname, GLfloat param); 727 void (QOPENGLF_APIENTRYP TextureParameterfvEXT)(GLuint texture, GLenum target, GLenum pname, const GLfloat *params); 728 void (QOPENGLF_APIENTRYP GenerateTextureMipmapEXT)(GLuint texture, GLenum target); 729 void (QOPENGLF_APIENTRYP TextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); 730 void (QOPENGLF_APIENTRYP TextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); 731 void (QOPENGLF_APIENTRYP TextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width); 732 void (QOPENGLF_APIENTRYP TextureStorage3DMultisampleEXT)(GLuint texture, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 733 void (QOPENGLF_APIENTRYP TextureStorage2DMultisampleEXT)(GLuint texture, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 734 void (QOPENGLF_APIENTRYP TextureImage3DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 735 void (QOPENGLF_APIENTRYP TextureImage2DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 736 void (QOPENGLF_APIENTRYP TextureImage1DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 737 void (QOPENGLF_APIENTRYP TextureSubImage3DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); 738 void (QOPENGLF_APIENTRYP TextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); 739 void (QOPENGLF_APIENTRYP TextureSubImage1DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); 740 void (QOPENGLF_APIENTRYP CompressedTextureSubImage1DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); 741 void (QOPENGLF_APIENTRYP CompressedTextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); 742 void (QOPENGLF_APIENTRYP CompressedTextureSubImage3DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); 743 void (QOPENGLF_APIENTRYP CompressedTextureImage1DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); 744 void (QOPENGLF_APIENTRYP CompressedTextureImage2DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); 745 void (QOPENGLF_APIENTRYP CompressedTextureImage3DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); 746 747 748 // Plus some missing ones that are in the NV_texture_multisample extension instead 749 void (QOPENGLF_APIENTRYP TextureImage3DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 750 void (QOPENGLF_APIENTRYP TextureImage2DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 751 752 // OpenGL 1.0 753 void (QOPENGLF_APIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 754 755 // OpenGL 1.1 756 void (QOPENGLF_APIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); 757 758 // OpenGL 1.2 759 void (QOPENGLF_APIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 760 void (QOPENGLF_APIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); 761 762 // OpenGL 1.3 763 void (QOPENGLF_APIENTRYP GetCompressedTexImage)(GLenum target, GLint level, GLvoid *img); 764 void (QOPENGLF_APIENTRYP CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); 765 GL_APICALL void (QOPENGLF_APIENTRYP CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); 766 void (QOPENGLF_APIENTRYP CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); 767 void (QOPENGLF_APIENTRYP CompressedTexImage1D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); 768 GL_APICALL void (QOPENGLF_APIENTRYP CompressedTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); 769 void (QOPENGLF_APIENTRYP CompressedTexImage3D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); 770 GL_APICALL void (QOPENGLF_APIENTRYP ActiveTexture)(GLenum texture); 771 772 // OpenGL 3.0 773 GL_APICALL void (QOPENGLF_APIENTRYP GenerateMipmap)(GLenum target); 774 775 // OpenGL 3.2 776 void (QOPENGLF_APIENTRYP TexImage3DMultisample)(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 777 void (QOPENGLF_APIENTRYP TexImage2DMultisample)(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 778 779 // OpenGL 4.2 780 void (QOPENGLF_APIENTRYP TexStorage3D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); 781 void (QOPENGLF_APIENTRYP TexStorage2D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); 782 void (QOPENGLF_APIENTRYP TexStorage1D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width); 783 784 // OpenGL 4.3 785 void (QOPENGLF_APIENTRYP TexStorage3DMultisample)(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); 786 void (QOPENGLF_APIENTRYP TexStorage2DMultisample)(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); 787 void (QOPENGLF_APIENTRYP TexBufferRange)(GLenum target, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size); 788 void (QOPENGLF_APIENTRYP TextureView)(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); 789 }; 790 791 QT_END_NAMESPACE 792 793 #undef Q_CALL_MEMBER_FUNCTION 794 795 #endif // QT_NO_OPENGL 796 797 #endif // QOPENGLTEXTUREHELPER_P_H 798