qt 6.5.1 original

This commit is contained in:
kleuter
2023-10-29 23:33:08 +01:00
parent 71d22ab6b0
commit 85d238dfda
21202 changed files with 5499099 additions and 0 deletions

147
util/glgen/README.txt Normal file
View File

@ -0,0 +1,147 @@
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.
Prior to Qt 6, these classes were provided as the openglextensions
module. Because of the new graphics architecture in Qt 6, that module
has been removed.

1080
util/glgen/codegenerator.cpp Normal file

File diff suppressed because it is too large Load Diff

111
util/glgen/codegenerator.h Normal file
View File

@ -0,0 +1,111 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#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

38
util/glgen/glgen.pro Normal file
View File

@ -0,0 +1,38 @@
QT -= gui
QT += core5compat
CONFIG += cmdline
# Uncomment following to enable debug output
#DEFINES += SPECPARSER_DEBUG
TEMPLATE = app
TARGET = glgen
SOURCES += main.cpp \
xmlspecparser.cpp \
legacyspecparser.cpp \
codegenerator.cpp
HEADERS += \
specparser.h \
xmlspecparser.h \
legacyspecparser.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

View File

@ -0,0 +1,275 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "legacyspecparser.h"
#include <QDebug>
#include <QFile>
#include <QRegExp>
#include <QStringList>
#include <QTextStream>
#ifdef SPECPARSER_DEBUG
#define qLegacySpecParserDebug qDebug
#else
#define qLegacySpecParserDebug QT_NO_QDEBUG_MACRO
#endif
bool LegacySpecParser::parse()
{
// Get the mapping form generic types to specific types suitable for use in C-headers
if (!parseTypeMap())
return false;
// Open up a stream on the actual OpenGL function spec file
QFile file(specFileName());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "Failed to open spec file:" << specFileName() << "Aborting";
return false;
}
QTextStream stream(&file);
// Extract the info that we need
parseFunctions(stream);
return true;
}
bool LegacySpecParser::parseTypeMap()
{
QFile file(typeMapFileName());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "Failed to open type file:" << typeMapFileName() << "Aborting";
return false;
}
QTextStream stream(&file);
static QRegExp typeMapRegExp("([^,]+)\\W+([^,]+)");
while (!stream.atEnd()) {
QString line = stream.readLine();
if (line.startsWith(QLatin1Char('#')))
continue;
if (typeMapRegExp.indexIn(line) != -1) {
QString key = typeMapRegExp.cap(1).simplified();
QString value = typeMapRegExp.cap(2).simplified();
// Special case for void
if (value == QLatin1String("*"))
value = QStringLiteral("void");
m_typeMap.insert(key, value);
qLegacySpecParserDebug() << "Found type mapping from" << key << "=>" << value;
}
}
return true;
}
void LegacySpecParser::parseEnums()
{
}
void LegacySpecParser::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(QLatin1String("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) {
FunctionProfile fp;
fp.profile = currentVersionProfile.profile;
fp.function = currentFunction;
m_extensionFunctions.insert(currentCategory, fp);
}
}
// 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;
qLegacySpecParserDebug() << "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 == QLatin1String("in")) {
arg.direction = Argument::In;
} else if (direction == QLatin1String("out")) {
arg.direction = Argument::Out;
} else {
qWarning() << "Invalid argument direction found:" << direction;
acceptCurrentFunctionInCore = false;
}
QString mode = argumentRegExp.cap(4);
if (mode == QLatin1String("value")) {
arg.mode = Argument::Value;
} else if (mode == QLatin1String("array")) {
arg.mode = Argument::Array;
} else if (mode == QLatin1String("reference")) {
arg.mode = Argument::Reference;
} else {
qWarning() << "Invalid argument mode found:" << mode;
acceptCurrentFunctionInCore = false;
}
qLegacySpecParserDebug() << " 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);
qLegacySpecParserDebug() << " 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);
qLegacySpecParserDebug() << " 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 == QLatin1String("3.1") && !inDeprecationException(currentFunction.name))
currentVersionProfile.profile = VersionProfile::CompatibilityProfile;
} else if (categoryRegExp.indexIn(line) != -1) {
// Extract the category for this function
QString category = categoryRegExp.cap(1).simplified();
qLegacySpecParserDebug() << " 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
qLegacySpecParserDebug() << "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) {
qLegacySpecParserDebug() << 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.values();
std::sort(m_versions.begin(), m_versions.end());
}
bool LegacySpecParser::inDeprecationException(const QString &functionName) const
{
return functionName == QLatin1String("TexImage3D");
}

