diff options
Diffstat (limited to 'util')
22 files changed, 5261 insertions, 0 deletions
diff --git a/util/glgen/README.txt b/util/glgen/README.txt new file mode 100644 index 0000000000..ea2411f619 --- /dev/null +++ b/util/glgen/README.txt @@ -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/
\ No newline at end of file diff --git a/util/glgen/codegenerator.cpp b/util/glgen/codegenerator.cpp new file mode 100644 index 0000000000..c6a77569dc --- /dev/null +++ b/util/glgen/codegenerator.cpp @@ -0,0 +1,1099 @@ +/*************************************************************************** +** +** 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 <QDebug> +#include <QFile> +#include <QSettings> +#include <QTextStream> + +static const QString extensionRegistryFileName = QStringLiteral("qopengl-extension-registry.ini"); +static const QString extensionIdGroupName = QStringLiteral("ExtensionIds"); + +CodeGenerator::CodeGenerator() + : m_parser(0) +{ +} + +void CodeGenerator::generateCoreClasses(const QString &baseFileName) const +{ + // Output header and implementation files for the backend and base class + writeCoreHelperClasses(baseFileName + QStringLiteral(".h"), Declaration); + writeCoreHelperClasses(baseFileName + QStringLiteral(".cpp"), Definition); + + // Output the per-version and profile public classes + writeCoreClasses(baseFileName); + + // We also need to generate a factory class that can be used by + // QOpenGLContext to actually create version function objects + writeCoreFactoryHeader(baseFileName + QStringLiteral("factory_p.h")); + writeCoreFactoryImplementation(baseFileName + QStringLiteral("factory.cpp")); +} + +void CodeGenerator::generateExtensionClasses(const QString &baseFileName) const +{ + writeExtensionHeader(baseFileName + QStringLiteral(".h")); + writeExtensionImplementation(baseFileName + QStringLiteral(".cpp")); +} + +bool CodeGenerator::isLegacyVersion(Version v) const +{ + return (v.major < 3 || (v.major == 3 && v.minor == 0)); +} + +bool CodeGenerator::versionHasProfiles(Version v) const +{ + VersionProfile vp; + vp.version = v; + return vp.hasProfiles(); +} + +void CodeGenerator::writeCoreHelperClasses(const QString &fileName, ClassComponent component) const +{ + if (!m_parser) + return; + + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + writePreamble(fileName, stream); + + // Iterate over each OpenGL version. For each version output a private class for + // core functions and a private class for deprecated functions. + const QString privateRootClass = QStringLiteral("QOpenGLVersionFunctionsBackend"); + Q_FOREACH (const VersionProfile &versionProfile, m_parser->versionProfiles()) { + switch (component) { + case Declaration: + writeBackendClassDeclaration(stream, versionProfile, privateRootClass); + break; + + case Definition: + writeBackendClassImplementation(stream, versionProfile, privateRootClass); + break; + } + } + + // Write the postamble + writePostamble(fileName, stream); +} + +void CodeGenerator::writeCoreClasses(const QString &baseFileName) const +{ + // Iterate over each OpenGL version. For each version output a public class (for legacy + // versions or two public classes (for modern versions with profiles). Each public class + // is given pointers to private classes containing the actual entry points. For example, + // the class for OpenGL 1.1 will have pointers to the private classes for 1.0 core, 1.1 + // core, 1.0 deprecated and 1.1 deprecated. Whereas the class for OpenGL 3.2 Core profile + // will have pointers to the private classes for 1.0 core, 1.1 core, ..., 3.2 core but + // not to any of the deprecated private classes + QList<ClassComponent> components = (QList<ClassComponent>() << Declaration << Definition); + Q_FOREACH (const ClassComponent &component, components) { + const QString rootClass = QStringLiteral("QAbstractOpenGLFunctions"); + Q_FOREACH (const Version &classVersion, m_parser->versions()) { + VersionProfile v; + v.version = classVersion; + v.profile = VersionProfile::CompatibilityProfile; + + if (isLegacyVersion(classVersion)) { + switch (component) { + case Declaration: + writePublicClassDeclaration(baseFileName, v, rootClass); + break; + + case Definition: + writePublicClassImplementation(baseFileName, v, rootClass); + break; + } + } else { + switch (component) { + case Declaration: + writePublicClassDeclaration(baseFileName, v, rootClass); + v.profile = VersionProfile::CoreProfile; + writePublicClassDeclaration(baseFileName, v, rootClass); + break; + + case Definition: + writePublicClassImplementation(baseFileName, v, rootClass); + v.profile = VersionProfile::CoreProfile; + writePublicClassImplementation(baseFileName, v, rootClass); + break; + } + } + } + } +} + +void CodeGenerator::writeCoreFactoryHeader(const QString &fileName) const +{ + if (!m_parser) + return; + + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + writePreamble(fileName, stream); + + // Write the postamble + writePostamble(fileName, stream); +} + +void CodeGenerator::writeCoreFactoryImplementation(const QString &fileName) const +{ + if (!m_parser) + return; + + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + writePreamble(fileName, stream); + + // Get the set of version functions classes we need to create + QList<Version> versions = m_parser->versions(); + qSort(versions.begin(), versions.end(), qGreater<Version>()); + + // Outout the #include statements + stream << QStringLiteral("#if !defined(QT_OPENGL_ES_2)") << endl; + Q_FOREACH (const Version &classVersion, versions) { + if (!versionHasProfiles(classVersion)) { + stream << QString(QStringLiteral("#include \"qopenglfunctions_%1_%2.h\"")) + .arg(classVersion.major) + .arg(classVersion.minor) << endl; + } else { + const QList<VersionProfile::OpenGLProfile> profiles = (QList<VersionProfile::OpenGLProfile>() + << VersionProfile::CoreProfile << VersionProfile::CompatibilityProfile); + + Q_FOREACH (const VersionProfile::OpenGLProfile profile, profiles) { + const QString profileSuffix = profile == VersionProfile::CoreProfile + ? QStringLiteral("core") + : QStringLiteral("compatibility"); + stream << QString(QStringLiteral("#include \"qopenglfunctions_%1_%2_%3.h\"")) + .arg(classVersion.major) + .arg(classVersion.minor) + .arg(profileSuffix) << endl; + } + } + } + stream << QStringLiteral("#else") << endl; + stream << QStringLiteral("#include \"qopenglfunctions_es2.h\"") << endl; + stream << QStringLiteral("#endif") << endl; + + stream << endl; + + stream << QStringLiteral("QT_BEGIN_NAMESPACE") << endl << endl; + stream << QStringLiteral("QAbstractOpenGLFunctions *QOpenGLVersionFunctionsFactory::create(const QOpenGLVersionProfile &versionProfile)") << endl; + stream << QStringLiteral("{") << endl; + stream << QStringLiteral("#if !defined(QT_OPENGL_ES_2)") << endl; + stream << QStringLiteral(" const int major = versionProfile.version().first;") << endl; + stream << QStringLiteral(" const int minor = versionProfile.version().second;") << endl << endl; + + // Iterate over classes with profiles + stream << QStringLiteral(" if (versionProfile.hasProfiles()) {") << endl; + stream << QStringLiteral(" switch (versionProfile.profile()) {") << endl; + const QList<VersionProfile::OpenGLProfile> profiles = (QList<VersionProfile::OpenGLProfile>() + << VersionProfile::CoreProfile << VersionProfile::CompatibilityProfile); + Q_FOREACH (const VersionProfile::OpenGLProfile profile, profiles) { + const QString caseLabel = profile == VersionProfile::CoreProfile + ? QStringLiteral("QSurfaceFormat::CoreProfile") + : QStringLiteral("QSurfaceFormat::CompatibilityProfile"); + stream << QString(QStringLiteral(" case %1:")).arg(caseLabel) << endl; + + int i = 0; + Q_FOREACH (const Version &classVersion, versions) { + if (!versionHasProfiles(classVersion)) + continue; + + const QString ifString = (i++ == 0) ? QStringLiteral("if") : QStringLiteral("else if"); + stream << QString(QStringLiteral(" %1 (major == %2 && minor == %3)")) + .arg(ifString) + .arg(classVersion.major) + .arg(classVersion.minor) << endl; + + VersionProfile v; + v.version = classVersion; + v.profile = profile; + stream << QString(QStringLiteral(" return new %1;")) + .arg(generateClassName(v)) << endl; + } + + stream << QStringLiteral(" break;") << endl << endl; + } + + stream << QStringLiteral(" case QSurfaceFormat::NoProfile:") << endl; + stream << QStringLiteral(" default:") << endl; + stream << QStringLiteral(" break;") << endl; + stream << QStringLiteral(" };") << endl; + stream << QStringLiteral(" } else {") << endl; + + // Iterate over the legacy classes (no profiles) + int i = 0; + Q_FOREACH (const Version &classVersion, versions) { + if (versionHasProfiles(classVersion)) + continue; + + const QString ifString = (i++ == 0) ? QStringLiteral("if") : QStringLiteral("else if"); + stream << QString(QStringLiteral(" %1 (major == %2 && minor == %3)")) + .arg(ifString) + .arg(classVersion.major) + .arg(classVersion.minor) << endl; + + VersionProfile v; + v.version = classVersion; + stream << QString(QStringLiteral(" return new %1;")) + .arg(generateClassName(v)) << endl; + } + + stream << QStringLiteral(" }") << endl; + stream << QStringLiteral(" return 0;") << endl; + + stream << QStringLiteral("#else") << endl; + stream << QStringLiteral(" Q_UNUSED(versionProfile);") << endl; + stream << QStringLiteral(" return new QOpenGLFunctions_ES2;") << endl; + stream << QStringLiteral("#endif") << endl; + stream << QStringLiteral("}") << endl; + + // Write the postamble + writePostamble(fileName, stream); +} + +/** + \returns all functions to be included in the class defined by \a classVersionProfile + */ +FunctionCollection CodeGenerator::functionCollection( const VersionProfile& classVersionProfile ) const +{ + const Version classVersion = classVersionProfile.version; + FunctionCollection functionSet; + QList<Version> versions = m_parser->versions(); + + // Populate these based upon the class version and profile + Version minVersion; + minVersion.major = 1; + minVersion.minor = 0; + Version maxVersion = classVersion; + QList<VersionProfile::OpenGLProfile> profiles; + profiles << VersionProfile::CoreProfile; // Always need core functions + + if (isLegacyVersion(classVersion) + || (classVersionProfile.hasProfiles() + && classVersionProfile.profile == VersionProfile::CompatibilityProfile)) { + // For versions < 3.1 and Compatibility profile we include both core and deprecated functions + profiles << VersionProfile::CompatibilityProfile; + } + + Q_FOREACH (const Version &v, versions) { + // Only include functions from versions in the range + if (v < minVersion) + continue; + if (v > maxVersion) + break; + + Q_FOREACH (VersionProfile::OpenGLProfile profile, profiles) { + // Combine version and profile for this subset of functions + VersionProfile version; + version.version = v; + version.profile = profile; + + // Fetch the functions and add to collection for this class + QList<Function> functions = m_parser->functionsForVersion(version); + functionSet.insert(version, functions); + } + } + + return functionSet; +} + +void CodeGenerator::writePreamble(const QString &baseFileName, QTextStream &stream, const QString replacement) const +{ + const QString fileName = baseFileName + QStringLiteral(".header"); + if (!QFile::exists(fileName)) + return; + + QFile file(fileName); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream preambleStream(&file); + QString preamble = preambleStream.readAll(); + if (!replacement.isEmpty()) + preamble.replace(QStringLiteral("__VERSION__"), replacement, Qt::CaseSensitive); + stream << preamble; + } +} + +void CodeGenerator::writePostamble(const QString &baseFileName, QTextStream &stream) const +{ + const QString fileName = baseFileName + QStringLiteral(".footer"); + if (!QFile::exists(fileName)) + return; + + QFile file(fileName); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream postambleStream(&file); + QString postamble = postambleStream.readAll(); + stream << postamble; + } +} + +QString CodeGenerator::passByType(const Argument &arg) const +{ + QString passBy; + switch (arg.mode) { + case Argument::Reference: + case Argument::Array: + passBy = QStringLiteral("*"); + break; + + default: + case Argument::Value: + passBy = QString(); + } + return passBy; +} + +QString CodeGenerator::safeArgumentName(const QString& arg) const +{ + if (arg == QStringLiteral("near")) // MS Windows defines near and far + return QStringLiteral("nearVal"); + else if (arg == QStringLiteral("far")) + return QStringLiteral("farVal"); + else if (arg == QStringLiteral("d")) + return QStringLiteral("dd"); // Don't shadow d pointer + else + return arg; +} + +QString CodeGenerator::generateClassName(const VersionProfile &classVersion, ClassVisibility visibility) const +{ + QString className; + switch ( visibility ) { + case Public: { + // Class name and base class + QString profileSuffix; + if (classVersion.hasProfiles()) + profileSuffix = (classVersion.profile == VersionProfile::CoreProfile ? QStringLiteral("_Core") : QStringLiteral("_Compatibility")); + + className = QString(QStringLiteral("QOpenGLFunctions_%1_%2%3")) + .arg(classVersion.version.major) + .arg(classVersion.version.minor) + .arg(profileSuffix); + break; + } + case Private: { + QString statusSuffix = (classVersion.profile == VersionProfile::CoreProfile ? QStringLiteral("_Core") : QStringLiteral("_Deprecated")); + + className = QString(QStringLiteral("QOpenGLFunctions_%1_%2%3Private")) + .arg(classVersion.version.major) + .arg(classVersion.version.minor) + .arg(statusSuffix); + break; + } + } + + return className; +} + +void CodeGenerator::writeBackendClassDeclaration(QTextStream &stream, + const VersionProfile &versionProfile, + const QString &baseClass) const +{ + const QString className = backendClassName(versionProfile); + stream << QString(QStringLiteral("class %1 : public %2")) + .arg(className) + .arg(baseClass) + << endl; + stream << QStringLiteral("{") << endl; + stream << QStringLiteral("public:") << endl; + stream << QString( QStringLiteral(" %1(QOpenGLContext *context);") ).arg(className) << endl << endl; + + // Output function used for generating key used in QOpenGLContextPrivate + stream << QStringLiteral(" static QOpenGLVersionStatus versionStatus();") << endl << endl; + + // Get the functions needed for this class + FunctionList functions = m_parser->functionsForVersion(versionProfile); + FunctionCollection functionSet; + functionSet.insert(versionProfile, functions); + + // Declare the functions + writeClassFunctionDeclarations(stream, functionSet, Private); + + stream << QStringLiteral("};") << endl; + stream << endl; +} + +void CodeGenerator::writeBackendClassImplementation(QTextStream &stream, + const VersionProfile &versionProfile, + const QString &baseClass) const +{ + const QString className = backendClassName(versionProfile); + stream << QString(QStringLiteral("%1::%1(QOpenGLContext *context)")).arg(className) << endl; + stream << QString(QStringLiteral(" : %1(context)")).arg(baseClass) << endl + << QStringLiteral("{") << endl; + + // Resolve the entry points for this set of functions + // Get the functions needed for this class + FunctionList functions = m_parser->functionsForVersion(versionProfile); + FunctionCollection functionSet; + functionSet.insert(versionProfile, functions); + writeEntryPointResolutionCode(stream, functionSet); + + stream << QStringLiteral("}") << endl << endl; + + stream << QString(QStringLiteral("QOpenGLVersionStatus %1::versionStatus()")).arg(className) << endl; + stream << QStringLiteral("{") << endl; + const QString status = versionProfile.profile == VersionProfile::CoreProfile + ? QStringLiteral("QOpenGLVersionStatus::CoreStatus") + : QStringLiteral("QOpenGLVersionStatus::DeprecatedStatus"); + stream << QString(QStringLiteral(" return QOpenGLVersionStatus(%1, %2, %3);")) + .arg(versionProfile.version.major) + .arg(versionProfile.version.minor) + .arg(status) << endl; + stream << QStringLiteral("}") << endl << endl; +} + +QString CodeGenerator::coreClassFileName(const VersionProfile &versionProfile, + const QString& fileExtension) const +{ + QString profileSuffix; + if (versionProfile.hasProfiles()) + profileSuffix = (versionProfile.profile == VersionProfile::CoreProfile ? QStringLiteral("_core") : QStringLiteral("_compatibility")); + + const QString fileName = QString(QStringLiteral("qopenglfunctions_%1_%2%3.%4")) + .arg(versionProfile.version.major) + .arg(versionProfile.version.minor) + .arg(profileSuffix) + .arg(fileExtension); + return fileName; +} + +void CodeGenerator::writePublicClassDeclaration(const QString &baseFileName, + const VersionProfile &versionProfile, + const QString &baseClass) const +{ + const QString fileName = coreClassFileName(versionProfile, QStringLiteral("h")); + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + const QString templateFileName = QString(QStringLiteral("%1__VERSION__.h")) + .arg(baseFileName); + QString profileSuffix; + if (versionProfile.hasProfiles()) + profileSuffix = (versionProfile.profile == VersionProfile::CoreProfile ? QStringLiteral("_CORE") : QStringLiteral("_COMPATIBILITY")); + + const QString versionProfileString = QString(QStringLiteral("_%1_%2%3")) + .arg(versionProfile.version.major) + .arg(versionProfile.version.minor) + .arg(profileSuffix); + writePreamble(templateFileName, stream, versionProfileString); + + // Ctor, dtor, and initialize function; + const QString className = generateClassName(versionProfile, Public); + stream << QString(QStringLiteral("class Q_GUI_EXPORT %1 : public %2")) + .arg(className) + .arg(baseClass) + << endl; + stream << QStringLiteral("{") << endl; + stream << QStringLiteral("public:") << endl; + stream << QString(QStringLiteral(" %1();")).arg(className) << endl; + stream << QString(QStringLiteral(" ~%1();")).arg(className) << endl << endl; + stream << QStringLiteral(" bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;") << endl << endl; + + // Get the functions needed for this class and declare them + FunctionCollection functionSet = functionCollection(versionProfile); + writeClassFunctionDeclarations(stream, functionSet, Public); + + // isCompatible function and backend variables + stream << QStringLiteral("private:") << endl; + stream << QStringLiteral(" friend class QOpenGLContext;") << endl << endl; + stream << QStringLiteral(" static bool isContextCompatible(QOpenGLContext *context);") << endl; + stream << QStringLiteral(" static QOpenGLVersionProfile versionProfile();") << endl << endl; + writeBackendVariableDeclarations(stream, backendsForFunctionCollection(functionSet)); + + stream << QStringLiteral("};") << endl << endl; + + // Output the inline functions that forward OpenGL calls to the backends' entry points + writeClassInlineFunctions(stream, className, functionSet); + + // Write the postamble + writePostamble(templateFileName, stream); +} + +void CodeGenerator::writePublicClassImplementation(const QString &baseFileName, + const VersionProfile &versionProfile, + const QString& baseClass) const +{ + const QString fileName = coreClassFileName(versionProfile, QStringLiteral("cpp")); + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + const QString templateFileName = QString(QStringLiteral("%1__VERSION__.cpp")) + .arg(baseFileName); + QString profileSuffix; + if (versionProfile.hasProfiles()) + profileSuffix = (versionProfile.profile == VersionProfile::CoreProfile ? QStringLiteral("_core") : QStringLiteral("_compatibility")); + + const QString versionProfileString = QString(QStringLiteral("_%1_%2%3")) + .arg(versionProfile.version.major) + .arg(versionProfile.version.minor) + .arg(profileSuffix); + writePreamble(templateFileName, stream, versionProfileString); + + const QString className = generateClassName(versionProfile, Public); + stream << QStringLiteral("/*!") << endl + << QStringLiteral(" \\class ") << className << endl + << QStringLiteral(" \\inmodule QtGui") << endl + << QStringLiteral(" \\since 5.1") << endl + << QStringLiteral(" \\brief The ") << className + << QStringLiteral(" class provides all functions for this version and profile of OpenGL.") << endl << endl + << QStringLiteral(" \\sa QAbstractOpenGLFunctions") << endl + << QStringLiteral("*/") << endl << endl; + + // Get the data we'll need for this class implementation + FunctionCollection functionSet = functionCollection(versionProfile); + QList<VersionProfile> backends = backendsForFunctionCollection(functionSet); + + // Output default constructor + stream << className << QStringLiteral("::") << className << QStringLiteral("()") << endl; + stream << QStringLiteral(" : ") << baseClass << QStringLiteral("()"); + Q_FOREACH (const VersionProfile &v, backends) + stream << endl << QString(QStringLiteral(" , %1(0)")).arg(backendVariableName(v)); + stream << endl << QStringLiteral("{") << endl << QStringLiteral("}") << endl << endl; + + // Output the destructor + stream << className << QStringLiteral("::~") << className << QStringLiteral("()") << endl; + stream << QStringLiteral("{") << endl; + Q_FOREACH (const VersionProfile &v, backends) { + const QString backendVar = backendVariableName(v); + const QString backendClass = backendClassName(v); + stream << QString(QStringLiteral(" if (%1 && !%1->refs.deref()) {")).arg(backendVar) << endl; + stream << QString(QStringLiteral(" QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(%1->context, %2::versionStatus());")) + .arg(backendVar) + .arg(backendClass) << endl; + stream << QString(QStringLiteral(" delete %1;")).arg(backendVar) << endl; + stream << QStringLiteral(" }") << endl; + } + stream << QStringLiteral("}") << endl << endl; + + // Output the initialize function that creates the backend objects + stream << QString(QStringLiteral("bool %1::initializeOpenGLFunctions()")).arg(className) << endl; + stream << QStringLiteral("{") << endl; + + stream << QStringLiteral(" if ( isInitialized() )") << endl; + stream << QStringLiteral(" return true;") << endl << endl; + stream << QStringLiteral(" QOpenGLContext* context = QOpenGLContext::currentContext();") << endl << endl; + stream << QStringLiteral(" // If owned by a context object make sure it is current.") << endl; + stream << QStringLiteral(" // Also check that current context is capable of resolving all needed functions") << endl; + stream << QStringLiteral(" if (((owningContext() && owningContext() == context) || !owningContext())") << endl; + stream << QString(QStringLiteral(" && %1::isContextCompatible(context))")).arg(className) << endl; + stream << QStringLiteral(" {") << endl; + stream << QStringLiteral(" // Associate with private implementation, creating if necessary") << endl; + stream << QStringLiteral(" // Function pointers in the backends are resolved at creation time") << endl; + stream << QStringLiteral(" QOpenGLVersionFunctionsBackend* d = 0;") << endl; + + Q_FOREACH (const VersionProfile &v, backends) { + const QString backendClass = backendClassName(v); + const QString backendVar = backendVariableName(v); + stream << QString(QStringLiteral(" d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, %1::versionStatus());")) + .arg(backendClass) << endl; + stream << QStringLiteral(" if (!d) {") << endl; + stream << QString(QStringLiteral(" d = new %1(context);")).arg(backendClass) << endl; + stream << QString(QStringLiteral(" QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, %1::versionStatus(), d);")) + .arg(backendClass) << endl; + stream << QStringLiteral(" }") << endl; + stream << QString(QStringLiteral(" %1 = static_cast<%2*>(d);")).arg(backendVar).arg(backendClass) << endl; + stream << QStringLiteral(" d->refs.ref();") << endl << endl; + } + + stream << QStringLiteral(" QAbstractOpenGLFunctions::initializeOpenGLFunctions();") << endl; + stream << QStringLiteral(" }") << endl; + + stream << QStringLiteral(" return isInitialized();") << endl; + stream << QStringLiteral("}") << endl << endl; + + // Output the context compatibility check function + stream << QString(QStringLiteral("bool %1::isContextCompatible(QOpenGLContext *context)")).arg(className) << endl; + stream << QStringLiteral("{") << endl; + stream << QStringLiteral(" Q_ASSERT(context);") << endl; + stream << QStringLiteral(" QSurfaceFormat f = context->format();") << endl; + stream << QStringLiteral(" const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());") << endl; + stream << QString(QStringLiteral(" if (v < qMakePair(%1, %2))")) + .arg(versionProfile.version.major) + .arg(versionProfile.version.minor) << endl; + stream << QStringLiteral(" return false;") << endl << endl; + + // If generating a legacy or compatibility profile class we need to ensure that + // the context does not expose only core functions + if (versionProfile.profile != VersionProfile::CoreProfile) { + stream << QStringLiteral(" if (f.profile() == QSurfaceFormat::CoreProfile)") << endl; + stream << QStringLiteral(" return false;") << endl << endl; + } + + stream << QStringLiteral(" return true;") << endl; + stream << QStringLiteral("}") << endl << endl; + + // Output static function used as helper in template versionFunctions() function + // in QOpenGLContext + stream << QString(QStringLiteral("QOpenGLVersionProfile %1::versionProfile()")).arg(className) << endl; + stream << QStringLiteral("{") << endl; + stream << QStringLiteral(" QOpenGLVersionProfile v;") << endl; + stream << QString(QStringLiteral(" v.setVersion(%1, %2);")) + .arg(versionProfile.version.major) + .arg(versionProfile.version.minor) << endl; + if (versionProfile.hasProfiles()) { + const QString profileName = versionProfile.profile == VersionProfile::CoreProfile + ? QStringLiteral("QSurfaceFormat::CoreProfile") + : QStringLiteral("QSurfaceFormat::CompatibilityProfile"); + stream << QString(QStringLiteral(" v.setProfile(%1);")).arg(profileName) << endl; + } + stream << QStringLiteral(" return v;") << endl; + stream << QStringLiteral("}") << endl; + + // Write the postamble + writePostamble(templateFileName, stream); +} + +void CodeGenerator::writeClassFunctionDeclarations(QTextStream &stream, + const FunctionCollection &functionSet, + ClassVisibility visibility) const +{ + Q_FOREACH (const VersionProfile &version, functionSet.keys()) { + // Add a comment to the header + stream << QString(QStringLiteral(" // OpenGL %1.%2 %3 functions")) + .arg(version.version.major) + .arg(version.version.minor) + .arg((version.profile == VersionProfile::CoreProfile) ? QStringLiteral("core") : QStringLiteral("deprecated")) + << endl; + + // Output function declarations + FunctionList functions = functionSet.value(version); + Q_FOREACH (const Function &f, functions) + writeFunctionDeclaration(stream, f, visibility); + stream << endl; + } // version and profile +} + +void CodeGenerator::writeFunctionDeclaration(QTextStream &stream, const Function &f, ClassVisibility visibility) const +{ + QStringList argList; + Q_FOREACH (const Argument &arg, f.arguments) { + QString a = QString(QStringLiteral("%1%2 %3%4")) + .arg((arg.direction == Argument::In && arg.mode != Argument::Value) ? QStringLiteral("const ") : QString()) + .arg(arg.type) + .arg(passByType(arg)) + .arg(safeArgumentName(arg.name)); + argList.append(a); + } + QString args = argList.join(QStringLiteral(", ")); + + QString signature; + switch (visibility) { + case Public: + signature = QString(QStringLiteral(" %1 gl%2(%3);")).arg(f.returnType).arg(f.name).arg(args); + break; + + case Private: + default: + signature = QString(QStringLiteral(" %1 (QOPENGLF_APIENTRYP %2)(%3);")).arg(f.returnType).arg(f.name).arg(args); + } + stream << signature << endl; +} + +void CodeGenerator::writeClassInlineFunctions(QTextStream &stream, + const QString &className, + const FunctionCollection &functionSet) const +{ + Q_FOREACH (const VersionProfile &version, functionSet.keys()) { + + // Add a comment to the header + stream << QString(QStringLiteral("// OpenGL %1.%2 %3 functions")) + .arg(version.version.major) + .arg(version.version.minor) + .arg((version.profile == VersionProfile::CoreProfile) ? QStringLiteral("core") : QStringLiteral("deprecated")) + << endl; + + // Output function declarations + const QString backendVar = backendVariableName(version); + FunctionList functions = functionSet.value(version); + Q_FOREACH (const Function &f, functions) + writeInlineFunction(stream, className, backendVar, f); + + stream << endl; + + } // version and profile +} + +void CodeGenerator::writeInlineFunction(QTextStream &stream, const QString &className, + const QString &backendVar, const Function &f) const +{ + QStringList argList; + Q_FOREACH (const Argument &arg, f.arguments) { + QString a = QString(QStringLiteral("%1%2 %3%4")) + .arg((arg.direction == Argument::In && arg.mode != Argument::Value) ? QStringLiteral("const ") : QString()) + .arg(arg.type) + .arg(passByType(arg)) + .arg(safeArgumentName(arg.name)); + argList.append(a); + } + QString args = argList.join(", "); + + + QString signature = QString(QStringLiteral("inline %1 %2::gl%3(%4)")) + .arg(f.returnType) + .arg(className) + .arg(f.name) + .arg(args); + stream << signature << endl << QStringLiteral("{") << endl; + + QStringList argumentNames; + Q_FOREACH (const Argument &arg, f.arguments) + argumentNames.append(safeArgumentName(arg.name)); + QString argNames = argumentNames.join(", "); + + if (f.returnType == QStringLiteral("void")) + stream << QString(QStringLiteral(" %1->%2(%3);")).arg(backendVar).arg(f.name).arg(argNames) << endl; + else + stream << QString(QStringLiteral(" return %1->%2(%3);")).arg(backendVar).arg(f.name).arg(argNames) << endl; + stream << QStringLiteral("}") << endl << endl; +} + +void CodeGenerator::writeEntryPointResolutionCode(QTextStream &stream, + const FunctionCollection &functionSet) const +{ + bool hasModuleHandle = false; + Q_FOREACH (const VersionProfile &version, functionSet.keys()) { + + // Add a comment to the header + stream << QString(QStringLiteral(" // OpenGL %1.%2 %3 functions")) + .arg(version.version.major) + .arg(version.version.minor) + .arg((version.profile == VersionProfile::CoreProfile) ? QStringLiteral("core") : QStringLiteral("deprecated")) + << endl; + + // Output function declarations + FunctionList functions = functionSet.value(version); + + bool useGetProcAddress = (version.version.major == 1 && (version.version.minor == 0 || version.version.minor == 1)); + if (useGetProcAddress) { + stream << "#if defined(Q_OS_WIN)" << endl; + if (!hasModuleHandle) { + stream << " HMODULE handle = GetModuleHandleA(\"opengl32.dll\");" << endl; + hasModuleHandle = true; + } + + Q_FOREACH (const Function &f, functions) + writeEntryPointResolutionStatement(stream, f, QString(), useGetProcAddress); + + stream << "#else" << endl; + } + + Q_FOREACH (const Function &f, functions) + writeEntryPointResolutionStatement(stream, f); + + if (useGetProcAddress) + stream << "#endif" << endl; + + stream << endl; + + } // version and profile +} + +void CodeGenerator::writeEntryPointResolutionStatement(QTextStream &stream, const Function &f, + const QString &prefix, bool useGetProcAddress) const +{ + QStringList argList; + Q_FOREACH (const Argument &arg, f.arguments) { + QString a = QString("%1%2 %3") + .arg((arg.direction == Argument::In && arg.mode != Argument::Value) ? QStringLiteral("const ") : QString()) + .arg(arg.type) + .arg(passByType(arg)); + argList.append(a); + } + QString args = argList.join(QStringLiteral(", ")); + + QString signature; + if (!useGetProcAddress) { + signature = QString(QStringLiteral(" %4%3 = reinterpret_cast<%1 (QOPENGLF_APIENTRYP)(%2)>(context->getProcAddress(\"gl%3\"));")) + .arg(f.returnType) + .arg(args) + .arg(f.name) + .arg(prefix); + } else { + signature = QString(QStringLiteral(" %4%3 = reinterpret_cast<%1 (QOPENGLF_APIENTRYP)(%2)>(GetProcAddress(handle, \"gl%3\"));")) + .arg(f.returnType) + .arg(args) + .arg(f.name) + .arg(prefix); + } + stream << signature << endl; +} + +QList<VersionProfile> CodeGenerator::backendsForFunctionCollection(const FunctionCollection &functionSet) const +{ + QList<VersionProfile> backends; + Q_FOREACH (const VersionProfile &versionProfile, functionSet.keys()) { + if (m_parser->versionProfiles().contains(versionProfile)) + backends.append(versionProfile); + } + return backends; +} + +QString CodeGenerator::backendClassName(const VersionProfile &v) const +{ + QString statusSuffix = v.profile == VersionProfile::CoreProfile + ? QStringLiteral("_Core") + : QStringLiteral("_Deprecated"); + const QString className = QString(QStringLiteral("QOpenGLFunctions_%1_%2%3Backend")) + .arg(v.version.major) + .arg(v.version.minor) + .arg(statusSuffix); + return className; +} + +QString CodeGenerator::backendVariableName(const VersionProfile &v) const +{ + const QString status = (v.profile == VersionProfile::CoreProfile) + ? QStringLiteral("Core") + : QStringLiteral("Deprecated"); + const QString varName = QString(QStringLiteral("d_%1_%2_%3")) + .arg(v.version.major) + .arg(v.version.minor) + .arg(status); + return varName; +} + +void CodeGenerator::writeBackendVariableDeclarations(QTextStream &stream, const QList<VersionProfile> &backends) const +{ + // We need a private class for each version and profile (status: core or deprecated) + Q_FOREACH (const VersionProfile &v, backends) { + const QString className = backendClassName(v); + const QString varName = backendVariableName(v); + stream << QString(QStringLiteral(" %1* %2;")).arg(className).arg(varName) << endl; + } +} + +void CodeGenerator::writeExtensionHeader(const QString &fileName) const +{ + if (!m_parser) + return; + + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + writePreamble(fileName, stream); + + // Iterate through the list of extensions and create one class per extension + QStringList extensions = m_parser->extensions(); + Q_FOREACH (const QString &extension, extensions) { + writeExtensionClassDeclaration(stream, extension, Private); + writeExtensionClassDeclaration(stream, extension, Public); + } + + // Write the postamble + writePostamble(fileName, stream); +} + +void CodeGenerator::writeExtensionImplementation(const QString &fileName) const +{ + if (!m_parser) + return; + + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + QTextStream stream(&file); + + // Write the preamble + writePreamble(fileName, stream); + + // Iterate through the list of extensions and create one class per extension + QStringList extensions = m_parser->extensions(); + Q_FOREACH (const QString &extension, extensions) + writeExtensionClassImplementation(stream, extension); + + // Write the postamble + writePostamble(fileName, stream); +} + +void CodeGenerator::writeExtensionClassDeclaration(QTextStream &stream, const QString &extension, ClassVisibility visibility) const +{ + const QString className = generateExtensionClassName(extension, visibility); + + QString baseClass = (visibility == Public) ? QStringLiteral("QAbstractOpenGLExtension") : QStringLiteral("QAbstractOpenGLExtensionPrivate"); + + stream << QString(QStringLiteral("class %2 : public %3")) + .arg(className) + .arg(baseClass) + << endl << "{" << endl << "public:" << endl; + + if (visibility == Public) { + // Default constructor + stream << QStringLiteral(" ") << className << QStringLiteral("();") << endl << endl; + + // Base class virtual function(s) + QString resolveFunction = QStringLiteral(" bool initializeOpenGLFunctions() Q_DECL_FINAL;"); + stream << resolveFunction << endl << endl; + } + + // Output the functions provided by this extension + QList<Function> functions = m_parser->functionsForExtension(extension); + Q_FOREACH (const Function &f, functions) + writeFunctionDeclaration(stream, f, visibility); + + if (visibility == Public) { + // Write out the protected ctor + stream << endl << QStringLiteral("protected:") << endl; + stream << QStringLiteral(" Q_DECLARE_PRIVATE(") << className << QStringLiteral(")") << endl; + } + + // End the class declaration + stream << QStringLiteral("};") << endl << endl; + + // Output the inline functions for public class + if (visibility == Public) { + Q_FOREACH (const Function &f, functions) + writeExtensionInlineFunction(stream, className, f); + } +} + +void CodeGenerator::writeExtensionInlineFunction(QTextStream &stream, const QString &className, const Function &f) const +{ + QStringList argList; + Q_FOREACH (const Argument &arg, f.arguments) { + QString a = QString(QStringLiteral("%1%2 %3%4")) + .arg((arg.direction == Argument::In && arg.mode != Argument::Value) ? QStringLiteral("const ") : QString()) + .arg(arg.type) + .arg(passByType(arg)) + .arg(safeArgumentName(arg.name)); + argList.append(a); + } + QString args = argList.join(", "); + + + QString signature = QString(QStringLiteral("inline %1 %2::gl%3(%4)")) + .arg(f.returnType) + .arg(className) + .arg(f.name) + .arg(args); + stream << signature << endl << QStringLiteral("{") << endl; + + stream << QString(QStringLiteral(" Q_D(%1);")).arg(className) << endl; + + QStringList argumentNames; + Q_FOREACH (const Argument &arg, f.arguments) + argumentNames.append(safeArgumentName(arg.name)); + QString argNames = argumentNames.join(", "); + + if (f.returnType == QStringLiteral("void")) + stream << QString(QStringLiteral(" d->%1(%2);")).arg(f.name).arg(argNames) << endl; + else + stream << QString(QStringLiteral(" return d->%1(%2);")).arg(f.name).arg(argNames) << endl; + stream << QStringLiteral("}") << endl << endl; +} + +void CodeGenerator::writeExtensionClassImplementation(QTextStream &stream, const QString &extension) const +{ + const QString className = generateExtensionClassName(extension); + const QString privateClassName = generateExtensionClassName(extension, Private); + + // Output default constructor + stream << className << QStringLiteral("::") << className << QStringLiteral("()") << endl; + stream << QStringLiteral(" : QAbstractOpenGLExtension(*(new ") << privateClassName << QStringLiteral("))") << endl; + stream << QStringLiteral("{") << endl << QStringLiteral("}") << endl << endl; + + + // Output function to initialize this class + stream << QStringLiteral("bool ") << className + << QStringLiteral("::initializeOpenGLFunctions()") << endl + << QStringLiteral("{") << endl; + + stream << QStringLiteral(" if (isInitialized())") << endl; + stream << QStringLiteral(" return true;") << endl << endl; + + stream << QStringLiteral(" QOpenGLContext *context = QOpenGLContext::currentContext();") << endl; + stream << QStringLiteral(" if (!context) {") << endl; + stream << QStringLiteral(" qWarning(\"A current OpenGL context is required to resolve OpenGL extension functions\");") + << endl; + stream << QStringLiteral(" return false;") << endl; + stream << QStringLiteral(" }") << endl << endl; + + // Output code to resolve entry points for this class + stream << QStringLiteral(" // Resolve the functions") << endl; + stream << QStringLiteral(" Q_D(") << className << QStringLiteral(");") << endl; + stream << endl; + + // Output function declarations + QList<Function> functions = m_parser->functionsForExtension(extension); + Q_FOREACH (const Function &f, functions) + writeEntryPointResolutionStatement(stream, f, QStringLiteral("d->")); + + // Call the base class implementation + stream << QStringLiteral(" QAbstractOpenGLExtension::initializeOpenGLFunctions();") << endl; + + // Finish off + stream << QStringLiteral(" return true;") << endl; + stream << QStringLiteral("}") << endl << endl; +} + +QString CodeGenerator::generateExtensionClassName(const QString &extension, ClassVisibility visibility) const +{ + QString visibilitySuffix; + if (visibility == Private) + visibilitySuffix = QStringLiteral("Private"); + + return QString(QStringLiteral("QOpenGLExtension_%1%2")) + .arg(extension) + .arg(visibilitySuffix); +} diff --git a/util/glgen/codegenerator.h b/util/glgen/codegenerator.h new file mode 100644 index 0000000000..7ad4d49e8d --- /dev/null +++ b/util/glgen/codegenerator.h @@ -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 diff --git a/util/glgen/glgen.pro b/util/glgen/glgen.pro new file mode 100644 index 0000000000..9208ba9e8e --- /dev/null +++ b/util/glgen/glgen.pro @@ -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 diff --git a/util/glgen/main.cpp b/util/glgen/main.cpp new file mode 100644 index 0000000000..15c311caf3 --- /dev/null +++ b/util/glgen/main.cpp @@ -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; +} diff --git a/util/glgen/qopenglextensions.cpp.footer b/util/glgen/qopenglextensions.cpp.footer new file mode 100644 index 0000000000..d7bd157743 --- /dev/null +++ b/util/glgen/qopenglextensions.cpp.footer @@ -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 + diff --git a/util/glgen/qopenglextensions.cpp.header b/util/glgen/qopenglextensions.cpp.header new file mode 100644 index 0000000000..6a9f639d5d --- /dev/null +++ b/util/glgen/qopenglextensions.cpp.header @@ -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) + diff --git a/util/glgen/qopenglextensions.h.footer b/util/glgen/qopenglextensions.h.footer new file mode 100644 index 0000000000..b8a8e6f267 --- /dev/null +++ b/util/glgen/qopenglextensions.h.footer @@ -0,0 +1,1520 @@ + +#else + +class QOpenGLExtension_OES_EGL_imagePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image); + void (QOPENGLF_APIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image); +}; + +class Q_GUI_EXPORT QOpenGLExtension_OES_EGL_image : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_OES_EGL_image(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image); + void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_OES_EGL_image) +}; + +inline void QOpenGLExtension_OES_EGL_image::glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) +{ + Q_D(QOpenGLExtension_OES_EGL_image); + d->EGLImageTargetTexture2DOES(target, image); +} + +inline void QOpenGLExtension_OES_EGL_image::glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) +{ + Q_D(QOpenGLExtension_OES_EGL_image); + d->EGLImageTargetRenderbufferStorageOES(target, image); +} + +class QOpenGLExtension_OES_get_program_binaryPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP GetProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); + void (QOPENGLF_APIENTRYP ProgramBinaryOES)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +}; + +class Q_GUI_EXPORT QOpenGLExtension_OES_get_program_binary : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_OES_get_program_binary(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); + void glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_OES_get_program_binary) +}; + +inline void QOpenGLExtension_OES_get_program_binary::glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) +{ + Q_D(QOpenGLExtension_OES_get_program_binary); + d->GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary); +} + +inline void QOpenGLExtension_OES_get_program_binary::glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) +{ + Q_D(QOpenGLExtension_OES_get_program_binary); + d->ProgramBinaryOES(program, binaryFormat, binary, length); +} + +class QOpenGLExtension_OES_mapbufferPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void* (QOPENGLF_APIENTRYP MapBufferOES)(GLenum target, GLenum access); + GLboolean (QOPENGLF_APIENTRYP UnmapBufferOES)(GLenum target); + void (QOPENGLF_APIENTRYP GetBufferPointervOES)(GLenum target, GLenum pname, GLvoid** params); +}; + +class Q_GUI_EXPORT QOpenGLExtension_OES_mapbuffer : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_OES_mapbuffer(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void* glMapBufferOES(GLenum target, GLenum access); + GLboolean glUnmapBufferOES(GLenum target); + void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_OES_mapbuffer) +}; + +inline void *QOpenGLExtension_OES_mapbuffer::glMapBufferOES(GLenum target, GLenum access) +{ + Q_D(QOpenGLExtension_OES_mapbuffer); + return d->MapBufferOES(target, access); +} + +inline GLboolean QOpenGLExtension_OES_mapbuffer::glUnmapBufferOES(GLenum target) +{ + Q_D(QOpenGLExtension_OES_mapbuffer); + return d->UnmapBufferOES(target); +} + +inline void QOpenGLExtension_OES_mapbuffer::glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params) +{ + Q_D(QOpenGLExtension_OES_mapbuffer); + d->GetBufferPointervOES(target, pname, params); +} + +class QOpenGLExtension_OES_texture_3DPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP TexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); + void (QOPENGLF_APIENTRYP TexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); + void (QOPENGLF_APIENTRYP CopyTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP CompressedTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); + void (QOPENGLF_APIENTRYP CompressedTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); + void (QOPENGLF_APIENTRYP FramebufferTexture3DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +}; + +class Q_GUI_EXPORT QOpenGLExtension_OES_texture_3D : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_OES_texture_3D(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); + void glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); + void glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); + void glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); + void glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_OES_texture_3D) +}; + +inline void QOpenGLExtension_OES_texture_3D::glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + Q_D(QOpenGLExtension_OES_texture_3D); + d->TexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels); +} + +inline void QOpenGLExtension_OES_texture_3D::glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) +{ + Q_D(QOpenGLExtension_OES_texture_3D); + d->TexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); +} + +inline void QOpenGLExtension_OES_texture_3D::glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_OES_texture_3D); + d->CopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height); +} + +inline void QOpenGLExtension_OES_texture_3D::glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) +{ + Q_D(QOpenGLExtension_OES_texture_3D); + d->CompressedTexImage3DOES(target, level, internalformat, width, height, depth, border, imageSize, data); +} + +inline void QOpenGLExtension_OES_texture_3D::glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) +{ + Q_D(QOpenGLExtension_OES_texture_3D); + d->CompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); +} + +inline void QOpenGLExtension_OES_texture_3D::glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) +{ + Q_D(QOpenGLExtension_OES_texture_3D); + d->FramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset); +} + +class QOpenGLExtension_OES_vertex_array_objectPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP BindVertexArrayOES)(GLuint array); + void (QOPENGLF_APIENTRYP DeleteVertexArraysOES)(GLsizei n, const GLuint *arrays); + void (QOPENGLF_APIENTRYP GenVertexArraysOES)(GLsizei n, GLuint *arrays); + GLboolean (QOPENGLF_APIENTRYP IsVertexArrayOES)(GLuint array); +}; + +class Q_GUI_EXPORT QOpenGLExtension_OES_vertex_array_object : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_OES_vertex_array_object(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glBindVertexArrayOES(GLuint array); + void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays); + void glGenVertexArraysOES(GLsizei n, GLuint *arrays); + GLboolean glIsVertexArrayOES(GLuint array); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_OES_vertex_array_object) +}; + +inline void QOpenGLExtension_OES_vertex_array_object::glBindVertexArrayOES(GLuint array) +{ + Q_D(QOpenGLExtension_OES_vertex_array_object); + d->BindVertexArrayOES(array); +} + +inline void QOpenGLExtension_OES_vertex_array_object::glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) +{ + Q_D(QOpenGLExtension_OES_vertex_array_object); + d->DeleteVertexArraysOES(n, arrays); +} + +inline void QOpenGLExtension_OES_vertex_array_object::glGenVertexArraysOES(GLsizei n, GLuint *arrays) +{ + Q_D(QOpenGLExtension_OES_vertex_array_object); + d->GenVertexArraysOES(n, arrays); +} + +inline GLboolean QOpenGLExtension_OES_vertex_array_object::glIsVertexArrayOES(GLuint array) +{ + Q_D(QOpenGLExtension_OES_vertex_array_object); + return d->IsVertexArrayOES(array); +} + +class QOpenGLExtension_AMD_performance_monitorPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP GetPerfMonitorGroupsAMD)(GLint *numGroups, GLsizei groupsSize, GLuint *groups); + void (QOPENGLF_APIENTRYP GetPerfMonitorCountersAMD)(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); + void (QOPENGLF_APIENTRYP GetPerfMonitorGroupStringAMD)(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); + void (QOPENGLF_APIENTRYP GetPerfMonitorCounterStringAMD)(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); + void (QOPENGLF_APIENTRYP GetPerfMonitorCounterInfoAMD)(GLuint group, GLuint counter, GLenum pname, GLvoid *data); + void (QOPENGLF_APIENTRYP GenPerfMonitorsAMD)(GLsizei n, GLuint *monitors); + void (QOPENGLF_APIENTRYP DeletePerfMonitorsAMD)(GLsizei n, GLuint *monitors); + void (QOPENGLF_APIENTRYP SelectPerfMonitorCountersAMD)(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); + void (QOPENGLF_APIENTRYP BeginPerfMonitorAMD)(GLuint monitor); + void (QOPENGLF_APIENTRYP EndPerfMonitorAMD)(GLuint monitor); + void (QOPENGLF_APIENTRYP GetPerfMonitorCounterDataAMD)(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +}; + +class Q_GUI_EXPORT QOpenGLExtension_AMD_performance_monitor : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_AMD_performance_monitor(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups); + void glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); + void glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); + void glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); + void glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data); + void glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors); + void glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors); + void glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); + void glBeginPerfMonitorAMD(GLuint monitor); + void glEndPerfMonitorAMD(GLuint monitor); + void glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_AMD_performance_monitor) +}; + +inline void QOpenGLExtension_AMD_performance_monitor::glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GetPerfMonitorGroupsAMD(numGroups, groupsSize, groups); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GetPerfMonitorGroupStringAMD(group, bufSize, length, groupString); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GetPerfMonitorCounterInfoAMD(group, counter, pname, data); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GenPerfMonitorsAMD(n, monitors); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->DeletePerfMonitorsAMD(n, monitors); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->SelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, countersList); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glBeginPerfMonitorAMD(GLuint monitor) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->BeginPerfMonitorAMD(monitor); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glEndPerfMonitorAMD(GLuint monitor) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->EndPerfMonitorAMD(monitor); +} + +inline void QOpenGLExtension_AMD_performance_monitor::glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) +{ + Q_D(QOpenGLExtension_AMD_performance_monitor); + d->GetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten); +} + +class QOpenGLExtension_ANGLE_framebuffer_blitPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP BlitFramebufferANGLE)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +}; + +class Q_GUI_EXPORT QOpenGLExtension_ANGLE_framebuffer_blit : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_ANGLE_framebuffer_blit(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_ANGLE_framebuffer_blit) +}; + +inline void QOpenGLExtension_ANGLE_framebuffer_blit::glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +{ + Q_D(QOpenGLExtension_ANGLE_framebuffer_blit); + d->BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); +} + +class QOpenGLExtension_ANGLE_framebuffer_multisamplePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP RenderbufferStorageMultisampleANGLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +}; + +class Q_GUI_EXPORT QOpenGLExtension_ANGLE_framebuffer_multisample : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_ANGLE_framebuffer_multisample(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_ANGLE_framebuffer_multisample) +}; + +inline void QOpenGLExtension_ANGLE_framebuffer_multisample::glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_ANGLE_framebuffer_multisample); + d->RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); +} + +class QOpenGLExtension_ANGLE_instanced_arraysPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP DrawArraysInstancedANGLE)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); + void (QOPENGLF_APIENTRYP DrawElementsInstancedANGLE)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); + void (QOPENGLF_APIENTRYP VertexAttribDivisorANGLE)(GLuint index, GLuint divisor); +}; + +class Q_GUI_EXPORT QOpenGLExtension_ANGLE_instanced_arrays : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_ANGLE_instanced_arrays(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); + void glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); + void glVertexAttribDivisorANGLE(GLuint index, GLuint divisor); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_ANGLE_instanced_arrays) +}; + +inline void QOpenGLExtension_ANGLE_instanced_arrays::glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + Q_D(QOpenGLExtension_ANGLE_instanced_arrays); + d->DrawArraysInstancedANGLE(mode, first, count, primcount); +} + +inline void QOpenGLExtension_ANGLE_instanced_arrays::glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount) +{ + Q_D(QOpenGLExtension_ANGLE_instanced_arrays); + d->DrawElementsInstancedANGLE(mode, count, type, indices, primcount); +} + +inline void QOpenGLExtension_ANGLE_instanced_arrays::glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) +{ + Q_D(QOpenGLExtension_ANGLE_instanced_arrays); + d->VertexAttribDivisorANGLE(index, divisor); +} + +class QOpenGLExtension_ANGLE_translated_shader_sourcePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP GetTranslatedShaderSourceANGLE)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +}; + +class Q_GUI_EXPORT QOpenGLExtension_ANGLE_translated_shader_source : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_ANGLE_translated_shader_source(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_ANGLE_translated_shader_source) +}; + +inline void QOpenGLExtension_ANGLE_translated_shader_source::glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source) +{ + Q_D(QOpenGLExtension_ANGLE_translated_shader_source); + d->GetTranslatedShaderSourceANGLE(shader, bufsize, length, source); +} + +class QOpenGLExtension_APPLE_framebuffer_multisamplePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP RenderbufferStorageMultisampleAPPLE)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); + void (QOPENGLF_APIENTRYP ResolveMultisampleFramebufferAPPLE)(void); +}; + +class Q_GUI_EXPORT QOpenGLExtension_APPLE_framebuffer_multisample : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_APPLE_framebuffer_multisample(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + void glResolveMultisampleFramebufferAPPLE(void); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_APPLE_framebuffer_multisample) +}; + +inline void QOpenGLExtension_APPLE_framebuffer_multisample::glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_APPLE_framebuffer_multisample); + d->RenderbufferStorageMultisampleAPPLE(target, samples, internalformat, width, height); +} + +inline void QOpenGLExtension_APPLE_framebuffer_multisample::glResolveMultisampleFramebufferAPPLE(void) +{ + Q_D(QOpenGLExtension_APPLE_framebuffer_multisample); + d->ResolveMultisampleFramebufferAPPLE(); +} + +class QOpenGLExtension_EXT_debug_labelPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP LabelObjectEXT)(GLenum type, GLuint object, GLsizei length, const GLchar *label); + void (QOPENGLF_APIENTRYP GetObjectLabelEXT)(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_debug_label : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_debug_label(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label); + void glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_debug_label) +}; + +inline void QOpenGLExtension_EXT_debug_label::glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label) +{ + Q_D(QOpenGLExtension_EXT_debug_label); + d->LabelObjectEXT(type, object, length, label); +} + +inline void QOpenGLExtension_EXT_debug_label::glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label) +{ + Q_D(QOpenGLExtension_EXT_debug_label); + d->GetObjectLabelEXT(type, object, bufSize, length, label); +} + +class QOpenGLExtension_EXT_debug_markerPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP InsertEventMarkerEXT)(GLsizei length, const GLchar *marker); + void (QOPENGLF_APIENTRYP PushGroupMarkerEXT)(GLsizei length, const GLchar *marker); + void (QOPENGLF_APIENTRYP PopGroupMarkerEXT)(void); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_debug_marker : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_debug_marker(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glInsertEventMarkerEXT(GLsizei length, const GLchar *marker); + void glPushGroupMarkerEXT(GLsizei length, const GLchar *marker); + void glPopGroupMarkerEXT(void); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_debug_marker) +}; + +inline void QOpenGLExtension_EXT_debug_marker::glInsertEventMarkerEXT(GLsizei length, const GLchar *marker) +{ + Q_D(QOpenGLExtension_EXT_debug_marker); + d->InsertEventMarkerEXT(length, marker); +} + +inline void QOpenGLExtension_EXT_debug_marker::glPushGroupMarkerEXT(GLsizei length, const GLchar *marker) +{ + Q_D(QOpenGLExtension_EXT_debug_marker); + d->PushGroupMarkerEXT(length, marker); +} + +inline void QOpenGLExtension_EXT_debug_marker::glPopGroupMarkerEXT(void) +{ + Q_D(QOpenGLExtension_EXT_debug_marker); + d->PopGroupMarkerEXT(); +} + +class QOpenGLExtension_EXT_discard_framebufferPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP DiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum *attachments); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_discard_framebuffer : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_discard_framebuffer(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_discard_framebuffer) +}; + +inline void QOpenGLExtension_EXT_discard_framebuffer::glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) +{ + Q_D(QOpenGLExtension_EXT_discard_framebuffer); + d->DiscardFramebufferEXT(target, numAttachments, attachments); +} + +class QOpenGLExtension_EXT_multisampled_render_to_texturePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP RenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP FramebufferTexture2DMultisampleEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_multisampled_render_to_texture : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_multisampled_render_to_texture(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + void glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_multisampled_render_to_texture) +}; + +inline void QOpenGLExtension_EXT_multisampled_render_to_texture::glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_EXT_multisampled_render_to_texture); + d->RenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height); +} + +inline void QOpenGLExtension_EXT_multisampled_render_to_texture::glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) +{ + Q_D(QOpenGLExtension_EXT_multisampled_render_to_texture); + d->FramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples); +} + +class QOpenGLExtension_EXT_multi_draw_arraysPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); + void (QOPENGLF_APIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_multi_draw_arrays : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_multi_draw_arrays(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); + void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_multi_draw_arrays) +}; + +inline void QOpenGLExtension_EXT_multi_draw_arrays::glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) +{ + Q_D(QOpenGLExtension_EXT_multi_draw_arrays); + d->MultiDrawArraysEXT(mode, first, count, primcount); +} + +inline void QOpenGLExtension_EXT_multi_draw_arrays::glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) +{ + Q_D(QOpenGLExtension_EXT_multi_draw_arrays); + d->MultiDrawElementsEXT(mode, count, type, indices, primcount); +} + +class QOpenGLExtension_EXT_occlusion_query_booleanPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP GenQueriesEXT)(GLsizei n, GLuint *ids); + void (QOPENGLF_APIENTRYP DeleteQueriesEXT)(GLsizei n, const GLuint *ids); + GLboolean (QOPENGLF_APIENTRYP IsQueryEXT)(GLuint id); + void (QOPENGLF_APIENTRYP BeginQueryEXT)(GLenum target, GLuint id); + void (QOPENGLF_APIENTRYP EndQueryEXT)(GLenum target); + void (QOPENGLF_APIENTRYP GetQueryivEXT)(GLenum target, GLenum pname, GLint *params); + void (QOPENGLF_APIENTRYP GetQueryObjectuivEXT)(GLuint id, GLenum pname, GLuint *params); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_occlusion_query_boolean : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_occlusion_query_boolean(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glGenQueriesEXT(GLsizei n, GLuint *ids); + void glDeleteQueriesEXT(GLsizei n, const GLuint *ids); + GLboolean glIsQueryEXT(GLuint id); + void glBeginQueryEXT(GLenum target, GLuint id); + void glEndQueryEXT(GLenum target); + void glGetQueryivEXT(GLenum target, GLenum pname, GLint *params); + void glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_occlusion_query_boolean) +}; + +inline void QOpenGLExtension_EXT_occlusion_query_boolean::glGenQueriesEXT(GLsizei n, GLuint *ids) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + d->GenQueriesEXT(n, ids); +} + +inline void QOpenGLExtension_EXT_occlusion_query_boolean::glDeleteQueriesEXT(GLsizei n, const GLuint *ids) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + d->DeleteQueriesEXT(n, ids); +} + +inline GLboolean QOpenGLExtension_EXT_occlusion_query_boolean::glIsQueryEXT(GLuint id) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + return d->IsQueryEXT(id); +} + +inline void QOpenGLExtension_EXT_occlusion_query_boolean::glBeginQueryEXT(GLenum target, GLuint id) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + d->BeginQueryEXT(target, id); +} + +inline void QOpenGLExtension_EXT_occlusion_query_boolean::glEndQueryEXT(GLenum target) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + d->EndQueryEXT(target); +} + +inline void QOpenGLExtension_EXT_occlusion_query_boolean::glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + d->GetQueryivEXT(target, pname, params); +} + +inline void QOpenGLExtension_EXT_occlusion_query_boolean::glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) +{ + Q_D(QOpenGLExtension_EXT_occlusion_query_boolean); + d->GetQueryObjectuivEXT(id, pname, params); +} + +class QOpenGLExtension_EXT_robustnessPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + GLenum (QOPENGLF_APIENTRYP GetGraphicsResetStatusEXT)(void); + void (QOPENGLF_APIENTRYP ReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); + void (QOPENGLF_APIENTRYP GetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, float *params); + void (QOPENGLF_APIENTRYP GetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint *params); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_robustness : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_robustness(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + GLenum glGetGraphicsResetStatusEXT(void); + void glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); + void glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params); + void glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_robustness) +}; + +inline GLenum QOpenGLExtension_EXT_robustness::glGetGraphicsResetStatusEXT(void) +{ + Q_D(QOpenGLExtension_EXT_robustness); + return d->GetGraphicsResetStatusEXT(); +} + +inline void QOpenGLExtension_EXT_robustness::glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) +{ + Q_D(QOpenGLExtension_EXT_robustness); + d->ReadnPixelsEXT(x, y, width, height, format, type, bufSize, data); +} + +inline void QOpenGLExtension_EXT_robustness::glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params) +{ + Q_D(QOpenGLExtension_EXT_robustness); + d->GetnUniformfvEXT(program, location, bufSize, params); +} + +inline void QOpenGLExtension_EXT_robustness::glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params) +{ + Q_D(QOpenGLExtension_EXT_robustness); + d->GetnUniformivEXT(program, location, bufSize, params); +} + +class QOpenGLExtension_EXT_separate_shader_objectsPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP UseProgramStagesEXT)(GLuint pipeline, GLbitfield stages, GLuint program); + void (QOPENGLF_APIENTRYP ActiveShaderProgramEXT)(GLuint pipeline, GLuint program); + GLuint (QOPENGLF_APIENTRYP CreateShaderProgramvEXT)(GLenum type, GLsizei count, const GLchar **strings); + void (QOPENGLF_APIENTRYP BindProgramPipelineEXT)(GLuint pipeline); + void (QOPENGLF_APIENTRYP DeleteProgramPipelinesEXT)(GLsizei n, const GLuint *pipelines); + void (QOPENGLF_APIENTRYP GenProgramPipelinesEXT)(GLsizei n, GLuint *pipelines); + GLboolean (QOPENGLF_APIENTRYP IsProgramPipelineEXT)(GLuint pipeline); + void (QOPENGLF_APIENTRYP ProgramParameteriEXT)(GLuint program, GLenum pname, GLint value); + void (QOPENGLF_APIENTRYP GetProgramPipelineivEXT)(GLuint pipeline, GLenum pname, GLint *params); + void (QOPENGLF_APIENTRYP ProgramUniform1iEXT)(GLuint program, GLint location, GLint x); + void (QOPENGLF_APIENTRYP ProgramUniform2iEXT)(GLuint program, GLint location, GLint x, GLint y); + void (QOPENGLF_APIENTRYP ProgramUniform3iEXT)(GLuint program, GLint location, GLint x, GLint y, GLint z); + void (QOPENGLF_APIENTRYP ProgramUniform4iEXT)(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); + void (QOPENGLF_APIENTRYP ProgramUniform1fEXT)(GLuint program, GLint location, GLfloat x); + void (QOPENGLF_APIENTRYP ProgramUniform2fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y); + void (QOPENGLF_APIENTRYP ProgramUniform3fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); + void (QOPENGLF_APIENTRYP ProgramUniform4fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (QOPENGLF_APIENTRYP ProgramUniform1ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value); + void (QOPENGLF_APIENTRYP ProgramUniform2ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value); + void (QOPENGLF_APIENTRYP ProgramUniform3ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value); + void (QOPENGLF_APIENTRYP ProgramUniform4ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value); + void (QOPENGLF_APIENTRYP ProgramUniform1fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void (QOPENGLF_APIENTRYP ProgramUniform2fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void (QOPENGLF_APIENTRYP ProgramUniform3fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void (QOPENGLF_APIENTRYP ProgramUniform4fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void (QOPENGLF_APIENTRYP ProgramUniformMatrix2fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (QOPENGLF_APIENTRYP ProgramUniformMatrix3fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (QOPENGLF_APIENTRYP ProgramUniformMatrix4fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (QOPENGLF_APIENTRYP ValidateProgramPipelineEXT)(GLuint pipeline); + void (QOPENGLF_APIENTRYP GetProgramPipelineInfoLogEXT)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_separate_shader_objects : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_separate_shader_objects(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program); + void glActiveShaderProgramEXT(GLuint pipeline, GLuint program); + GLuint glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings); + void glBindProgramPipelineEXT(GLuint pipeline); + void glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines); + void glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines); + GLboolean glIsProgramPipelineEXT(GLuint pipeline); + void glProgramParameteriEXT(GLuint program, GLenum pname, GLint value); + void glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params); + void glProgramUniform1iEXT(GLuint program, GLint location, GLint x); + void glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y); + void glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z); + void glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); + void glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x); + void glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y); + void glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); + void glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); + void glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); + void glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); + void glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); + void glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); + void glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void glValidateProgramPipelineEXT(GLuint pipeline); + void glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_separate_shader_objects) +}; + +inline void QOpenGLExtension_EXT_separate_shader_objects::glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->UseProgramStagesEXT(pipeline, stages, program); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glActiveShaderProgramEXT(GLuint pipeline, GLuint program) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ActiveShaderProgramEXT(pipeline, program); +} + +inline GLuint QOpenGLExtension_EXT_separate_shader_objects::glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + return d->CreateShaderProgramvEXT(type, count, strings); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glBindProgramPipelineEXT(GLuint pipeline) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->BindProgramPipelineEXT(pipeline); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->DeleteProgramPipelinesEXT(n, pipelines); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->GenProgramPipelinesEXT(n, pipelines); +} + +inline GLboolean QOpenGLExtension_EXT_separate_shader_objects::glIsProgramPipelineEXT(GLuint pipeline) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + return d->IsProgramPipelineEXT(pipeline); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramParameteriEXT(GLuint program, GLenum pname, GLint value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramParameteriEXT(program, pname, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->GetProgramPipelineivEXT(pipeline, pname, params); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform1iEXT(GLuint program, GLint location, GLint x) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform1iEXT(program, location, x); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform2iEXT(program, location, x, y); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform3iEXT(program, location, x, y, z); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform4iEXT(program, location, x, y, z, w); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform1fEXT(program, location, x); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform2fEXT(program, location, x, y); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform3fEXT(program, location, x, y, z); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform4fEXT(program, location, x, y, z, w); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform1ivEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform2ivEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform3ivEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform4ivEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform1fvEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform2fvEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform3fvEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniform4fvEXT(program, location, count, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniformMatrix2fvEXT(program, location, count, transpose, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniformMatrix3fvEXT(program, location, count, transpose, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ProgramUniformMatrix4fvEXT(program, location, count, transpose, value); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glValidateProgramPipelineEXT(GLuint pipeline) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->ValidateProgramPipelineEXT(pipeline); +} + +inline void QOpenGLExtension_EXT_separate_shader_objects::glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) +{ + Q_D(QOpenGLExtension_EXT_separate_shader_objects); + d->GetProgramPipelineInfoLogEXT(pipeline, bufSize, length, infoLog); +} + +class QOpenGLExtension_EXT_texture_storagePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP TexStorage1DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); + void (QOPENGLF_APIENTRYP TexStorage2DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP TexStorage3DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); + void (QOPENGLF_APIENTRYP TextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); + void (QOPENGLF_APIENTRYP TextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP TextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +}; + +class Q_GUI_EXPORT QOpenGLExtension_EXT_texture_storage : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_EXT_texture_storage(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); + void glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); + void glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); + void glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); + void glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); + void glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_EXT_texture_storage) +}; + +inline void QOpenGLExtension_EXT_texture_storage::glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) +{ + Q_D(QOpenGLExtension_EXT_texture_storage); + d->TexStorage1DEXT(target, levels, internalformat, width); +} + +inline void QOpenGLExtension_EXT_texture_storage::glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_EXT_texture_storage); + d->TexStorage2DEXT(target, levels, internalformat, width, height); +} + +inline void QOpenGLExtension_EXT_texture_storage::glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) +{ + Q_D(QOpenGLExtension_EXT_texture_storage); + d->TexStorage3DEXT(target, levels, internalformat, width, height, depth); +} + +inline void QOpenGLExtension_EXT_texture_storage::glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) +{ + Q_D(QOpenGLExtension_EXT_texture_storage); + d->TextureStorage1DEXT(texture, target, levels, internalformat, width); +} + +inline void QOpenGLExtension_EXT_texture_storage::glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_EXT_texture_storage); + d->TextureStorage2DEXT(texture, target, levels, internalformat, width, height); +} + +inline void QOpenGLExtension_EXT_texture_storage::glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) +{ + Q_D(QOpenGLExtension_EXT_texture_storage); + d->TextureStorage3DEXT(texture, target, levels, internalformat, width, height, depth); +} + +class QOpenGLExtension_IMG_multisampled_render_to_texturePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP RenderbufferStorageMultisampleIMG)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); + void (QOPENGLF_APIENTRYP FramebufferTexture2DMultisampleIMG)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +}; + +class Q_GUI_EXPORT QOpenGLExtension_IMG_multisampled_render_to_texture : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_IMG_multisampled_render_to_texture(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_IMG_multisampled_render_to_texture) +}; + +inline void QOpenGLExtension_IMG_multisampled_render_to_texture::glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtension_IMG_multisampled_render_to_texture); + d->RenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); +} + +inline void QOpenGLExtension_IMG_multisampled_render_to_texture::glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) +{ + Q_D(QOpenGLExtension_IMG_multisampled_render_to_texture); + d->FramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); +} + +class QOpenGLExtension_NV_coverage_samplePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP CoverageMaskNV)(GLboolean mask); + void (QOPENGLF_APIENTRYP CoverageOperationNV)(GLenum operation); +}; + +class Q_GUI_EXPORT QOpenGLExtension_NV_coverage_sample : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_NV_coverage_sample(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glCoverageMaskNV(GLboolean mask); + void glCoverageOperationNV(GLenum operation); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_NV_coverage_sample) +}; + +inline void QOpenGLExtension_NV_coverage_sample::glCoverageMaskNV(GLboolean mask) +{ + Q_D(QOpenGLExtension_NV_coverage_sample); + d->CoverageMaskNV(mask); +} + +inline void QOpenGLExtension_NV_coverage_sample::glCoverageOperationNV(GLenum operation) +{ + Q_D(QOpenGLExtension_NV_coverage_sample); + d->CoverageOperationNV(operation); +} + +class QOpenGLExtension_NV_draw_buffersPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP DrawBuffersNV)(GLsizei n, const GLenum *bufs); +}; + +class Q_GUI_EXPORT QOpenGLExtension_NV_draw_buffers : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_NV_draw_buffers(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glDrawBuffersNV(GLsizei n, const GLenum *bufs); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_NV_draw_buffers) +}; + +inline void QOpenGLExtension_NV_draw_buffers::glDrawBuffersNV(GLsizei n, const GLenum *bufs) +{ + Q_D(QOpenGLExtension_NV_draw_buffers); + d->DrawBuffersNV(n, bufs); +} + +class QOpenGLExtension_NV_fencePrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP DeleteFencesNV)(GLsizei n, const GLuint *fences); + void (QOPENGLF_APIENTRYP GenFencesNV)(GLsizei n, GLuint *fences); + GLboolean (QOPENGLF_APIENTRYP IsFenceNV)(GLuint fence); + GLboolean (QOPENGLF_APIENTRYP TestFenceNV)(GLuint fence); + void (QOPENGLF_APIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint *params); + void (QOPENGLF_APIENTRYP FinishFenceNV)(GLuint fence); + void (QOPENGLF_APIENTRYP SetFenceNV)(GLuint fence, GLenum condition); +}; + +class Q_GUI_EXPORT QOpenGLExtension_NV_fence : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_NV_fence(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glDeleteFencesNV(GLsizei n, const GLuint *fences); + void glGenFencesNV(GLsizei n, GLuint *fences); + GLboolean glIsFenceNV(GLuint fence); + GLboolean glTestFenceNV(GLuint fence); + void glGetFenceivNV(GLuint fence, GLenum pname, GLint *params); + void glFinishFenceNV(GLuint fence); + void glSetFenceNV(GLuint fence, GLenum condition); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_NV_fence) +}; + +inline void QOpenGLExtension_NV_fence::glDeleteFencesNV(GLsizei n, const GLuint *fences) +{ + Q_D(QOpenGLExtension_NV_fence); + d->DeleteFencesNV(n, fences); +} + +inline void QOpenGLExtension_NV_fence::glGenFencesNV(GLsizei n, GLuint *fences) +{ + Q_D(QOpenGLExtension_NV_fence); + d->GenFencesNV(n, fences); +} + +inline GLboolean QOpenGLExtension_NV_fence::glIsFenceNV(GLuint fence) +{ + Q_D(QOpenGLExtension_NV_fence); + return d->IsFenceNV(fence); +} + +inline GLboolean QOpenGLExtension_NV_fence::glTestFenceNV(GLuint fence) +{ + Q_D(QOpenGLExtension_NV_fence); + return d->TestFenceNV(fence); +} + +inline void QOpenGLExtension_NV_fence::glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) +{ + Q_D(QOpenGLExtension_NV_fence); + d->GetFenceivNV(fence, pname, params); +} + +inline void QOpenGLExtension_NV_fence::glFinishFenceNV(GLuint fence) +{ + Q_D(QOpenGLExtension_NV_fence); + d->FinishFenceNV(fence); +} + +inline void QOpenGLExtension_NV_fence::glSetFenceNV(GLuint fence, GLenum condition) +{ + Q_D(QOpenGLExtension_NV_fence); + d->SetFenceNV(fence, condition); +} + +class QOpenGLExtension_NV_read_bufferPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP ReadBufferNV)(GLenum mode); +}; + +class Q_GUI_EXPORT QOpenGLExtension_NV_read_buffer : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_NV_read_buffer(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glReadBufferNV(GLenum mode); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_NV_read_buffer) +}; + +inline void QOpenGLExtension_NV_read_buffer::glReadBufferNV(GLenum mode) +{ + Q_D(QOpenGLExtension_NV_read_buffer); + d->ReadBufferNV(mode); +} + +class QOpenGLExtension_QCOM_alpha_testPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP AlphaFuncQCOM)(GLenum func, GLclampf ref); +}; + +class Q_GUI_EXPORT QOpenGLExtension_QCOM_alpha_test : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_QCOM_alpha_test(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glAlphaFuncQCOM(GLenum func, GLclampf ref); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_QCOM_alpha_test) +}; + +inline void QOpenGLExtension_QCOM_alpha_test::glAlphaFuncQCOM(GLenum func, GLclampf ref) +{ + Q_D(QOpenGLExtension_QCOM_alpha_test); + d->AlphaFuncQCOM(func, ref); +} + +class QOpenGLExtension_QCOM_driver_controlPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP GetDriverControlsQCOM)(GLint *num, GLsizei size, GLuint *driverControls); + void (QOPENGLF_APIENTRYP GetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); + void (QOPENGLF_APIENTRYP EnableDriverControlQCOM)(GLuint driverControl); + void (QOPENGLF_APIENTRYP DisableDriverControlQCOM)(GLuint driverControl); +}; + +class Q_GUI_EXPORT QOpenGLExtension_QCOM_driver_control : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_QCOM_driver_control(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls); + void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); + void glEnableDriverControlQCOM(GLuint driverControl); + void glDisableDriverControlQCOM(GLuint driverControl); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_QCOM_driver_control) +}; + +inline void QOpenGLExtension_QCOM_driver_control::glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls) +{ + Q_D(QOpenGLExtension_QCOM_driver_control); + d->GetDriverControlsQCOM(num, size, driverControls); +} + +inline void QOpenGLExtension_QCOM_driver_control::glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) +{ + Q_D(QOpenGLExtension_QCOM_driver_control); + d->GetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString); +} + +inline void QOpenGLExtension_QCOM_driver_control::glEnableDriverControlQCOM(GLuint driverControl) +{ + Q_D(QOpenGLExtension_QCOM_driver_control); + d->EnableDriverControlQCOM(driverControl); +} + +inline void QOpenGLExtension_QCOM_driver_control::glDisableDriverControlQCOM(GLuint driverControl) +{ + Q_D(QOpenGLExtension_QCOM_driver_control); + d->DisableDriverControlQCOM(driverControl); +} + +class QOpenGLExtension_QCOM_extended_getPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP ExtGetTexturesQCOM)(GLuint *textures, GLint maxTextures, GLint *numTextures); + void (QOPENGLF_APIENTRYP ExtGetBuffersQCOM)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers); + void (QOPENGLF_APIENTRYP ExtGetRenderbuffersQCOM)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); + void (QOPENGLF_APIENTRYP ExtGetFramebuffersQCOM)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); + void (QOPENGLF_APIENTRYP ExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); + void (QOPENGLF_APIENTRYP ExtTexObjectStateOverrideiQCOM)(GLenum target, GLenum pname, GLint param); + void (QOPENGLF_APIENTRYP ExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); + void (QOPENGLF_APIENTRYP ExtGetBufferPointervQCOM)(GLenum target, GLvoid **params); +}; + +class Q_GUI_EXPORT QOpenGLExtension_QCOM_extended_get : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_QCOM_extended_get(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures); + void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers); + void glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); + void glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); + void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); + void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param); + void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); + void glExtGetBufferPointervQCOM(GLenum target, GLvoid **params); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_QCOM_extended_get) +}; + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetTexturesQCOM(textures, maxTextures, numTextures); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetBuffersQCOM(buffers, maxBuffers, numBuffers); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetTexLevelParameterivQCOM(texture, face, level, pname, params); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtTexObjectStateOverrideiQCOM(target, pname, param); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); +} + +inline void QOpenGLExtension_QCOM_extended_get::glExtGetBufferPointervQCOM(GLenum target, GLvoid **params) +{ + Q_D(QOpenGLExtension_QCOM_extended_get); + d->ExtGetBufferPointervQCOM(target, params); +} + +class QOpenGLExtension_QCOM_extended_get2Private : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP ExtGetShadersQCOM)(GLuint *shaders, GLint maxShaders, GLint *numShaders); + void (QOPENGLF_APIENTRYP ExtGetProgramsQCOM)(GLuint *programs, GLint maxPrograms, GLint *numPrograms); + GLboolean (QOPENGLF_APIENTRYP ExtIsProgramBinaryQCOM)(GLuint program); + void (QOPENGLF_APIENTRYP ExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar *source, GLint *length); +}; + +class Q_GUI_EXPORT QOpenGLExtension_QCOM_extended_get2 : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_QCOM_extended_get2(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders); + void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms); + GLboolean glExtIsProgramBinaryQCOM(GLuint program); + void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_QCOM_extended_get2) +}; + +inline void QOpenGLExtension_QCOM_extended_get2::glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders) +{ + Q_D(QOpenGLExtension_QCOM_extended_get2); + d->ExtGetShadersQCOM(shaders, maxShaders, numShaders); +} + +inline void QOpenGLExtension_QCOM_extended_get2::glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms) +{ + Q_D(QOpenGLExtension_QCOM_extended_get2); + d->ExtGetProgramsQCOM(programs, maxPrograms, numPrograms); +} + +inline GLboolean QOpenGLExtension_QCOM_extended_get2::glExtIsProgramBinaryQCOM(GLuint program) +{ + Q_D(QOpenGLExtension_QCOM_extended_get2); + return d->ExtIsProgramBinaryQCOM(program); +} + +inline void QOpenGLExtension_QCOM_extended_get2::glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length) +{ + Q_D(QOpenGLExtension_QCOM_extended_get2); + d->ExtGetProgramBinarySourceQCOM(program, shadertype, source, length); +} + +class QOpenGLExtension_QCOM_tiled_renderingPrivate : public QAbstractOpenGLExtensionPrivate +{ +public: + void (QOPENGLF_APIENTRYP StartTilingQCOM)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); + void (QOPENGLF_APIENTRYP EndTilingQCOM)(GLbitfield preserveMask); +}; + +class Q_GUI_EXPORT QOpenGLExtension_QCOM_tiled_rendering : public QAbstractOpenGLExtension +{ +public: + QOpenGLExtension_QCOM_tiled_rendering(); + + bool initializeOpenGLFunctions() Q_DECL_FINAL; + + void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); + void glEndTilingQCOM(GLbitfield preserveMask); + +protected: + Q_DECLARE_PRIVATE(QOpenGLExtension_QCOM_tiled_rendering) +}; + +inline void QOpenGLExtension_QCOM_tiled_rendering::glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) +{ + Q_D(QOpenGLExtension_QCOM_tiled_rendering); + d->StartTilingQCOM(x, y, width, height, preserveMask); +} + +inline void QOpenGLExtension_QCOM_tiled_rendering::glEndTilingQCOM(GLbitfield preserveMask) +{ + Q_D(QOpenGLExtension_QCOM_tiled_rendering); + d->EndTilingQCOM(preserveMask); +} + +#endif + +QT_END_NAMESPACE + +#endif // QT_NO_OPENGL + +#endif diff --git a/util/glgen/qopenglextensions.h.header b/util/glgen/qopenglextensions.h.header new file mode 100644 index 0000000000..89e248fc33 --- /dev/null +++ b/util/glgen/qopenglextensions.h.header @@ -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) + diff --git a/util/glgen/qopenglversionfunctions.cpp.footer b/util/glgen/qopenglversionfunctions.cpp.footer new file mode 100644 index 0000000000..f003b56097 --- /dev/null +++ b/util/glgen/qopenglversionfunctions.cpp.footer @@ -0,0 +1,8 @@ + +#else + +// No backends for OpenGL ES 2 + +#endif // !QT_OPENGL_ES_2 + +QT_END_NAMESPACE diff --git a/util/glgen/qopenglversionfunctions.cpp.header b/util/glgen/qopenglversionfunctions.cpp.header new file mode 100644 index 0000000000..316b79011d --- /dev/null +++ b/util/glgen/qopenglversionfunctions.cpp.header @@ -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) + diff --git a/util/glgen/qopenglversionfunctions.h.footer b/util/glgen/qopenglversionfunctions.h.footer new file mode 100644 index 0000000000..dc29c75177 --- /dev/null +++ b/util/glgen/qopenglversionfunctions.h.footer @@ -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 diff --git a/util/glgen/qopenglversionfunctions.h.header b/util/glgen/qopenglversionfunctions.h.header new file mode 100644 index 0000000000..3bd28fc52d --- /dev/null +++ b/util/glgen/qopenglversionfunctions.h.header @@ -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) + diff --git a/util/glgen/qopenglversionfunctions__VERSION__.cpp.footer b/util/glgen/qopenglversionfunctions__VERSION__.cpp.footer new file mode 100644 index 0000000000..b81ea7b6ea --- /dev/null +++ b/util/glgen/qopenglversionfunctions__VERSION__.cpp.footer @@ -0,0 +1,2 @@ + +QT_END_NAMESPACE diff --git a/util/glgen/qopenglversionfunctions__VERSION__.cpp.header b/util/glgen/qopenglversionfunctions__VERSION__.cpp.header new file mode 100644 index 0000000000..f92c0dd3fd --- /dev/null +++ b/util/glgen/qopenglversionfunctions__VERSION__.cpp.header @@ -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 + diff --git a/util/glgen/qopenglversionfunctions__VERSION__.h.footer b/util/glgen/qopenglversionfunctions__VERSION__.h.footer new file mode 100644 index 0000000000..02db4d3a13 --- /dev/null +++ b/util/glgen/qopenglversionfunctions__VERSION__.h.footer @@ -0,0 +1,6 @@ + +QT_END_NAMESPACE + +#endif // QT_NO_OPENGL + +#endif diff --git a/util/glgen/qopenglversionfunctions__VERSION__.h.header b/util/glgen/qopenglversionfunctions__VERSION__.h.header new file mode 100644 index 0000000000..b3d097c2f9 --- /dev/null +++ b/util/glgen/qopenglversionfunctions__VERSION__.h.header @@ -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 + diff --git a/util/glgen/qopenglversionfunctionsfactory.cpp.footer b/util/glgen/qopenglversionfunctionsfactory.cpp.footer new file mode 100644 index 0000000000..b81ea7b6ea --- /dev/null +++ b/util/glgen/qopenglversionfunctionsfactory.cpp.footer @@ -0,0 +1,2 @@ + +QT_END_NAMESPACE diff --git a/util/glgen/qopenglversionfunctionsfactory.cpp.header b/util/glgen/qopenglversionfunctionsfactory.cpp.header new file mode 100644 index 0000000000..6be93102dc --- /dev/null +++ b/util/glgen/qopenglversionfunctionsfactory.cpp.header @@ -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" + diff --git a/util/glgen/qopenglversionfunctionsfactory_p.h.header b/util/glgen/qopenglversionfunctionsfactory_p.h.header new file mode 100644 index 0000000000..2312e900f9 --- /dev/null +++ b/util/glgen/qopenglversionfunctionsfactory_p.h.header @@ -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 diff --git a/util/glgen/specparser.cpp b/util/glgen/specparser.cpp new file mode 100644 index 0000000000..514a700644 --- /dev/null +++ b/util/glgen/specparser.cpp @@ -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); +} diff --git a/util/glgen/specparser.h b/util/glgen/specparser.h new file mode 100644 index 0000000000..e455f6579c --- /dev/null +++ b/util/glgen/specparser.h @@ -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 |