summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/opengl/qopengl.h')
-rw-r--r--src/gui/opengl/qopengl.h114
1 files changed, 48 insertions, 66 deletions
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 3a2393ea58..e9a11080ce 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGL_H
#define QOPENGL_H
@@ -44,9 +8,19 @@
#ifndef QT_NO_OPENGL
-// Windows always needs this to ensure that APIENTRY gets defined
+// On Windows we need to ensure that APIENTRY and WINGDIAPI are defined before
+// we can include gl.h. But we do not want to include <windows.h> in this public
+// Qt header, as it pollutes the global namespace with macros.
#if defined(Q_OS_WIN)
-# include <QtCore/qt_windows.h>
+# ifndef APIENTRY
+# define APIENTRY __stdcall
+# define Q_UNDEF_APIENTRY
+# endif // APIENTRY
+# ifndef WINGDIAPI
+# define WINGDIAPI __declspec(dllimport)
+# define Q_UNDEF_WINGDIAPI
+# endif // WINGDIAPI
+# define QT_APIENTRY __stdcall
#endif
// Note: Apple is a "controlled platform" for OpenGL ABI so we
@@ -63,9 +37,9 @@
// access to additional functionality the drivers may expose but
// which the system headers do not.
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
# if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
-# if defined(QT_OPENGL_ES_3)
+# if QT_CONFIG(opengles3)
# include <OpenGLES/ES3/gl.h>
# include <OpenGLES/ES3/glext.h>
# else
@@ -83,7 +57,7 @@ typedef void* GLeglImageOES;
# elif !defined(Q_OS_DARWIN) // "uncontrolled" ES2 platforms
-// In "es2" builds (QT_OPENGL_ES_2) additional defines indicate GLES 3.0 or
+// In "es2" builds (QT_CONFIG(opengles2)) additional defines indicate GLES 3.0 or
// higher is available *at build time*. In this case include the corresponding
// header. These are backwards compatible and it should be safe to include
// headers on top of each other, meaning that applications can include gl2.h
@@ -101,20 +75,20 @@ typedef void* GLeglImageOES;
# define QGL_TEMP_GLEXT_PROTO
# endif
-# if defined(QT_OPENGL_ES_3_2)
+# if QT_CONFIG(opengles32)
# include <GLES3/gl32.h>
-# elif defined(QT_OPENGL_ES_3_1)
+# elif QT_CONFIG(opengles31)
# include <GLES3/gl31.h>
-# elif defined(QT_OPENGL_ES_3)
+# elif QT_CONFIG(opengles3)
# include <GLES3/gl3.h>
# else
# include <GLES2/gl2.h>
-#endif
+# endif
# ifdef QGL_TEMP_GLEXT_PROTO
# undef GL_GLEXT_PROTOTYPES
# undef QGL_TEMP_GLEXT_PROTO
-# endif
+# endif
/*
Some GLES2 implementations (like the one on Harmattan) are missing the
@@ -125,9 +99,9 @@ typedef void* GLeglImageOES;
typedef char GLchar;
# include <QtGui/qopengles2ext.h>
-# endif // Q_OS_MAC
+# endif
#else // non-ES2 platforms
-# if defined(Q_OS_MAC)
+# if defined(Q_OS_MACOS)
# include <OpenGL/gl.h>
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
# include <OpenGL/gl3.h>
@@ -144,11 +118,11 @@ typedef char GLchar;
# include <GL/gl.h>
# endif
# include <QtGui/qopenglext.h>
-# endif // Q_OS_MAC
-#endif // QT_OPENGL_ES_2
+# endif
+#endif // !QT_CONFIG(opengles2)
// Desktops can support OpenGL 4.
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
#define QT_OPENGL_3
#define QT_OPENGL_3_2
#define QT_OPENGL_4
@@ -157,20 +131,18 @@ typedef char GLchar;
# endif
#endif
-QT_BEGIN_NAMESPACE
-
// When all else fails we provide sensible fallbacks - this is needed to
// allow compilation on OS X 10.6
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
// OS X 10.6 doesn't define these which are needed below
-// OS X 10.7 and later defien them in gl3.h
-#ifndef APIENTRY
-#define APIENTRY
+// OS X 10.7 and later define them in gl3.h
+#ifndef QT_APIENTRY
+#define QT_APIENTRY
#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
+#ifndef QT_APIENTRYP
+#define QT_APIENTRYP QT_APIENTRY *
#endif
#ifndef GLAPI
#define GLAPI extern
@@ -269,15 +241,15 @@ struct _cl_event;
#endif
#ifndef GL_ARB_debug_output
-typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
+typedef void (QT_APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
#endif
#ifndef GL_AMD_debug_output
-typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+typedef void (QT_APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
#endif
#ifndef GL_KHR_debug
-typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
+typedef void (QT_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
#endif
#ifndef GL_NV_vdpau_interop
@@ -287,14 +259,15 @@ typedef GLintptr GLvdpauSurfaceNV;
// End of block copied from glext.h
#endif
+QT_BEGIN_NAMESPACE
// Types that aren't defined in all system's gl.h files.
typedef ptrdiff_t qopengl_GLintptr;
typedef ptrdiff_t qopengl_GLsizeiptr;
-#if defined(APIENTRY) && !defined(QOPENGLF_APIENTRY)
-# define QOPENGLF_APIENTRY APIENTRY
+#if defined(QT_APIENTRY) && !defined(QOPENGLF_APIENTRY)
+# define QOPENGLF_APIENTRY QT_APIENTRY
#endif
# ifndef QOPENGLF_APIENTRYP
@@ -308,6 +281,15 @@ typedef ptrdiff_t qopengl_GLsizeiptr;
QT_END_NAMESPACE
+#ifdef Q_UNDEF_WINGDIAPI
+# undef WINGDIAPI
+# undef Q_UNDEF_WINGDIAPI
+#endif
+#ifdef Q_UNDEF_APIENTRY
+# undef APIENTRY
+# undef Q_UNDEF_APIENTRY
+#endif
+
#endif // QT_NO_OPENGL
#endif // QOPENGL_H