View File

@ -0,0 +1,40 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LEGACYSPECPARSER_H
#define LEGACYSPECPARSER_H
#include "specparser.h"
#include <QStringList>
#include <QVariant>
class QTextStream;
class LegacySpecParser : public SpecParser
{
public:
virtual QList<Version> versions() const {return m_versions;}
virtual bool parse();
protected:
const QMultiHash<VersionProfile, Function> &versionFunctions() const { return m_functions; }
const QMultiMap<QString, FunctionProfile> &extensionFunctions() const { return m_extensionFunctions; }
private:
QMap<QString, QString> m_typeMap;
QMultiHash<VersionProfile, Function> m_functions;
QList<Version> m_versions;
// Extension support
QMultiMap<QString, FunctionProfile> m_extensionFunctions;
bool parseTypeMap();
void parseEnums();
void parseFunctions(QTextStream &stream);
bool inDeprecationException(const QString &functionName) const;
};
#endif // LEGACYSPECPARSER_H

40
util/glgen/main.cpp Normal file
View File

@ -0,0 +1,40 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "codegenerator.h"
#include "legacyspecparser.h"
#include "xmlspecparser.h"
#include <QCommandLineParser>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QCommandLineParser cmdParser;
// flag whether to use legacy or not
QCommandLineOption legacyOption(QStringList() << "l" << "legacy", "Use legacy parser.");
cmdParser.addOption(legacyOption);
cmdParser.process(app);
SpecParser *parser;
if (cmdParser.isSet(legacyOption)) {
parser = new LegacySpecParser();
parser->setTypeMapFileName(QStringLiteral("gl.tm"));
parser->setSpecFileName(QStringLiteral("gl.spec"));
} else {
parser = new XmlSpecParser();
parser->setSpecFileName(QStringLiteral("gl.xml"));
}
parser->parse();
CodeGenerator generator;
generator.setParser(parser);
generator.generateCoreClasses(QStringLiteral("qopenglversionfunctions"));
generator.generateExtensionClasses(QStringLiteral("qopenglextensions"));
delete parser;
return 0;
}

View 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("glEGLImageTargetRenderbufferStorageOES");
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

View File

