OpenGL: Add code generator for OpenGL enabler classes
This patch provides a code generator that can be executed offline to generate a few classes for enhancing Qt's support for OpenGL. The generated code effectively provides all the benefits of GLEW in its multi-context form but for all platforms and even for ES2. The code generator takes as input the official Khronos gl.spec specification and gl.tm typemap files. These provide all of the information required to create the OpenGL Desktop related classes. The classes for ES2 are hand-crafted as no similar spec files have been published. The generated code supports all OpenGL extensions listed in the Khronos registry for both Desktop OpenGL and ES 2. There is a helper factory class generated which are used by QOpenGLContext::versionFunctions(). This allows code like the following to be written: QOpenGLFunctions_3_3_Core* m_funcs = 0; m_funcs = m_context->versionFunctions<QOpenGLFunctions_3_3_Core>(); if (!m_funcs) { qWarning() << "Could not obtain required OpenGL context version"; exit(1); } if (!m_funcs->initializeOpenGLFunctions()) { qWarning() << "Failed to resolve entry points"; exit(2); } // Get an extension object QOpenGLExtension_ARB_draw_buffers* ext = 0; if (m_context->hasExtension("GL_ARB_draw_buffers")) { ext = new QOpenGLExtension_ARB_draw_buffers(); ext->initializeOpenGLFunctions(m_context); } Such usage will allow much easier and rigorous use of features in modern OpenGL and extensions both in Qt itself and by users of Qt. Follow-up patches will import the generated files and then use these to reinstate OpenGL geometry shaders, add tessellation shaders, and other OpenGL constructs. Change-Id: Id0172e8aa1fd57eb4e6979a96d10fb5a34826426 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: James Turner <james.turner@kdab.com>
This commit is contained in:
parent
3fdc4ae0ed
commit
9eb9bd703b
151
util/glgen/README.txt
Normal file
151
util/glgen/README.txt
Normal file
@ -0,0 +1,151 @@
|
||||
Overview
|
||||
========
|
||||
|
||||
This is the glgen application used to generate OpenGL related classes from the
|
||||
official Khronos OpenGL specification and typemap files.
|
||||
|
||||
To run this application download the gl.spec and gl.tm files from:
|
||||
|
||||
http://www.opengl.org/registry/api/gl.spec
|
||||
http://www.opengl.org/registry/api/gl.tm
|
||||
|
||||
and place them into the application directory. These files are not stored in
|
||||
the Qt Project's git repo or downloaded automatically to
|
||||
|
||||
a) avoid copyright issues
|
||||
b) make sure the version of OpenGL used is controlled by a human
|
||||
|
||||
The glgen application parses these files and generates:
|
||||
|
||||
1) A set of public classes, one for each combination of OpenGL version and profile.
|
||||
2) A set of backend helper classes that contain the actual function pointers
|
||||
3) A factory class for the classes in 1)
|
||||
4) A set of classes, one for each OpenGL extension which introduces new entry points
|
||||
|
||||
We will now describe each of these categories.
|
||||
|
||||
|
||||
OpenGL Version and Profile Classes
|
||||
==================================
|
||||
|
||||
The base class of this set is QAbstractOpenGLFunctions. From this we inherit one class
|
||||
for each OpenGL version and if supported, profile.
|
||||
|
||||
The Core profile contains only the non-deprecated functionality. The Compatibility profile
|
||||
also includes all functionality that was removed in OpenGL 3.1. Therefore, for OpenGL
|
||||
3.2 onwards we have two classes for each version.
|
||||
|
||||
All of these classes are named with the following convention:
|
||||
|
||||
QOpenGLFunctions_<MAJOR>_<MINOR>[_PROFILE]
|
||||
|
||||
For example QOpenGLFunctions_2_1, QOpenGLFunctions_4_3_Core
|
||||
|
||||
The source and header files for these classes take the form
|
||||
|
||||
qopenglfunction_<MAJOR>_<MINOR>[_PROFILE].cpp
|
||||
qopenglfunction_<MAJOR>_<MINOR>[_PROFILE].h
|
||||
|
||||
and should be moved to
|
||||
|
||||
$QTBASE/src/gui/opengl/
|
||||
|
||||
and forms part of the public QtGui library API.
|
||||
|
||||
|
||||
Backend Helper Classes
|
||||
======================
|
||||
|
||||
Every OpenGL function is categorised by which version it was introduced with and
|
||||
whether it is part of the Core Profile and is deemed part of the core specification
|
||||
or whther it is only part of the Compatibility profile and has been marked as
|
||||
deprecated.
|
||||
|
||||
Glgen creates a backend helper class containing function pointers to match each
|
||||
possible case. E.g. QOpenGLFunctions_1_5_CoreBackend contains functions introduced
|
||||
in OpenGL 1.5 which are still core (not deprecated).
|
||||
|
||||
The public frontend classes described above contain pointers to the set of backend
|
||||
objects necessary to implement the functions for their version and profile.
|
||||
|
||||
Creating new instances of these backend objects for each public version functions
|
||||
object would be wasteful in terms of memory (repeated function pointers) and CPU
|
||||
time (no need to keep re-solving the same functions).
|
||||
|
||||
We cannot share the backend objects globally as OpenGL entry point addresses are
|
||||
specific to the OpenGL context. They cannot even be reliably shared between a
|
||||
context group. This is not surprising if you consider the case of contexts in a share
|
||||
group where the contexts have different versions or even profiles. We therefore share
|
||||
the backend instances at the QOpenGLContext level using a simple reference counting
|
||||
scheme.
|
||||
|
||||
When the frontend version functions objects are intialized they check to see if
|
||||
the associated context already has suitable backend objects available. If so they use
|
||||
them, otherwise they will create backend objects and associate them with the context.
|
||||
|
||||
The backend classes are in
|
||||
|
||||
qopenglversionfunctions.h
|
||||
qopenglversionfunctions.cpp
|
||||
|
||||
and should also be moved to
|
||||
|
||||
$QTBASE/src/gui/opengl/
|
||||
|
||||
|
||||
OpenGL Version and Profile Factory
|
||||
==================================
|
||||
|
||||
Instances of the OpenGL version and profile classes described above can be obtained
|
||||
from QOpenGLContext by means of the versionFunctions() member. The OpenGLContext
|
||||
retains ownership of the QOpenGLFunctions_* object. If a suitable object does not
|
||||
already exist it is created by the factory class generated by glgen.
|
||||
|
||||
It is possible to request version functions objects for any version/profile
|
||||
combination from a context. However not all requests can be serviced. For example
|
||||
consider the case of an OpenGL 3.3 Core profile context. In this case:
|
||||
|
||||
* Requesting a 3.3 core profile functions object would succeed.
|
||||
* Requesting a 3.3 compatibility profile functions object would fail. We would fail
|
||||
to resolve the deprecated functions.
|
||||
* Requesting a 4.3 core profile functions object would fail. We would fail to resolve
|
||||
the new core functions introduced in versions 4.0-4.3.
|
||||
* Requesting a 3.1 functions object would succeed. There is nothing in 3.1 that is not
|
||||
also in 3.3 core.
|
||||
|
||||
If a request is not able to be serviced the factory, and hence QOpenGLContext::versionFunctions()
|
||||
will return a null pointer that can be checked for.
|
||||
|
||||
The source and header file for this class should be moved to
|
||||
|
||||
$QTBASE/src/gui/opengl/
|
||||
|
||||
and forms part of the QtGui library.
|
||||
|
||||
If a user instantiates a version functions object directly (i.e. not via QOpenGLContext)
|
||||
then it bypasses the above checks. However, the same checks are applied in the
|
||||
initializeOpenGLFunctions() method and the result can once again be checked.
|
||||
|
||||
This approach allows maximum flexibility but ensure's safety in that once the user
|
||||
posesses a functions object that has been successfully initialized they can rely upon its
|
||||
member functions being successfully resolved.
|
||||
|
||||
|
||||
OpenGL Extension Classes
|
||||
========================
|
||||
|
||||
In addition, glgen also creates one class for each OpenGL extension that introduces
|
||||
new entry points. These classes are named with the convention
|
||||
|
||||
QOpenGLExtension_<name-of-extension>
|
||||
|
||||
The usage pattern for OpenGL extensions is to just use a small
|
||||
number of extensions out of the large number of those available.
|
||||
|
||||
Rather than bloat QtGui with all possible extensions, a new static library will be
|
||||
introduced to hold these classes. That way users will only link in the code for
|
||||
the extensions that they actually use.
|
||||
|
||||
The source and header file for these classes should be moved to
|
||||
|
||||
$QTBASE/src/openglextensions/
|
1099
util/glgen/codegenerator.cpp
Normal file
1099
util/glgen/codegenerator.cpp
Normal file
File diff suppressed because it is too large
Load Diff
149
util/glgen/codegenerator.h
Normal file
149
util/glgen/codegenerator.h
Normal file
@ -0,0 +1,149 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the utilities 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CODEGENERATOR_H
|
||||
#define CODEGENERATOR_H
|
||||
|
||||
#include "specparser.h"
|
||||
|
||||
class QTextStream;
|
||||
|
||||
class CodeGenerator
|
||||
{
|
||||
public:
|
||||
explicit CodeGenerator();
|
||||
|
||||
void setParser(SpecParser *parser) {m_parser = parser;}
|
||||
|
||||
void generateCoreClasses(const QString &baseFileName) const;
|
||||
|
||||
void generateExtensionClasses(const QString &baseFileName) const;
|
||||
|
||||
private:
|
||||
// Generic support
|
||||
enum ClassVisibility {
|
||||
Public,
|
||||
Private
|
||||
};
|
||||
|
||||
enum ClassComponent {
|
||||
Declaration = 0,
|
||||
Definition
|
||||
};
|
||||
|
||||
bool isLegacyVersion(Version v) const;
|
||||
bool versionHasProfiles(Version v) const;
|
||||
|
||||
FunctionCollection functionCollection( const VersionProfile& classVersionProfile ) const;
|
||||
|
||||
void writePreamble(const QString &baseFileName, QTextStream &stream, const QString replacement = QString()) const;
|
||||
void writePostamble(const QString &baseFileName, QTextStream &stream) const;
|
||||
|
||||
QString passByType(const Argument &arg) const;
|
||||
QString safeArgumentName(const QString& arg) const;
|
||||
|
||||
// Core functionality support
|
||||
QString coreClassFileName(const VersionProfile &versionProfile,
|
||||
const QString& fileExtension) const;
|
||||
void writeCoreHelperClasses(const QString &fileName, ClassComponent component) const;
|
||||
void writeCoreClasses(const QString &baseFileName) const;
|
||||
|
||||
void writeCoreFactoryHeader(const QString &fileName) const;
|
||||
void writeCoreFactoryImplementation(const QString &fileName) const;
|
||||
|
||||
QString generateClassName(const VersionProfile &classVersion, ClassVisibility visibility = Public) const;
|
||||
|
||||
void writeBackendClassDeclaration(QTextStream &stream,
|
||||
const VersionProfile &versionProfile,
|
||||
const QString &baseClass) const;
|
||||
void writeBackendClassImplementation(QTextStream &stream,
|
||||
const VersionProfile &versionProfile,
|
||||
const QString &baseClass) const;
|
||||
|
||||
void writePublicClassDeclaration(const QString &baseFileName,
|
||||
const VersionProfile &versionProfile,
|
||||
const QString &baseClass) const;
|
||||
void writePublicClassImplementation(const QString &baseFileName,
|
||||
const VersionProfile &versionProfile,
|
||||
const QString& baseClass) const;
|
||||
|
||||
void writeClassFunctionDeclarations(QTextStream &stream,
|
||||
const FunctionCollection &functionSets,
|
||||
ClassVisibility visibility) const;
|
||||
|
||||
void writeFunctionDeclaration(QTextStream &stream, const Function &f, ClassVisibility visibility) const;
|
||||
|
||||
void writeClassInlineFunctions(QTextStream &stream,
|
||||
const QString &className,
|
||||
const FunctionCollection &functionSet) const;
|
||||
|
||||
void writeInlineFunction(QTextStream &stream, const QString &className,
|
||||
const QString &backendVar, const Function &f) const;
|
||||
|
||||
void writeEntryPointResolutionCode(QTextStream &stream,
|
||||
const FunctionCollection &functionSet) const;
|
||||
|
||||
void writeEntryPointResolutionStatement(QTextStream &stream, const Function &f,
|
||||
const QString &prefix = QString(), bool useGetProcAddress = false) const;
|
||||
|
||||
QList<VersionProfile> backendsForFunctionCollection(const FunctionCollection &functionSet) const;
|
||||
QString backendClassName(const VersionProfile &v) const;
|
||||
QString backendVariableName(const VersionProfile &v) const;
|
||||
void writeBackendVariableDeclarations(QTextStream &stream, const QList<VersionProfile> &backends) const;
|
||||
|
||||
|
||||
// Extension class support
|
||||
void writeExtensionHeader(const QString &fileName) const;
|
||||
void writeExtensionImplementation(const QString &fileName) const;
|
||||
|
||||
void writeExtensionClassDeclaration(QTextStream &stream,
|
||||
const QString &extension,
|
||||
ClassVisibility visibility = Public) const;
|
||||
void writeExtensionClassImplementation(QTextStream &stream, const QString &extension) const;
|
||||
|
||||
QString generateExtensionClassName(const QString &extension, ClassVisibility visibility = Public) const;
|
||||
void writeExtensionInlineFunction(QTextStream &stream, const QString &className, const Function &f) const;
|
||||
|
||||
SpecParser *m_parser;
|
||||
mutable QMap<QString, int> m_extensionIds;
|
||||
};
|
||||
|
||||
#endif // CODEGENERATOR_H
|
35
util/glgen/glgen.pro
Normal file
35
util/glgen/glgen.pro
Normal file
@ -0,0 +1,35 @@
|
||||
QT -= gui
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Uncomment following to enable debug output
|
||||
#DEFINES += SPECPARSER_DEBUG
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = glgen
|
||||
|
||||
SOURCES += main.cpp \
|
||||
specparser.cpp \
|
||||
codegenerator.cpp
|
||||
|
||||
HEADERS += \
|
||||
specparser.h \
|
||||
codegenerator.h
|
||||
|
||||
OTHER_FILES += \
|
||||
qopenglversionfunctions.h.header \
|
||||
qopenglversionfunctions.h.footer \
|
||||
qopenglversionfunctions.cpp.header \
|
||||
qopenglversionfunctions.cpp.footer \
|
||||
qopenglversionfunctions__VERSION__.cpp.footer \
|
||||
qopenglversionfunctions__VERSION__.cpp.header \
|
||||
qopenglversionfunctions__VERSION__.h.footer \
|
||||
qopenglversionfunctions__VERSION__.h.header \
|
||||
qopenglversionfunctionsfactory_p.h.header \
|
||||
qopenglextensions.cpp.header \
|
||||
qopenglextensions.cpp.footer \
|
||||
qopenglextensions.h.header \
|
||||
qopenglextensions.h.footer \
|
||||
qopenglversionfunctionsfactory.cpp.header \
|
||||
qopenglversionfunctionsfactory.cpp.footer \
|
||||
README.txt
|
61
util/glgen/main.cpp
Normal file
61
util/glgen/main.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the utilities 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "codegenerator.h"
|
||||
#include "specparser.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
SpecParser parser;
|
||||
parser.setTypeMapFileName(QStringLiteral("gl.tm"));
|
||||
parser.setSpecFileName(QStringLiteral("gl.spec"));
|
||||
parser.parse();
|
||||
|
||||
CodeGenerator generator;
|
||||
generator.setParser(&parser);
|
||||
generator.generateCoreClasses(QStringLiteral("qopenglversionfunctions"));
|
||||
generator.generateExtensionClasses(QStringLiteral("qopenglextensions"));
|
||||
|
||||
return 0;
|
||||
}
|
792
util/glgen/qopenglextensions.cpp.footer
Normal file
792
util/glgen/qopenglextensions.cpp.footer
Normal file
@ -0,0 +1,792 @@
|
||||
|
||||
#else
|
||||
|
||||
QOpenGLExtension_OES_EGL_image::QOpenGLExtension_OES_EGL_image()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_OES_EGL_imagePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_OES_EGL_image::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_OES_EGL_image);
|
||||
|
||||
d->EGLImageTargetTexture2DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetTexture2DOES");
|
||||
d->EGLImageTargetRenderbufferStorageOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetRenderbufferStorageOESs");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_OES_get_program_binary::QOpenGLExtension_OES_get_program_binary()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_OES_get_program_binaryPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_OES_get_program_binary::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_OES_get_program_binary);
|
||||
|
||||
d->GetProgramBinaryOES = (void (QOPENGLF_APIENTRYP)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary))context->getProcAddress("glGetProgramBinaryOES");
|
||||
d->ProgramBinaryOES = (void (QOPENGLF_APIENTRYP)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length))context->getProcAddress("glProgramBinaryOES");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_OES_mapbuffer::QOpenGLExtension_OES_mapbuffer()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_OES_mapbufferPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_OES_mapbuffer::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_OES_mapbuffer);
|
||||
|
||||
d->MapBufferOES = (void* (QOPENGLF_APIENTRYP)(GLenum target, GLenum access))context->getProcAddress("glMapBufferOES");
|
||||
d->UnmapBufferOES = (GLboolean (QOPENGLF_APIENTRYP)(GLenum target))context->getProcAddress("glUnmapBufferOES");
|
||||
d->GetBufferPointervOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLenum pname, GLvoid** params))context->getProcAddress("glGetBufferPointervOES");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_OES_texture_3D::QOpenGLExtension_OES_texture_3D()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_OES_texture_3DPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_OES_texture_3D::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_OES_texture_3D);
|
||||
|
||||
d->TexImage3DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels))context->getProcAddress("glTexImage3DOES");
|
||||
d->TexSubImage3DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels))context->getProcAddress("glTexSubImage3DOES");
|
||||
d->CopyTexSubImage3DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height))context->getProcAddress("glCopyTexSubImage3DOES");
|
||||
d->CompressedTexImage3DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data))context->getProcAddress("glCompressedTexImage3DOES");
|
||||
d->CompressedTexSubImage3DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data))context->getProcAddress("glCompressedTexSubImage3DOES");
|
||||
d->FramebufferTexture3DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset))context->getProcAddress("glFramebufferTexture3DOES");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_OES_vertex_array_object::QOpenGLExtension_OES_vertex_array_object()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_OES_vertex_array_objectPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_OES_vertex_array_object::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_OES_vertex_array_object);
|
||||
|
||||
d->BindVertexArrayOES = (void (QOPENGLF_APIENTRYP)(GLuint array))context->getProcAddress("glBindVertexArrayOES");
|
||||
d->DeleteVertexArraysOES = (void (QOPENGLF_APIENTRYP)(GLsizei n, const GLuint *arrays))context->getProcAddress("glDeleteVertexArraysOES");
|
||||
d->GenVertexArraysOES = (void (QOPENGLF_APIENTRYP)(GLsizei n, GLuint *arrays))context->getProcAddress("glGenVertexArraysOES");
|
||||
d->IsVertexArrayOES = (GLboolean (QOPENGLF_APIENTRYP)(GLuint array))context->getProcAddress("glIsVertexArrayOES");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_AMD_performance_monitor::QOpenGLExtension_AMD_performance_monitor()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_AMD_performance_monitorPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_AMD_performance_monitor::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_AMD_performance_monitor);
|
||||
|
||||
d->GetPerfMonitorGroupsAMD = (void (QOPENGLF_APIENTRYP)(GLint *numGroups, GLsizei groupsSize, GLuint *groups))context->getProcAddress("glGetPerfMonitorGroupsAMD");
|
||||
d->GetPerfMonitorCountersAMD = (void (QOPENGLF_APIENTRYP)(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters))context->getProcAddress("glGetPerfMonitorCountersAMD");
|
||||
d->GetPerfMonitorGroupStringAMD = (void (QOPENGLF_APIENTRYP)(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString))context->getProcAddress("glGetPerfMonitorGroupStringAMD");
|
||||
d->GetPerfMonitorCounterStringAMD = (void (QOPENGLF_APIENTRYP)(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString))context->getProcAddress("glGetPerfMonitorCounterStringAMD");
|
||||
d->GetPerfMonitorCounterInfoAMD = (void (QOPENGLF_APIENTRYP)(GLuint group, GLuint counter, GLenum pname, GLvoid *data))context->getProcAddress("glGetPerfMonitorCounterInfoAMD");
|
||||
d->GenPerfMonitorsAMD = (void (QOPENGLF_APIENTRYP)(GLsizei n, GLuint *monitors))context->getProcAddress("glGenPerfMonitorsAMD");
|
||||
d->DeletePerfMonitorsAMD = (void (QOPENGLF_APIENTRYP)(GLsizei n, GLuint *monitors))context->getProcAddress("glDeletePerfMonitorsAMD");
|
||||
d->SelectPerfMonitorCountersAMD = (void (QOPENGLF_APIENTRYP)(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList))context->getProcAddress("glSelectPerfMonitorCountersAMD");
|
||||
d->BeginPerfMonitorAMD = (void (QOPENGLF_APIENTRYP)(GLuint monitor))context->getProcAddress("glBeginPerfMonitorAMD");
|
||||
d->EndPerfMonitorAMD = (void (QOPENGLF_APIENTRYP )(GLuint monitor))context->getProcAddress("glEndPerfMonitorAMD");
|
||||
d->GetPerfMonitorCounterDataAMD = (void (QOPENGLF_APIENTRYP)(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten))context->getProcAddress("glGetPerfMonitorCounterDataAMD");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_ANGLE_framebuffer_blit::QOpenGLExtension_ANGLE_framebuffer_blit()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_ANGLE_framebuffer_blitPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_ANGLE_framebuffer_blit::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_ANGLE_framebuffer_blit);
|
||||
|
||||
d->BlitFramebufferANGLE = (void (QOPENGLF_APIENTRYP)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter))context->getProcAddress("glBlitFramebufferANGLE");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_ANGLE_framebuffer_multisample::QOpenGLExtension_ANGLE_framebuffer_multisample()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_ANGLE_framebuffer_multisamplePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_ANGLE_framebuffer_multisample::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_ANGLE_framebuffer_multisample);
|
||||
|
||||
d->RenderbufferStorageMultisampleANGLE = (void (QOPENGLF_APIENTRYP)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))context->getProcAddress("glRenderbufferStorageMultisampleANGLE");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_ANGLE_instanced_arrays::QOpenGLExtension_ANGLE_instanced_arrays()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_ANGLE_instanced_arraysPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_ANGLE_instanced_arrays::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_ANGLE_instanced_arrays);
|
||||
|
||||
d->DrawArraysInstancedANGLE = (void (QOPENGLF_APIENTRYP)(GLenum mode, GLint first, GLsizei count, GLsizei primcount))context->getProcAddress("glDrawArraysInstancedANGLE");
|
||||
d->DrawElementsInstancedANGLE = (void (QOPENGLF_APIENTRYP)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount))context->getProcAddress("glDrawElementsInstancedANGLE");
|
||||
d->VertexAttribDivisorANGLE = (void (QOPENGLF_APIENTRYP)(GLuint index, GLuint divisor))context->getProcAddress("glVertexAttribDivisorANGLE");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_ANGLE_translated_shader_source::QOpenGLExtension_ANGLE_translated_shader_source()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_ANGLE_translated_shader_sourcePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_ANGLE_translated_shader_source::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_ANGLE_translated_shader_source);
|
||||
|
||||
d->GetTranslatedShaderSourceANGLE = (void (QOPENGLF_APIENTRYP)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source))context->getProcAddress("glGetTranslatedShaderSourceANGLE");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_APPLE_framebuffer_multisample::QOpenGLExtension_APPLE_framebuffer_multisample()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_APPLE_framebuffer_multisamplePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_APPLE_framebuffer_multisample::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_APPLE_framebuffer_multisample);
|
||||
|
||||
d->RenderbufferStorageMultisampleAPPLE = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei))context->getProcAddress("glRenderbufferStorageMultisampleAPPLE");
|
||||
d->ResolveMultisampleFramebufferAPPLE = (void (QOPENGLF_APIENTRYP)(void))context->getProcAddress("glResolveMultisampleFramebufferAPPLE");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_debug_label::QOpenGLExtension_EXT_debug_label()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_debug_labelPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_debug_label::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_debug_label);
|
||||
|
||||
d->LabelObjectEXT = (void (QOPENGLF_APIENTRYP)(GLenum type, GLuint object, GLsizei length, const GLchar *label))context->getProcAddress("glLabelObjectEXT");
|
||||
d->GetObjectLabelEXT = (void (QOPENGLF_APIENTRYP)(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label))context->getProcAddress("glGetObjectLabelEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_debug_marker::QOpenGLExtension_EXT_debug_marker()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_debug_markerPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_debug_marker::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_debug_marker);
|
||||
|
||||
d->InsertEventMarkerEXT = (void (QOPENGLF_APIENTRYP)(GLsizei length, const GLchar *marker))context->getProcAddress("glInsertEventMarkerEXT");
|
||||
d->PushGroupMarkerEXT = (void (QOPENGLF_APIENTRYP)(GLsizei length, const GLchar *marker))context->getProcAddress("glPushGroupMarkerEXT");
|
||||
d->PopGroupMarkerEXT = (void (QOPENGLF_APIENTRYP)(void))context->getProcAddress("glPopGroupMarkerEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_discard_framebuffer::QOpenGLExtension_EXT_discard_framebuffer()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_discard_framebufferPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_discard_framebuffer::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_discard_framebuffer);
|
||||
|
||||
d->DiscardFramebufferEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLsizei numAttachments, const GLenum *attachments))context->getProcAddress("glDiscardFramebufferEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_multisampled_render_to_texture::QOpenGLExtension_EXT_multisampled_render_to_texture()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_multisampled_render_to_texturePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_multisampled_render_to_texture::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_multisampled_render_to_texture);
|
||||
|
||||
d->RenderbufferStorageMultisampleEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))context->getProcAddress("glRenderbufferStorageMultisampleEXT");
|
||||
d->FramebufferTexture2DMultisampleEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples))context->getProcAddress("glFramebufferTexture2DMultisampleEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_multi_draw_arrays::QOpenGLExtension_EXT_multi_draw_arrays()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_multi_draw_arraysPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_multi_draw_arrays::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_multi_draw_arrays);
|
||||
|
||||
d->MultiDrawArraysEXT = (void (QOPENGLF_APIENTRYP)(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount))context->getProcAddress("glMultiDrawArraysEXT");
|
||||
d->MultiDrawElementsEXT = (void (QOPENGLF_APIENTRYP)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount))context->getProcAddress("glMultiDrawElementsEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_occlusion_query_boolean::QOpenGLExtension_EXT_occlusion_query_boolean()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_occlusion_query_booleanPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_occlusion_query_boolean::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_occlusion_query_boolean);
|
||||
|
||||
d->GenQueriesEXT = (void (QOPENGLF_APIENTRYP)(GLsizei n, GLuint *ids))context->getProcAddress("glGenQueriesEXT");
|
||||
d->DeleteQueriesEXT = (void (QOPENGLF_APIENTRYP)(GLsizei n, const GLuint *ids))context->getProcAddress("glDeleteQueriesEXT");
|
||||
d->IsQueryEXT = (GLboolean (QOPENGLF_APIENTRYP)(GLuint id))context->getProcAddress("glIsQueryEXT");
|
||||
d->BeginQueryEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLuint id))context->getProcAddress("glBeginQueryEXT");
|
||||
d->EndQueryEXT = (void (QOPENGLF_APIENTRYP)(GLenum target))context->getProcAddress("glEndQueryEXT");
|
||||
d->GetQueryivEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLenum pname, GLint *params))context->getProcAddress("glGetQueryivEXT");
|
||||
d->GetQueryObjectuivEXT = (void (QOPENGLF_APIENTRYP)(GLuint id, GLenum pname, GLuint *params))context->getProcAddress("glGetQueryObjectuivEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_robustness::QOpenGLExtension_EXT_robustness()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_robustnessPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_robustness::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_robustness);
|
||||
|
||||
d->GetGraphicsResetStatusEXT = (GLenum (QOPENGLF_APIENTRYP)(void))context->getProcAddress("glGetGraphicsResetStatusEXT");
|
||||
d->ReadnPixelsEXT = (void (QOPENGLF_APIENTRYP)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data))context->getProcAddress("glReadnPixelsEXT");
|
||||
d->GetnUniformfvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei bufSize, float *params))context->getProcAddress("glGetnUniformfvEXT");
|
||||
d->GetnUniformivEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei bufSize, GLint *params))context->getProcAddress("glGetnUniformivEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_separate_shader_objects::QOpenGLExtension_EXT_separate_shader_objects()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_separate_shader_objectsPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_separate_shader_objects::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_separate_shader_objects);
|
||||
|
||||
d->UseProgramStagesEXT = (void (QOPENGLF_APIENTRYP)(GLuint pipeline, GLbitfield stages, GLuint program))context->getProcAddress("glUseProgramStagesEXT");
|
||||
d->ActiveShaderProgramEXT = (void (QOPENGLF_APIENTRYP)(GLuint pipeline, GLuint program))context->getProcAddress("glActiveShaderProgramEXT");
|
||||
d->CreateShaderProgramvEXT = (GLuint (QOPENGLF_APIENTRYP)(GLenum type, GLsizei count, const GLchar **strings))context->getProcAddress("glCreateShaderProgramvEXT");
|
||||
d->BindProgramPipelineEXT = (void (QOPENGLF_APIENTRYP)(GLuint pipeline))context->getProcAddress("glBindProgramPipelineEXT");
|
||||
d->DeleteProgramPipelinesEXT = (void (QOPENGLF_APIENTRYP)(GLsizei n, const GLuint *pipelines))context->getProcAddress("glDeleteProgramPipelinesEXT");
|
||||
d->GenProgramPipelinesEXT = (void (QOPENGLF_APIENTRYP)(GLsizei n, GLuint *pipelines))context->getProcAddress("glGenProgramPipelinesEXT");
|
||||
d->IsProgramPipelineEXT = (GLboolean (QOPENGLF_APIENTRYP)(GLuint pipeline))context->getProcAddress("glIsProgramPipelineEXT");
|
||||
d->ProgramParameteriEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLenum pname, GLint value))context->getProcAddress("glProgramParameteriEXT");
|
||||
d->GetProgramPipelineivEXT = (void (QOPENGLF_APIENTRYP)(GLuint pipeline, GLenum pname, GLint *params))context->getProcAddress("glGetProgramPipelineivEXT");
|
||||
d->ProgramUniform1iEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLint x))context->getProcAddress("glProgramUniform1iEXT");
|
||||
d->ProgramUniform2iEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLint x, GLint y))context->getProcAddress("glProgramUniform2iEXT");
|
||||
d->ProgramUniform3iEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLint x, GLint y, GLint z))context->getProcAddress("glProgramUniform3iEXT");
|
||||
d->ProgramUniform4iEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w))context->getProcAddress("glProgramUniform4iEXT");
|
||||
d->ProgramUniform1fEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLfloat x))context->getProcAddress("glProgramUniform1fEXT");
|
||||
d->ProgramUniform2fEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLfloat x, GLfloat y))context->getProcAddress("glProgramUniform2fEXT");
|
||||
d->ProgramUniform3fEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z))context->getProcAddress("glProgramUniform3fEXT");
|
||||
d->ProgramUniform4fEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w))context->getProcAddress("glProgramUniform4fEXT");
|
||||
d->ProgramUniform1ivEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLint *value))context->getProcAddress("glProgramUniform1ivEXT");
|
||||
d->ProgramUniform2ivEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLint *value))context->getProcAddress("glProgramUniform2ivEXT");
|
||||
d->ProgramUniform3ivEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLint *value))context->getProcAddress("glProgramUniform3ivEXT");
|
||||
d->ProgramUniform4ivEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLint *value))context->getProcAddress("glProgramUniform4ivEXT");
|
||||
d->ProgramUniform1fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLfloat *value))context->getProcAddress("glProgramUniform1fvEXT");
|
||||
d->ProgramUniform2fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLfloat *value))context->getProcAddress("glProgramUniform2fvEXT");
|
||||
d->ProgramUniform3fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLfloat *value))context->getProcAddress("glProgramUniform3fvEXT");
|
||||
d->ProgramUniform4fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, const GLfloat *value))context->getProcAddress("glProgramUniform4fvEXT");
|
||||
d->ProgramUniformMatrix2fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))context->getProcAddress("glProgramUniformMatrix2fvEXT");
|
||||
d->ProgramUniformMatrix3fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))context->getProcAddress("glProgramUniformMatrix3fvEXT");
|
||||
d->ProgramUniformMatrix4fvEXT = (void (QOPENGLF_APIENTRYP)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))context->getProcAddress("glProgramUniformMatrix4fvEXT");
|
||||
d->ValidateProgramPipelineEXT = (void (QOPENGLF_APIENTRYP)(GLuint pipeline))context->getProcAddress("glValidateProgramPipelineEXT");
|
||||
d->GetProgramPipelineInfoLogEXT = (void (QOPENGLF_APIENTRYP)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog))context->getProcAddress("glGetProgramPipelineInfoLogEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_EXT_texture_storage::QOpenGLExtension_EXT_texture_storage()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_EXT_texture_storagePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_EXT_texture_storage::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_EXT_texture_storage);
|
||||
|
||||
d->TexStorage1DEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width))context->getProcAddress("glTexStorage1DEXT");
|
||||
d->TexStorage2DEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height))context->getProcAddress("glTexStorage2DEXT");
|
||||
d->TexStorage3DEXT = (void (QOPENGLF_APIENTRYP)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth))context->getProcAddress("glTexStorage3DEXT");
|
||||
d->TextureStorage1DEXT = (void (QOPENGLF_APIENTRYP)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width))context->getProcAddress("glTextureStorage1DEXT");
|
||||
d->TextureStorage2DEXT = (void (QOPENGLF_APIENTRYP)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height))context->getProcAddress("glTextureStorage2DEXT");
|
||||
d->TextureStorage3DEXT = (void (QOPENGLF_APIENTRYP)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth))context->getProcAddress("glTextureStorage3DEXT");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_IMG_multisampled_render_to_texture::QOpenGLExtension_IMG_multisampled_render_to_texture()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_IMG_multisampled_render_to_texturePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_IMG_multisampled_render_to_texture::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_IMG_multisampled_render_to_texture);
|
||||
|
||||
d->RenderbufferStorageMultisampleIMG = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei))context->getProcAddress("glRenderbufferStorageMultisampleIMG");
|
||||
d->FramebufferTexture2DMultisampleIMG = (void (QOPENGLF_APIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei))context->getProcAddress("glFramebufferTexture2DMultisampleIMG");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_NV_coverage_sample::QOpenGLExtension_NV_coverage_sample()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_NV_coverage_samplePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_NV_coverage_sample::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_NV_coverage_sample);
|
||||
|
||||
d->CoverageMaskNV = (void (QOPENGLF_APIENTRYP)(GLboolean mask))context->getProcAddress("glCoverageMaskNV");
|
||||
d->CoverageOperationNV = (void (QOPENGLF_APIENTRYP)(GLenum operation))context->getProcAddress("glCoverageOperationNV");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_NV_draw_buffers::QOpenGLExtension_NV_draw_buffers()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_NV_draw_buffersPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_NV_draw_buffers::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_NV_draw_buffers);
|
||||
|
||||
d->DrawBuffersNV = (void (QOPENGLF_APIENTRYP)(GLsizei n, const GLenum *bufs))context->getProcAddress("glDrawBuffersNV");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_NV_fence::QOpenGLExtension_NV_fence()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_NV_fencePrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_NV_fence::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_NV_fence);
|
||||
|
||||
d->DeleteFencesNV = (void (QOPENGLF_APIENTRYP)(GLsizei n, const GLuint *fences))context->getProcAddress("glDeleteFencesNV");
|
||||
d->GenFencesNV = (void (QOPENGLF_APIENTRYP)(GLsizei n, GLuint *fences))context->getProcAddress("glGenFencesNV");
|
||||
d->IsFenceNV = (GLboolean (QOPENGLF_APIENTRYP)(GLuint fence))context->getProcAddress("glIsFenceNV");
|
||||
d->TestFenceNV = (GLboolean (QOPENGLF_APIENTRYP)(GLuint fence))context->getProcAddress("glTestFenceNV");
|
||||
d->GetFenceivNV = (void (QOPENGLF_APIENTRYP)(GLuint fence, GLenum pname, GLint *params))context->getProcAddress("glGetFenceivNV");
|
||||
d->FinishFenceNV = (void (QOPENGLF_APIENTRYP)(GLuint fence))context->getProcAddress("glFinishFenceNV");
|
||||
d->SetFenceNV = (void (QOPENGLF_APIENTRYP)(GLuint fence, GLenum condition))context->getProcAddress("glSetFenceNV");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_NV_read_buffer::QOpenGLExtension_NV_read_buffer()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_NV_read_bufferPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_NV_read_buffer::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_NV_read_buffer);
|
||||
|
||||
d->ReadBufferNV = (void (QOPENGLF_APIENTRYP)(GLenum mode))context->getProcAddress("glReadBufferNV");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_QCOM_alpha_test::QOpenGLExtension_QCOM_alpha_test()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_QCOM_alpha_testPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_QCOM_alpha_test::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_QCOM_alpha_test);
|
||||
|
||||
d->AlphaFuncQCOM = (void (QOPENGLF_APIENTRYP )(GLenum func, GLclampf ref))context->getProcAddress("glAlphaFuncQCOM");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_QCOM_driver_control::QOpenGLExtension_QCOM_driver_control()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_QCOM_driver_controlPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_QCOM_driver_control::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_QCOM_driver_control);
|
||||
|
||||
d->GetDriverControlsQCOM = (void (QOPENGLF_APIENTRYP)(GLint *num, GLsizei size, GLuint *driverControls))context->getProcAddress("glGetDriverControlsQCOM");
|
||||
d->GetDriverControlStringQCOM = (void (QOPENGLF_APIENTRYP)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString))context->getProcAddress("glGetDriverControlStringQCOM");
|
||||
d->EnableDriverControlQCOM = (void (QOPENGLF_APIENTRYP)(GLuint driverControl))context->getProcAddress("glEnableDriverControlQCOM");
|
||||
d->DisableDriverControlQCOM = (void (QOPENGLF_APIENTRYP)(GLuint driverControl))context->getProcAddress("glDisableDriverControlQCOM");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_QCOM_extended_get::QOpenGLExtension_QCOM_extended_get()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_QCOM_extended_getPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_QCOM_extended_get::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_QCOM_extended_get);
|
||||
|
||||
d->ExtGetTexturesQCOM = (void (QOPENGLF_APIENTRYP)(GLuint *textures, GLint maxTextures, GLint *numTextures))context->getProcAddress("glExtGetTexturesQCOM");
|
||||
d->ExtGetBuffersQCOM = (void (QOPENGLF_APIENTRYP)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers))context->getProcAddress("glExtGetBuffersQCOM");
|
||||
d->ExtGetRenderbuffersQCOM = (void (QOPENGLF_APIENTRYP)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers))context->getProcAddress("glExtGetRenderbuffersQCOM");
|
||||
d->ExtGetFramebuffersQCOM = (void (QOPENGLF_APIENTRYP)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers))context->getProcAddress("glExtGetFramebuffersQCOM");
|
||||
d->ExtGetTexLevelParameterivQCOM = (void (QOPENGLF_APIENTRYP)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params))context->getProcAddress("glExtGetTexLevelParameterivQCOM");
|
||||
d->ExtTexObjectStateOverrideiQCOM = (void (QOPENGLF_APIENTRYP)(GLenum target, GLenum pname, GLint param))context->getProcAddress("glExtTexObjectStateOverrideiQCOM");
|
||||
d->ExtGetTexSubImageQCOM = (void (QOPENGLF_APIENTRYP)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels))context->getProcAddress("glExtGetTexSubImageQCOM");
|
||||
d->ExtGetBufferPointervQCOM = (void (QOPENGLF_APIENTRYP)(GLenum target, GLvoid **params))context->getProcAddress("glExtGetBufferPointervQCOM");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_QCOM_extended_get2::QOpenGLExtension_QCOM_extended_get2()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_QCOM_extended_get2Private))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_QCOM_extended_get2::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_QCOM_extended_get2);
|
||||
|
||||
d->ExtGetShadersQCOM = (void (QOPENGLF_APIENTRYP)(GLuint *shaders, GLint maxShaders, GLint *numShaders))context->getProcAddress("glExtGetShadersQCOM");
|
||||
d->ExtGetProgramsQCOM = (void (QOPENGLF_APIENTRYP)(GLuint *programs, GLint maxPrograms, GLint *numPrograms))context->getProcAddress("glExtGetProgramsQCOM");
|
||||
d->ExtIsProgramBinaryQCOM = (GLboolean (QOPENGLF_APIENTRYP)(GLuint program))context->getProcAddress("glExtIsProgramBinaryQCOM");
|
||||
d->ExtGetProgramBinarySourceQCOM = (void (QOPENGLF_APIENTRYP)(GLuint program, GLenum shadertype, GLchar *source, GLint *length))context->getProcAddress("glExtGetProgramBinarySourceQCOM");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
QOpenGLExtension_QCOM_tiled_rendering::QOpenGLExtension_QCOM_tiled_rendering()
|
||||
: QAbstractOpenGLExtension(*(new QOpenGLExtension_QCOM_tiled_renderingPrivate))
|
||||
{
|
||||
}
|
||||
|
||||
bool QOpenGLExtension_QCOM_tiled_rendering::initializeOpenGLFunctions()
|
||||
{
|
||||
if (isInitialized())
|
||||
return true;
|
||||
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context) {
|
||||
qWarning("A current OpenGL context is required to resolve OpenGL extension functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve the functions
|
||||
Q_D(QOpenGLExtension_QCOM_tiled_rendering);
|
||||
|
||||
d->StartTilingQCOM = (void (QOPENGLF_APIENTRYP)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask))context->getProcAddress("glStartTilingQCOM");
|
||||
d->EndTilingQCOM = (void (QOPENGLF_APIENTRYP)(GLbitfield preserveMask))context->getProcAddress("glEndTilingQCOM");
|
||||
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
76
util/glgen/qopenglextensions.cpp.header
Normal file
76
util/glgen/qopenglextensions.cpp.header
Normal file
@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenglextensions.h"
|
||||
#include <QtGui/qopenglcontext.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QAbstractOpenGLExtension::~QAbstractOpenGLExtension()
|
||||
{
|
||||
if (d_ptr)
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
bool QAbstractOpenGLExtension::initializeOpenGLFunctions()
|
||||
{
|
||||
Q_D(QAbstractOpenGLExtension);
|
||||
d->initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QAbstractOpenGLExtension::isInitialized() const
|
||||
{
|
||||
Q_D(const QAbstractOpenGLExtension);
|
||||
return d->initialized;
|
||||
}
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
|
1520
util/glgen/qopenglextensions.h.footer
Normal file
1520
util/glgen/qopenglextensions.h.footer
Normal file
File diff suppressed because it is too large
Load Diff
208
util/glgen/qopenglextensions.h.header
Normal file
208
util/glgen/qopenglextensions.h.header
Normal file
@ -0,0 +1,208 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENGLEXTENSIONS_H
|
||||
#define QOPENGLEXTENSIONS_H
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtGui/qopengl.h>
|
||||
|
||||
class QOpenGLContext;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if 0
|
||||
// silence syncqt warnings
|
||||
#pragma qt_class(QOpenGLExtensions)
|
||||
#pragma qt_sync_stop_processing
|
||||
#endif
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
// This block is copied from glext.h and defines the types needed by
|
||||
// a few extension classes. This may need updating in glgen when a new
|
||||
// OpenGL release is made and this file is regenerated.
|
||||
|
||||
#include <stddef.h>
|
||||
#ifndef GL_VERSION_2_0
|
||||
/* GL type for program/shader text */
|
||||
typedef char GLchar;
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_5
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
typedef ptrdiff_t GLintptr;
|
||||
typedef ptrdiff_t GLsizeiptr;
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
typedef ptrdiff_t GLintptrARB;
|
||||
typedef ptrdiff_t GLsizeiptrARB;
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_shader_objects
|
||||
/* GL types for program/shader text and shader object handles */
|
||||
typedef char GLcharARB;
|
||||
typedef unsigned int GLhandleARB;
|
||||
#endif
|
||||
|
||||
/* GL type for "half" precision (s10e5) float data in host memory */
|
||||
#ifndef GL_ARB_half_float_pixel
|
||||
typedef unsigned short GLhalfARB;
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_half_float
|
||||
typedef unsigned short GLhalfNV;
|
||||
#endif
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glxext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GL_EXT_timer_query extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(__UNIXOS2__) || defined(__SOL64__)
|
||||
typedef long int int32_t;
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_timer_query
|
||||
typedef int64_t GLint64EXT;
|
||||
typedef uint64_t GLuint64EXT;
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_sync
|
||||
typedef int64_t GLint64;
|
||||
typedef uint64_t GLuint64;
|
||||
typedef struct __GLsync *GLsync;
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_cl_event
|
||||
/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */
|
||||
struct _cl_context;
|
||||
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,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);
|
||||
#endif
|
||||
|
||||
#ifndef GL_KHR_debug
|
||||
typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_vdpau_interop
|
||||
typedef GLintptr GLvdpauSurfaceNV;
|
||||
#endif
|
||||
|
||||
// End of block copied from glext.h
|
||||
#endif
|
||||
|
||||
struct QOpenGLFunctionsPrivate;
|
||||
|
||||
class QAbstractOpenGLExtensionPrivate
|
||||
{
|
||||
public:
|
||||
QAbstractOpenGLExtensionPrivate() : initialized(false) {}
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
class QAbstractOpenGLExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QAbstractOpenGLExtension();
|
||||
|
||||
virtual bool initializeOpenGLFunctions();
|
||||
|
||||
Q_DECLARE_PRIVATE(QAbstractOpenGLExtension)
|
||||
|
||||
protected:
|
||||
bool isInitialized() const;
|
||||
|
||||
QAbstractOpenGLExtension() {}
|
||||
QAbstractOpenGLExtension(QAbstractOpenGLExtensionPrivate &dd) : d_ptr(&dd) {}
|
||||
QAbstractOpenGLExtensionPrivate *d_ptr;
|
||||
};
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
|
8
util/glgen/qopenglversionfunctions.cpp.footer
Normal file
8
util/glgen/qopenglversionfunctions.cpp.footer
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
#else
|
||||
|
||||
// No backends for OpenGL ES 2
|
||||
|
||||
#endif // !QT_OPENGL_ES_2
|
||||
|
||||
QT_END_NAMESPACE
|
220
util/glgen/qopenglversionfunctions.cpp.header
Normal file
220
util/glgen/qopenglversionfunctions.cpp.header
Normal file
@ -0,0 +1,220 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenglversionfunctions.h"
|
||||
#include "qopenglcontext.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QOpenGLVersionFunctionsBackend *QAbstractOpenGLFunctionsPrivate::functionsBackend(QOpenGLContext *context,
|
||||
const QOpenGLVersionStatus &v)
|
||||
{
|
||||
Q_ASSERT(context);
|
||||
return context->functionsBackend(v);
|
||||
}
|
||||
|
||||
void QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(QOpenGLContext *context,
|
||||
const QOpenGLVersionStatus &v,
|
||||
QOpenGLVersionFunctionsBackend *backend)
|
||||
{
|
||||
Q_ASSERT(context);
|
||||
context->insertFunctionsBackend(v, backend);
|
||||
}
|
||||
|
||||
void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *context, const QOpenGLVersionStatus &v)
|
||||
{
|
||||
Q_ASSERT(context);
|
||||
context->removeFunctionsBackend(v);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class QAbstractOpenGLFunctions
|
||||
\inmodule QtGui
|
||||
\since 5.1
|
||||
\brief The QAbstractOpenGLFunctions class is the base class of a family of
|
||||
classes that expose all functions for each OpenGL version and
|
||||
profile.
|
||||
|
||||
OpenGL implementations on different platforms are able to link to a variable
|
||||
number of OpenGL functions depending upon the OpenGL ABI on that platform.
|
||||
For example, on Microsoft Windows only functions up to those in OpenGL 1.1
|
||||
can be linked to at build time. All other functions must be resolved at
|
||||
runtime. The traditional solution to this has been to use either
|
||||
QOpenGLContext::getProcAddress() or QOpenGLFunctions. The former is tedious
|
||||
and error prone and means dealing directly with function pointers. The
|
||||
latter only exposes those functions common to OpenGL ES 2 and desktop
|
||||
OpenGL. There is however much new OpenGL functionality that is useful when
|
||||
writing real world OpenGL applications.
|
||||
|
||||
Qt now provides a family of classes which all inherit from
|
||||
QAbstractOpenGLFunctions which expose every core OpenGL function by way of a
|
||||
corresponding member function. There is a class for every valid combination
|
||||
of OpenGL version and profile. Each class follows the naming convention
|
||||
QOpenGLFunctions_<MAJOR VERSION>_<MINOR VERSION>[_PROFILE].
|
||||
|
||||
For OpenGL versions 1.0 through to 3.0 there are no profiles, leading to the
|
||||
classes:
|
||||
|
||||
\list
|
||||
\li QOpenGLFunctions_1_0
|
||||
\li QOpenGLFunctions_1_1
|
||||
\li QOpenGLFunctions_1_2
|
||||
\li QOpenGLFunctions_1_3
|
||||
\li QOpenGLFunctions_1_4
|
||||
\li QOpenGLFunctions_1_5
|
||||
\li QOpenGLFunctions_2_0
|
||||
\li QOpenGLFunctions_2_1
|
||||
\li QOpenGLFunctions_3_0
|
||||
\endlist
|
||||
|
||||
where each class inherits from QAbstractOpenGLFunctions.
|
||||
|
||||
OpenGL version 3.1 removed many deprecated functions leading to a much
|
||||
simpler and generic API.
|
||||
|
||||
With OpenGL 3.2 the concept of profiles was introduced. Two profiles are
|
||||
currently defined for OpenGL: Core and Compatibility.
|
||||
|
||||
The Core profile does not include any of the functions that were removed
|
||||
in OpenGL 3.1. The Compatibility profile contains all functions in the
|
||||
Core profile of the same version plus all of the functions that were
|
||||
removed in OpenGL 3.1. In this way the Compatibility profile classes allow
|
||||
use of newer OpenGL functionality but also allows you to keep using your
|
||||
legacy OpenGL code. For new OpenGL code the Core profile should be
|
||||
preferred.
|
||||
|
||||
Please note that some vendors, notably Apple, do not implement the
|
||||
Compatibility profile. Therefore if you wish to target new OpenGL features
|
||||
on OS X then you should ensure that you request a Core profile context via
|
||||
QSurfaceFormat::setProfile().
|
||||
|
||||
Qt provides classes for all version and Core and Compatibility profile
|
||||
combinations. The classes for OpenGL versions 3.1 through to 4.3 are:
|
||||
|
||||
\list
|
||||
\li QOpenGLFunctions_3_1
|
||||
\li QOpenGLFunctions_3_2_Core
|
||||
\li QOpenGLFunctions_3_2_Compatibility
|
||||
\li QOpenGLFunctions_3_3_Core
|
||||
\li QOpenGLFunctions_3_3_Compatibility
|
||||
\li QOpenGLFunctions_4_0_Core
|
||||
\li QOpenGLFunctions_4_0_Compatibility
|
||||
\li QOpenGLFunctions_4_1_Core
|
||||
\li QOpenGLFunctions_4_1_Compatibility
|
||||
\li QOpenGLFunctions_4_2_Core
|
||||
\li QOpenGLFunctions_4_2_Compatibility
|
||||
\li QOpenGLFunctions_4_3_Core
|
||||
\li QOpenGLFunctions_4_3_Compatibility
|
||||
\endlist
|
||||
|
||||
where each class inherits from QAbstractOpenGLFunctions.
|
||||
|
||||
A pointer to an object of the class corresponding to the version and
|
||||
profile of OpenGL in use can be obtained from
|
||||
QOpenGLFunctions::versionFunctions(). If obtained in this way, note that
|
||||
the QOpenGLContext retains ownership of the object. This is so that only
|
||||
one instance need be created.
|
||||
|
||||
Before calling any of the exposed OpenGL functions you must ensure that the
|
||||
object has resolved the function pointers to the OpenGL functions. This
|
||||
only needs to be done once per instance with initializeOpenGLFunctions().
|
||||
Once initialized, the object can be used to call any OpenGL function for
|
||||
the corresponding version and profile. Note that initializeOpenGLFunctions()
|
||||
can fail in some circumstances so check the return value. Situations in
|
||||
which initialization can fail are if you have a functions object for a version
|
||||
or profile that contains functions that are not part of the context being
|
||||
used to resolve the function pointers.
|
||||
|
||||
If you exclusively use function objects then you will get compile time
|
||||
errors if you attempt to use a function not included in that version and
|
||||
profile. This is obviously a lot easier to debug than undefined behavior
|
||||
at run time.
|
||||
|
||||
\sa QOpenGLContext::versionFunctions()
|
||||
*/
|
||||
QAbstractOpenGLFunctions::QAbstractOpenGLFunctions()
|
||||
: d_ptr(new QAbstractOpenGLFunctionsPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
bool QAbstractOpenGLFunctions::initializeOpenGLFunctions()
|
||||
{
|
||||
Q_D(QAbstractOpenGLFunctions);
|
||||
d->initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QAbstractOpenGLFunctions::isInitialized() const
|
||||
{
|
||||
Q_D(const QAbstractOpenGLFunctions);
|
||||
return d->initialized;
|
||||
}
|
||||
|
||||
void QAbstractOpenGLFunctions::setOwningContext(const QOpenGLContext *context)
|
||||
{
|
||||
Q_D(QAbstractOpenGLFunctions);
|
||||
d->owningContext = const_cast<QOpenGLContext*>(context);
|
||||
}
|
||||
|
||||
QOpenGLContext *QAbstractOpenGLFunctions::owningContext() const
|
||||
{
|
||||
Q_D(const QAbstractOpenGLFunctions);
|
||||
return d->owningContext;
|
||||
}
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
|
13
util/glgen/qopenglversionfunctions.h.footer
Normal file
13
util/glgen/qopenglversionfunctions.h.footer
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
#else
|
||||
|
||||
// No need for backend classes with function pointers with ES2.
|
||||
// All function addresses are independent of context and display.
|
||||
|
||||
#endif // !QT_OPENGL_ES_2
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif
|
163
util/glgen/qopenglversionfunctions.h.header
Normal file
163
util/glgen/qopenglversionfunctions.h.header
Normal file
@ -0,0 +1,163 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENGLVERSIONFUNCTIONS_H
|
||||
#define QOPENGLVERSIONFUNCTIONS_H
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qpair.h>
|
||||
#include <QtGui/qopengl.h>
|
||||
|
||||
class QOpenGLContext;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if 0
|
||||
// silence syncqt warnings
|
||||
#pragma qt_class(QOpenGLVersionFunctions)
|
||||
#pragma qt_sync_stop_processing
|
||||
#endif
|
||||
|
||||
struct QOpenGLVersionStatus
|
||||
{
|
||||
enum OpenGLStatus {
|
||||
CoreStatus,
|
||||
DeprecatedStatus,
|
||||
InvalidStatus
|
||||
};
|
||||
|
||||
QOpenGLVersionStatus()
|
||||
: version(qMakePair(0, 0)),
|
||||
status(InvalidStatus)
|
||||
{}
|
||||
|
||||
QOpenGLVersionStatus(int majorVersion, int minorVersion, QOpenGLVersionStatus::OpenGLStatus functionStatus)
|
||||
: version(qMakePair(majorVersion, minorVersion)),
|
||||
status(functionStatus)
|
||||
{}
|
||||
|
||||
QPair<int, int> version;
|
||||
OpenGLStatus status;
|
||||
};
|
||||
|
||||
inline uint qHash(const QOpenGLVersionStatus &v, uint seed)
|
||||
{
|
||||
return qHash(static_cast<int>(v.status * 1000)
|
||||
+ v.version.first * 100 + v.version.second * 10, seed);
|
||||
}
|
||||
|
||||
inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
|
||||
{
|
||||
if (lhs.status != rhs.status)
|
||||
return false;
|
||||
return lhs.version == rhs.version;
|
||||
}
|
||||
|
||||
inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
|
||||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
class QOpenGLVersionFunctionsBackend
|
||||
{
|
||||
public:
|
||||
QOpenGLVersionFunctionsBackend(QOpenGLContext *ctx)
|
||||
: context(ctx)
|
||||
{}
|
||||
|
||||
QOpenGLContext *context;
|
||||
QAtomicInt refs;
|
||||
};
|
||||
|
||||
class QAbstractOpenGLFunctionsPrivate
|
||||
{
|
||||
public:
|
||||
QAbstractOpenGLFunctionsPrivate()
|
||||
: owningContext(0),
|
||||
initialized(false)
|
||||
{}
|
||||
|
||||
static QOpenGLVersionFunctionsBackend *functionsBackend(QOpenGLContext *context,
|
||||
const QOpenGLVersionStatus &v);
|
||||
static void insertFunctionsBackend(QOpenGLContext *context,
|
||||
const QOpenGLVersionStatus &v,
|
||||
QOpenGLVersionFunctionsBackend *backend);
|
||||
static void removeFunctionsBackend(QOpenGLContext *context, const QOpenGLVersionStatus &v);
|
||||
|
||||
QOpenGLContext *owningContext;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
class QAbstractOpenGLFunctions
|
||||
{
|
||||
public:
|
||||
virtual ~QAbstractOpenGLFunctions();
|
||||
|
||||
virtual bool initializeOpenGLFunctions();
|
||||
|
||||
Q_DECLARE_PRIVATE(QAbstractOpenGLFunctions)
|
||||
|
||||
protected:
|
||||
QAbstractOpenGLFunctions();
|
||||
QAbstractOpenGLFunctionsPrivate *d_ptr;
|
||||
|
||||
bool isInitialized() const;
|
||||
|
||||
void setOwningContext(const QOpenGLContext *context);
|
||||
QOpenGLContext *owningContext() const;
|
||||
|
||||
friend class QOpenGLContext;
|
||||
};
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
|
2
util/glgen/qopenglversionfunctions__VERSION__.cpp.footer
Normal file
2
util/glgen/qopenglversionfunctions__VERSION__.cpp.footer
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
QT_END_NAMESPACE
|
55
util/glgen/qopenglversionfunctions__VERSION__.cpp.header
Normal file
55
util/glgen/qopenglversionfunctions__VERSION__.cpp.header
Normal file
@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenglfunctions__VERSION__.h"
|
||||
#include "qopenglcontext.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
6
util/glgen/qopenglversionfunctions__VERSION__.h.footer
Normal file
6
util/glgen/qopenglversionfunctions__VERSION__.h.footer
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif
|
60
util/glgen/qopenglversionfunctions__VERSION__.h.header
Normal file
60
util/glgen/qopenglversionfunctions__VERSION__.h.header
Normal file
@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENGLVERSIONFUNCTIONS__VERSION___H
|
||||
#define QOPENGLVERSIONFUNCTIONS__VERSION___H
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include <QtGui/QOpenGLVersionFunctions>
|
||||
#include <QtGui/qopenglcontext.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
2
util/glgen/qopenglversionfunctionsfactory.cpp.footer
Normal file
2
util/glgen/qopenglversionfunctionsfactory.cpp.footer
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
QT_END_NAMESPACE
|
52
util/glgen/qopenglversionfunctionsfactory.cpp.header
Normal file
52
util/glgen/qopenglversionfunctionsfactory.cpp.header
Normal file
@ -0,0 +1,52 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenglversionfunctionsfactory_p.h"
|
||||
|
73
util/glgen/qopenglversionfunctionsfactory_p.h.header
Normal file
73
util/glgen/qopenglversionfunctionsfactory_p.h.header
Normal file
@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
**
|
||||
** This file was generated by glgen version 0.1
|
||||
** Command line was: glgen
|
||||
**
|
||||
** glgen is Copyright (C) 2012 Klaralvdalens Datakonsult AB (KDAB)
|
||||
**
|
||||
** This is an auto-generated file.
|
||||
** Do not edit! All changes made to it will be lost.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENGLVERSIONFUNCTIONFACTORY_P_H
|
||||
#define QOPENGLVERSIONFUNCTIONFACTORY_P_H
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtGui/qopenglcontext.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAbstractOpenGLFunctions;
|
||||
|
||||
class QOpenGLVersionFunctionsFactory
|
||||
{
|
||||
public:
|
||||
static QAbstractOpenGLFunctions *create(const QOpenGLVersionProfile &versionProfile);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif
|
307
util/glgen/specparser.cpp
Normal file
307
util/glgen/specparser.cpp
Normal file
@ -0,0 +1,307 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the utilities 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "specparser.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef SPECPARSER_DEBUG
|
||||
#define qSpecParserDebug qDebug
|
||||
#else
|
||||
#define qSpecParserDebug QT_NO_QDEBUG_MACRO
|
||||
#endif
|
||||
|
||||
SpecParser::SpecParser()
|
||||
{
|
||||
}
|
||||
|
||||
void SpecParser::parse()
|
||||
{
|
||||
// Get the mapping form generic types to specific types suitable for use in C-headers
|
||||
if (!parseTypeMap())
|
||||
return;
|
||||
|
||||
// Open up a stream on the actual OpenGL function spec file
|
||||
QFile file(m_specFileName);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qWarning() << "Failed to open spec file:" << m_specFileName << "Aborting";
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream stream(&file);
|
||||
|
||||
// Extract the info that we need
|
||||
parseFunctions(stream);
|
||||
}
|
||||
|
||||
bool SpecParser::parseTypeMap()
|
||||
{
|
||||
QFile file(m_typeMapFileName);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qWarning() << "Failed to open spec file:" << m_specFileName << "Aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
QTextStream stream(&file);
|
||||
|
||||
static QRegExp typeMapRegExp("([^,]+)\\W+([^,]+)");
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
QString line = stream.readLine();
|
||||
|
||||
if (line.startsWith(QStringLiteral("#")))
|
||||
continue;
|
||||
|
||||
if (typeMapRegExp.indexIn(line) != -1) {
|
||||
QString key = typeMapRegExp.cap(1).simplified();
|
||||
QString value = typeMapRegExp.cap(2).simplified();
|
||||
|
||||
// Special case for void
|
||||
if (value == QStringLiteral("*"))
|
||||
value = QStringLiteral("void");
|
||||
|
||||
m_typeMap.insert(key, value);
|
||||
qSpecParserDebug() << "Found type mapping from" << key << "=>" << value;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpecParser::parseEnums()
|
||||
{
|
||||
}
|
||||
|
||||
void SpecParser::parseFunctions(QTextStream &stream)
|
||||
{
|
||||
static QRegExp functionRegExp("^(\\w+)\\(.*\\)");
|
||||
static QRegExp returnRegExp("^\\treturn\\s+(\\S+)");
|
||||
static QRegExp argumentRegExp("param\\s+(\\S+)\\s+(\\S+) (\\S+) (\\S+)");
|
||||
static QRegExp versionRegExp("^\\tversion\\s+(\\S+)");
|
||||
static QRegExp deprecatedRegExp("^\\tdeprecated\\s+(\\S+)");
|
||||
static QRegExp categoryRegExp("^\\tcategory\\s+(\\S+)");
|
||||
static QRegExp categoryVersionRegExp("VERSION_(\\d)_(\\d)");
|
||||
static QRegExp extToCoreVersionRegExp("passthru:\\s/\\*\\sOpenGL\\s(\\d)\\.(\\d)\\s.*\\sextensions:");
|
||||
static QRegExp extToCoreRegExp("passthru:\\s/\\*\\s(ARB_\\S*)\\s.*\\*/");
|
||||
|
||||
Function currentFunction;
|
||||
VersionProfile currentVersionProfile;
|
||||
QString currentCategory;
|
||||
bool haveVersionInfo = false;
|
||||
bool acceptCurrentFunctionInCore = false;
|
||||
bool acceptCurrentFunctionInExtension = false;
|
||||
|
||||
QHash<QString, Version> extensionsNowInCore;
|
||||
Version extToCoreCurrentVersion;
|
||||
int functionCount = 0;
|
||||
|
||||
QSet<Version> versions;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
QString line = stream.readLine();
|
||||
if (line.startsWith("#"))
|
||||
continue;
|
||||
|
||||
if (functionRegExp.indexIn(line) != -1) {
|
||||
|
||||
if (!currentFunction.name.isEmpty()) {
|
||||
|
||||
// NB - Special handling!
|
||||
// Versions 4.2 and 4.3 (and probably newer) add functionality by
|
||||
// subsuming extensions such as ARB_texture_storage. However, some extensions
|
||||
// also include functions to interact with the EXT_direct_state_access
|
||||
// extension. These functions should be added to the DSA extension rather
|
||||
// than the core functionality. The core will already contain non-DSA
|
||||
// versions of these functions.
|
||||
if (acceptCurrentFunctionInCore && currentFunction.name.endsWith(QStringLiteral("EXT"))) {
|
||||
acceptCurrentFunctionInCore = false;
|
||||
acceptCurrentFunctionInExtension = true;
|
||||
currentCategory = QStringLiteral("EXT_direct_state_access");
|
||||
}
|
||||
|
||||
// Finish off previous function (if any) by inserting it into the core
|
||||
// functionality or extension functionality (or both)
|
||||
if (acceptCurrentFunctionInCore) {
|
||||
m_functions.insert(currentVersionProfile, currentFunction);
|
||||
versions.insert(currentVersionProfile.version);
|
||||
}
|
||||
|
||||
if (acceptCurrentFunctionInExtension)
|
||||
m_extensionFunctions.insert(currentCategory, currentFunction);
|
||||
}
|
||||
|
||||
// Start a new function
|
||||
++functionCount;
|
||||
haveVersionInfo = false;
|
||||
acceptCurrentFunctionInCore = true;
|
||||
acceptCurrentFunctionInExtension = false;
|
||||
currentCategory = QString();
|
||||
currentFunction = Function();
|
||||
|
||||
// We assume a core function unless we find a deprecated flag (see below)
|
||||
currentVersionProfile = VersionProfile();
|
||||
currentVersionProfile.profile = VersionProfile::CoreProfile;
|
||||
|
||||
// Extract the function name
|
||||
QString functionName = functionRegExp.cap(1);
|
||||
currentFunction.name = functionName;
|
||||
qSpecParserDebug() << "Found function:" << functionName;
|
||||
|
||||
} else if (argumentRegExp.indexIn(line) != -1) {
|
||||
// Extract info about this function argument
|
||||
Argument arg;
|
||||
arg.name = argumentRegExp.cap(1);
|
||||
|
||||
QString type = argumentRegExp.cap(2); // Lookup in type map
|
||||
arg.type = m_typeMap.value(type);
|
||||
|
||||
QString direction = argumentRegExp.cap(3);
|
||||
if (direction == QStringLiteral("in")) {
|
||||
arg.direction = Argument::In;
|
||||
} else if (direction == QStringLiteral("out")) {
|
||||
arg.direction = Argument::Out;
|
||||
} else {
|
||||
qWarning() << "Invalid argument direction found:" << direction;
|
||||
acceptCurrentFunctionInCore = false;
|
||||
}
|
||||
|
||||
QString mode = argumentRegExp.cap(4);
|
||||
if (mode == QStringLiteral("value")) {
|
||||
arg.mode = Argument::Value;
|
||||
} else if (mode == QStringLiteral("array")) {
|
||||
arg.mode = Argument::Array;
|
||||
} else if (mode == QStringLiteral("reference")) {
|
||||
arg.mode = Argument::Reference;
|
||||
} else {
|
||||
qWarning() << "Invalid argument mode found:" << mode;
|
||||
acceptCurrentFunctionInCore = false;
|
||||
}
|
||||
|
||||
qSpecParserDebug() << " argument:" << arg.type << arg.name;
|
||||
currentFunction.arguments.append(arg);
|
||||
|
||||
} else if (returnRegExp.indexIn(line) != -1) {
|
||||
// Lookup the return type from the typemap
|
||||
QString returnTypeKey = returnRegExp.cap(1).simplified();
|
||||
if (!m_typeMap.contains(returnTypeKey)) {
|
||||
qWarning() << "Unknown return type found:" << returnTypeKey;
|
||||
acceptCurrentFunctionInCore = false;
|
||||
}
|
||||
QString returnType = m_typeMap.value(returnTypeKey);
|
||||
qSpecParserDebug() << " return type:" << returnType;
|
||||
currentFunction.returnType = returnType;
|
||||
|
||||
} else if (versionRegExp.indexIn(line) != -1 && !haveVersionInfo) { // Only use version line if no other source
|
||||
// Extract the OpenGL version in which this function was introduced
|
||||
QString version = versionRegExp.cap(1);
|
||||
qSpecParserDebug() << " version:" << version;
|
||||
QStringList parts = version.split(QLatin1Char('.'));
|
||||
if (parts.size() != 2) {
|
||||
qWarning() << "Found invalid version number";
|
||||
continue;
|
||||
}
|
||||
int majorVersion = parts.first().toInt();
|
||||
int minorVersion = parts.last().toInt();
|
||||
Version v;
|
||||
v.major = majorVersion;
|
||||
v.minor = minorVersion;
|
||||
currentVersionProfile.version = v;
|
||||
|
||||
} else if (deprecatedRegExp.indexIn(line) != -1) {
|
||||
// Extract the OpenGL version in which this function was deprecated.
|
||||
// If it is OpenGL 3.1 then it must be a compatibility profile function
|
||||
QString deprecatedVersion = deprecatedRegExp.cap(1).simplified();
|
||||
if (deprecatedVersion == QStringLiteral("3.1"))
|
||||
currentVersionProfile.profile = VersionProfile::CompatibilityProfile;
|
||||
|
||||
} else if (categoryRegExp.indexIn(line) != -1) {
|
||||
// Extract the category for this function
|
||||
QString category = categoryRegExp.cap(1).simplified();
|
||||
qSpecParserDebug() << " category:" << category;
|
||||
|
||||
if (categoryVersionRegExp.indexIn(category) != -1) {
|
||||
// Use the version info in the category in preference to the version
|
||||
// entry as this is more applicable and consistent
|
||||
int majorVersion = categoryVersionRegExp.cap(1).toInt();
|
||||
int minorVersion = categoryVersionRegExp.cap(2).toInt();
|
||||
|
||||
Version v;
|
||||
v.major = majorVersion;
|
||||
v.minor = minorVersion;
|
||||
currentVersionProfile.version = v;
|
||||
haveVersionInfo = true;
|
||||
|
||||
} else {
|
||||
// Make a note of the extension name and tag this function as being part of an extension
|
||||
qSpecParserDebug() << "Found category =" << category;
|
||||
currentCategory = category;
|
||||
acceptCurrentFunctionInExtension = true;
|
||||
|
||||
// See if this category (extension) is in our set of extensions that
|
||||
// have now been folded into the core feature set
|
||||
if (extensionsNowInCore.contains(category)) {
|
||||
currentVersionProfile.version = extensionsNowInCore.value(category);
|
||||
haveVersionInfo = true;
|
||||
} else {
|
||||
acceptCurrentFunctionInCore = false;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (extToCoreVersionRegExp.indexIn(line) != -1) {
|
||||
qSpecParserDebug() << line;
|
||||
int majorVersion = extToCoreVersionRegExp.cap(1).toInt();
|
||||
int minorVersion = extToCoreVersionRegExp.cap(2).toInt();
|
||||
extToCoreCurrentVersion.major = majorVersion;
|
||||
extToCoreCurrentVersion.minor = minorVersion;
|
||||
|
||||
} else if (extToCoreRegExp.indexIn(line) != -1) {
|
||||
QString extension = extToCoreRegExp.cap(1);
|
||||
extensionsNowInCore.insert(extension, extToCoreCurrentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
m_versions = versions.toList();
|
||||
qSort(m_versions);
|
||||
}
|
209
util/glgen/specparser.h
Normal file
209
util/glgen/specparser.h
Normal file
@ -0,0 +1,209 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the utilities 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef SPECPARSER_H
|
||||
#define SPECPARSER_H
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
|
||||
class QTextStream;
|
||||
|
||||
struct Version {
|
||||
int major;
|
||||
int minor;
|
||||
};
|
||||
|
||||
inline bool operator == (const Version &lhs, const Version &rhs)
|
||||
{
|
||||
return (lhs.major == rhs.major && lhs.minor == rhs.minor);
|
||||
}
|
||||
|
||||
inline bool operator < (const Version &lhs, const Version &rhs)
|
||||
{
|
||||
if (lhs.major != rhs.major)
|
||||
return (lhs.major < rhs.major);
|
||||
else
|
||||
return (lhs.minor < rhs.minor);
|
||||
}
|
||||
|
||||
inline bool operator > (const Version &lhs, const Version &rhs)
|
||||
{
|
||||
if (lhs.major != rhs.major)
|
||||
return (lhs.major > rhs.major);
|
||||
else
|
||||
return (lhs.minor > rhs.minor);
|
||||
}
|
||||
|
||||
inline uint qHash(const Version &v)
|
||||
{
|
||||
return qHash(v.major * 100 + v.minor * 10);
|
||||
}
|
||||
|
||||
struct VersionProfile
|
||||
{
|
||||
enum OpenGLProfile {
|
||||
CoreProfile = 0,
|
||||
CompatibilityProfile
|
||||
};
|
||||
|
||||
inline bool hasProfiles() const
|
||||
{
|
||||
return ( version.major > 3
|
||||
|| (version.major == 3 && version.minor > 1));
|
||||
}
|
||||
|
||||
Version version;
|
||||
OpenGLProfile profile;
|
||||
};
|
||||
|
||||
inline bool operator == (const VersionProfile &lhs, const VersionProfile &rhs)
|
||||
{
|
||||
if (lhs.profile != rhs.profile)
|
||||
return false;
|
||||
return lhs.version == rhs.version;
|
||||
}
|
||||
|
||||
inline bool operator < (const VersionProfile &lhs, const VersionProfile &rhs)
|
||||
{
|
||||
if (lhs.profile != rhs.profile)
|
||||
return (lhs.profile < rhs.profile);
|
||||
return (lhs.version < rhs.version);
|
||||
}
|
||||
|
||||
inline uint qHash(const VersionProfile &v)
|
||||
{
|
||||
return qHash(static_cast<int>(v.profile * 1000) + v.version.major * 100 + v.version.minor * 10);
|
||||
}
|
||||
|
||||
struct Argument
|
||||
{
|
||||
enum Direction {
|
||||
In = 0,
|
||||
Out
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
Value = 0,
|
||||
Array,
|
||||
Reference
|
||||
};
|
||||
|
||||
QString type;
|
||||
QString name;
|
||||
Direction direction;
|
||||
Mode mode;
|
||||
};
|
||||
|
||||
struct Function
|
||||
{
|
||||
QString returnType;
|
||||
QString name;
|
||||
QList<Argument> arguments;
|
||||
};
|
||||
|
||||
typedef QList<Function> FunctionList;
|
||||
typedef QMap<VersionProfile, FunctionList> FunctionCollection;
|
||||
|
||||
class SpecParser
|
||||
{
|
||||
public:
|
||||
explicit SpecParser();
|
||||
|
||||
QString specFileName() const
|
||||
{
|
||||
return m_specFileName;
|
||||
}
|
||||
|
||||
QString typeMapFileName() const
|
||||
{
|
||||
return m_typeMapFileName;
|
||||
}
|
||||
|
||||
QList<Version> versions() const {return m_versions;}
|
||||
QList<VersionProfile> versionProfiles() const {return m_functions.uniqueKeys();}
|
||||
|
||||
QList<Function> functionsForVersion(const VersionProfile &v) const
|
||||
{
|
||||
return m_functions.values(v);
|
||||
}
|
||||
|
||||
QStringList extensions() const
|
||||
{
|
||||
return QStringList(m_extensionFunctions.uniqueKeys());
|
||||
}
|
||||
|
||||
QList<Function> functionsForExtension(const QString &extension)
|
||||
{
|
||||
return m_extensionFunctions.values(extension);
|
||||
}
|
||||
|
||||
void setSpecFileName(QString arg)
|
||||
{
|
||||
m_specFileName = arg;
|
||||
}
|
||||
|
||||
void setTypeMapFileName(QString arg)
|
||||
{
|
||||
m_typeMapFileName = arg;
|
||||
}
|
||||
|
||||
void parse();
|
||||
|
||||
protected:
|
||||
bool parseTypeMap();
|
||||
void parseEnums();
|
||||
void parseFunctions(QTextStream &stream);
|
||||
|
||||
private:
|
||||
QString m_specFileName;
|
||||
QString m_typeMapFileName;
|
||||
|
||||
QMap<QString, QString> m_typeMap;
|
||||
QMultiMap<VersionProfile, Function> m_functions;
|
||||
|
||||
QList<Version> m_versions;
|
||||
|
||||
// Extension support
|
||||
QMultiMap<QString, Function> m_extensionFunctions;
|
||||
};
|
||||
|
||||
#endif // SPECPARSER_H
|
Loading…
x
Reference in New Issue
Block a user