@ -0,0 +1,38 @@
// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
/***************************************************************************
** 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 !QT_CONFIG(opengles2)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
/***************************************************************************
** 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
#include <QtCore/qglobal.h>
#ifndef QT_NO_OPENGL
#include <QtGui/qopengl.h>
class QOpenGLContext;
QT_BEGIN_NAMESPACE
#if 0
// silence syncqt warnings
#pragma qt_class(QOpenGLExtensions)
#pragma qt_sync_stop_processing
#endif
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 !QT_CONFIG(opengles2)

View File

@ -0,0 +1,8 @@
#else
// No backends for OpenGL ES 2
#endif // !QT_CONFIG(opengles2)
QT_END_NAMESPACE

View File

@ -0,0 +1,183 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/***************************************************************************
** 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 !QT_CONFIG(opengles2)

View 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_CONFIG(opengles2)
QT_END_NAMESPACE
#endif // QT_NO_OPENGL
#endif

View File

@ -0,0 +1,127 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/***************************************************************************
** 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
#include <QtCore/qglobal.h>
#ifndef QT_NO_OPENGL
#include <QtCore/qhash.h>
#include <QtCore/qpair.h>
#include <QtGui/qopengl.h>
QT_BEGIN_NAMESPACE
class QOpenGLContext;
#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 size_t qHash(const QOpenGLVersionStatus &v, size_t 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 !QT_CONFIG(opengles2)

View File

@ -0,0 +1,2 @@
QT_END_NAMESPACE

View File

@ -0,0 +1,18 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/***************************************************************************
** 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

View File

@ -0,0 +1,6 @@
QT_END_NAMESPACE
#endif // QT_NO_OPENGL && !QT_CONFIG(opengles2)
#endif

View File

@ -0,0 +1,25 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/***************************************************************************
** 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
#include <QtCore/qglobal.h>
#if !defined(QT_NO_OPENGL) && !QT_CONFIG(opengles2)
#include <QtGui/QOpenGLVersionFunctions>
#include <QtGui/qopenglcontext.h>
QT_BEGIN_NAMESPACE

View File

@ -0,0 +1,2 @@
QT_END_NAMESPACE

View File

@ -0,0 +1,15 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/***************************************************************************
** 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"

View File

@ -0,0 +1,36 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/***************************************************************************
** 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

224
util/glgen/specparser.h Normal file
View File

@ -0,0 +1,224 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SPECPARSER_H
#define SPECPARSER_H
#include <QStringList>
#include <QVariant>
class QTextStream;
class QXmlStreamReader;
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)
{
return !(lhs == rhs);
}
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 bool operator >= (const Version &lhs, const Version &rhs)
{
return !(lhs < rhs);
}
inline bool operator <= (const Version &lhs, const Version &rhs)
{
return !(lhs > rhs);
}
inline size_t 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)
{
return !(lhs == rhs);
}
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 size_t 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;
};
inline bool operator== (const Argument &lhs, const Argument &rhs)
{
if ((lhs.type != rhs.type) || (lhs.name != rhs.name) || (lhs.direction != rhs.direction)) {
return false;
}
return (lhs.mode != rhs.mode);
}
inline bool operator!= (const Argument &lhs, const Argument &rhs)
{
return !(lhs == rhs);
}
inline bool operator== (const Function &lhs, const Function &rhs)
{
if ((lhs.returnType != rhs.returnType) || (lhs.name != rhs.name)) {
return false;
}
return (lhs.arguments == rhs.arguments);
}
inline bool operator!= (const Function &lhs, const Function &rhs)
{
return !(lhs == rhs);
}
typedef QList<Function> FunctionList;
typedef QMap<VersionProfile, FunctionList> FunctionCollection;
struct FunctionProfile
{
VersionProfile::OpenGLProfile profile;
Function function;
};
class SpecParser
{
public:
virtual ~SpecParser() {}
QString specFileName() const
{
return m_specFileName;
}
QString typeMapFileName() const
{
return m_typeMapFileName;
}
virtual QList<Version> versions() const = 0;
QList<VersionProfile> versionProfiles() const {return versionFunctions().uniqueKeys();}
QList<Function> functionsForVersion(const VersionProfile &v) const
{
return versionFunctions().values(v);
}
QStringList extensions() const
{
return QStringList(extensionFunctions().uniqueKeys());
}
QList<Function> functionsForExtension(const QString &extension)
{
QList<Function> func;
Q_FOREACH (const FunctionProfile &f, extensionFunctions().values(extension))
func.append(f.function);
return func;
}
void setSpecFileName(QString arg)
{
m_specFileName = arg;
}
void setTypeMapFileName(QString arg)
{
m_typeMapFileName = arg;
}
virtual bool parse() = 0;
protected:
virtual const QMultiHash<VersionProfile, Function> &versionFunctions() const = 0;
virtual const QMultiMap<QString, FunctionProfile> &extensionFunctions() const = 0;
private:
QString m_specFileName;
QString m_typeMapFileName;
};
#endif // SPECPARSER_H

View File

@ -0,0 +1,402 @@
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "xmlspecparser.h"
#include <QDebug>
#include <QFile>
#include <QRegularExpression>
#include <QStringList>
#include <QTextStream>
#include <QXmlStreamReader>
#ifdef SPECPARSER_DEBUG
#define qXmlSpecParserDebug qDebug
#else
#define qXmlSpecParserDebug QT_NO_QDEBUG_MACRO
#endif
bool XmlSpecParser::parse()
{
// Open up a stream on the actual OpenGL function spec file
QFile file(specFileName());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "Failed to open spec file:" << specFileName() << "Aborting";
return false;
}
QXmlStreamReader stream(&file);
// Extract the info that we need
parseFunctions(stream);
return true;
}
void XmlSpecParser::parseParam(QXmlStreamReader &stream, Function &func)
{
Argument arg;
arg.type = QString();
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "ptype") {
if (stream.readNext() == QXmlStreamReader::Characters)
arg.type.append(stream.text().toString());
}
else if (tag == "name") {
if (stream.readNext() == QXmlStreamReader::Characters)
arg.name = stream.text().toString().trimmed();
}
} else if (stream.isCharacters()) {
arg.type.append(stream.text().toString());
} else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "param") {
// compatibility with old spec
QRegularExpression typeRegExp("(const )?(.+)(?<!\\*)((?:(?!\\*$)\\*)*)(\\*)?");
// remove extra whitespace
arg.type = arg.type.trimmed();
// set default
arg.direction = Argument::In;
arg.mode = Argument::Value;
QRegularExpressionMatch exp = typeRegExp.match(arg.type);
if (exp.hasMatch()) {
if (!exp.captured(4).isEmpty()) {
arg.mode = Argument::Reference;
if (exp.captured(1).isEmpty())
arg.direction = Argument::Out;
}
arg.type = exp.captured(2) + exp.captured(3);
}
break;
}
}
}
// remove any excess whitespace
arg.type = arg.type.trimmed();
arg.name = arg.name.trimmed();
// maybe some checks?
func.arguments.append(arg);
}
void XmlSpecParser::parseCommand(QXmlStreamReader &stream)
{
Function func;
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "proto") {
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement() && (stream.name().toString() == "name")) {
if (stream.readNext() == QXmlStreamReader::Characters)
func.name = stream.text().toString();
} else if (stream.isCharacters()) {
func.returnType.append(stream.text().toString());
} else if (stream.isEndElement() && (stream.name().toString() == "proto")) {
break;
}
}
}
if (tag == "param")
parseParam(stream, func);
}
else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "command")
break;
}
}
// maybe checks?
func.returnType = func.returnType.trimmed();
// for compatibility with old spec
if (func.name.startsWith("gl"))
func.name.remove(0, 2);
m_functionList.insert(func.name, func);
}
void XmlSpecParser::parseCommands(QXmlStreamReader &stream)
{
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "command")
parseCommand(stream);
}
else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "commands")
break;
}
}
}
void XmlSpecParser::parseRequire(QXmlStreamReader &stream, FunctionList &funcs)
{
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "command") {
QString func = stream.attributes().value("name").toString();
// for compatibility with old spec
if (func.startsWith("gl"))
func.remove(0, 2);
funcs.append(m_functionList[func]);
}
} else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "require")
break;
}
}
}
void XmlSpecParser::parseRemoveCore(QXmlStreamReader &stream)
{
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "command") {
QString func = stream.attributes().value("name").toString();
// for compatibility with old spec
if (func.startsWith("gl"))
func.remove(0, 2);
// go through list of version and mark as incompatible
Q_FOREACH (const Version& v, m_versions) {
// Combine version and profile for this subset of functions
VersionProfile version;
version.version = v;
version.profile = VersionProfile::CoreProfile;
// Fetch the functions and add to collection for this class
Q_FOREACH (const Function& f, m_functions.values(version)) {
if (f.name == func) {
VersionProfile newVersion;
newVersion.version = v;
newVersion.profile = VersionProfile::CompatibilityProfile;
m_functions.insert(newVersion, f);
m_functions.remove(version, f);
}
}
}
}
} else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "remove")
break;
}
}
}
void XmlSpecParser::parseFeature(QXmlStreamReader &stream)
{
QRegularExpression versionRegExp("(\\d).(\\d)");
QXmlStreamAttributes attributes = stream.attributes();
QRegularExpressionMatch match = versionRegExp.match(attributes.value("number").toString());
if (!match.hasMatch()) {
qWarning() << "Malformed version indicator";
return;
}
if (attributes.value("api").toString() != "gl")
return;
int majorVersion = match.captured(1).toInt();
int minorVersion = match.captured(2).toInt();
Version v;
VersionProfile core, compat;
v.major = majorVersion;
v.minor = minorVersion;
core.version = compat.version = v;
core.profile = VersionProfile::CoreProfile;
compat.profile = VersionProfile::CompatibilityProfile;
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "require") {
FunctionList funcs;
if (stream.attributes().value("profile").toString() == "compatibility") {
parseRequire(stream, funcs);
Q_FOREACH (const Function& f, funcs) {
m_functions.insert(compat, f);
}
} else {
parseRequire(stream, funcs);
Q_FOREACH (const Function& f, funcs) {
m_functions.insert(core, f);
}
}
} else if (tag == "remove") {
if (stream.attributes().value("profile").toString() == "core")
parseRemoveCore(stream);
}
} else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "feature")
break;
}
}
m_versions.append(v);
}
void XmlSpecParser::parseExtension(QXmlStreamReader &stream)
{
QXmlStreamAttributes attributes = stream.attributes();
QString name = attributes.value("name").toString();
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "require") {
if (stream.attributes().value("profile").toString() == "compatibility") {
FunctionList funcs;
parseRequire(stream, funcs);
Q_FOREACH (const Function& f, funcs) {
FunctionProfile fp;
fp.function = f;
fp.profile = VersionProfile::CompatibilityProfile;
m_extensionFunctions.insert(name, fp);
}
} else {
FunctionList funcs;
parseRequire(stream, funcs);
Q_FOREACH (const Function& f, funcs) {
FunctionProfile fp;
fp.function = f;
fp.profile = VersionProfile::CoreProfile;
m_extensionFunctions.insert(name, fp);
}
}
}
} else if (stream.isEndElement()) {
QString tag = stream.name().toString();
if (tag == "extension")
break;
}
}
}
void XmlSpecParser::parseFunctions(QXmlStreamReader &stream)
{
while (!stream.isEndDocument()) {
stream.readNext();
if (stream.isStartElement()) {
QString tag = stream.name().toString();
if (tag == "feature") {
parseFeature(stream);
} else if (tag == "commands") {
parseCommands(stream);
} else if (tag == "extension") {
parseExtension(stream);
}
} else if (stream.isEndElement()) {
stream.readNext();
}
}
// hack - add GL_ARB_imaging to every version after 1.2 inclusive
Version versionThreshold;
versionThreshold.major = 1;
versionThreshold.minor = 2;
QList<FunctionProfile> funcs = m_extensionFunctions.values("GL_ARB_imaging");
VersionProfile vp;
vp.version = versionThreshold;
Q_FOREACH (const FunctionProfile& fp, funcs) {
vp.profile = fp.profile;
m_functions.insert(vp, fp.function);
}
// now we will prune any duplicates
QSet<QString> funcset;
Q_FOREACH (const Version& v, m_versions) {
// check compatibility first
VersionProfile vp;
vp.version = v;
vp.profile = VersionProfile::CompatibilityProfile;
Q_FOREACH (const Function& f, m_functions.values(vp)) {
// remove duplicate
if (funcset.contains(f.name))
m_functions.remove(vp, f);
funcset.insert(f.name);
}
vp.profile = VersionProfile::CoreProfile;
Q_FOREACH (const Function& f, m_functions.values(vp)) {
// remove duplicate
if (funcset.contains(f.name))
m_functions.remove(vp, f);
funcset.insert(f.name);
}
}
}

View File

@ -0,0 +1,45 @@
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef XMLSPECPARSER_H
#define XMLSPECPARSER_H
#include "specparser.h"
#include <QStringList>
#include <QVariant>
class QXmlStreamReader;
class XmlSpecParser : public SpecParser
{
public:
virtual QList<Version> versions() const { return m_versions; }
virtual bool parse();
protected:
const QMultiHash<VersionProfile, Function> &versionFunctions() const { return m_functions; }
const QMultiMap<QString, FunctionProfile> &extensionFunctions() const { return m_extensionFunctions; }
private:
void parseFunctions(QXmlStreamReader &stream);
void parseCommands(QXmlStreamReader &stream);
void parseCommand(QXmlStreamReader &stream);
void parseParam(QXmlStreamReader &stream, Function &func);
void parseFeature(QXmlStreamReader &stream);
void parseExtension(QXmlStreamReader &stream);
void parseRequire(QXmlStreamReader &stream, FunctionList& profile);
void parseRemoveCore(QXmlStreamReader &stream);
QMultiHash<VersionProfile, Function> m_functions;
QList<Version> m_versions;
// Extension support
QMultiMap<QString, FunctionProfile> m_extensionFunctions;
QMap<QString, Function> m_functionList;
};
#endif // XMLSPECPARSER_H