diff options
Diffstat (limited to 'src/gui/opengl')
22 files changed, 2988 insertions, 672 deletions
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri deleted file mode 100644 index 85fdb609cd..0000000000 --- a/src/gui/opengl/opengl.pri +++ /dev/null @@ -1,17 +0,0 @@ -# Qt gui library, opengl module - -qtConfig(opengl): CONFIG += opengl -qtConfig(opengles2): CONFIG += opengles2 - -qtConfig(opengl) { - HEADERS += opengl/qopengl.h \ - opengl/qopengl_p.h \ - opengl/qopenglfunctions.h \ - opengl/qopenglextensions_p.h \ - opengl/qopenglextrafunctions.h \ - opengl/qopenglprogrambinarycache_p.h - - SOURCES += opengl/qopengl.cpp \ - opengl/qopenglfunctions.cpp \ - opengl/qopenglprogrambinarycache.cpp -} diff --git a/src/gui/opengl/platform/egl/qeglconvenience.cpp b/src/gui/opengl/platform/egl/qeglconvenience.cpp new file mode 100644 index 0000000000..4af50d72f2 --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglconvenience.cpp @@ -0,0 +1,596 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + + +#include <QtCore/qbytearray.h> +#include <QtGui/qopenglcontext.h> + +#ifdef Q_OS_LINUX +#include <sys/ioctl.h> +#include <linux/fb.h> +#endif +#include <QtGui/private/qmath_p.h> + +#include "qeglconvenience_p.h" + +#ifndef EGL_OPENGL_ES3_BIT_KHR +#define EGL_OPENGL_ES3_BIT_KHR 0x0040 +#endif + +QT_BEGIN_NAMESPACE + +QList<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format) +{ + int redSize = format.redBufferSize(); + int greenSize = format.greenBufferSize(); + int blueSize = format.blueBufferSize(); + int alphaSize = format.alphaBufferSize(); + int depthSize = format.depthBufferSize(); + int stencilSize = format.stencilBufferSize(); + int sampleCount = format.samples(); + + QList<EGLint> configAttributes; + + // Map default, unspecified values (-1) to 0. This is important due to sorting rule #3 + // in section 3.4.1 of the spec and allows picking a potentially faster 16-bit config + // over 32-bit ones when there is no explicit request for the color channel sizes: + // + // The red/green/blue sizes have a sort priority of 3, so they are sorted by + // first. (unless a caveat like SLOW or NON_CONFORMANT is present) The sort order is + // Special and described as "by larger _total_ number of color bits.". So EGL will put + // 32-bit configs in the list before the 16-bit configs. However, the spec also goes + // on to say "If the requested number of bits in attrib_list for a particular + // component is 0, then the number of bits for that component is not considered". This + // part of the spec also seems to imply that setting the red/green/blue bits to zero + // means none of the components are considered and EGL disregards the entire sorting + // rule. It then looks to the next highest priority rule, which is + // EGL_BUFFER_SIZE. Despite the selection criteria being "AtLeast" for + // EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are put in the + // list before 32-bit configs. + // + // This also means that explicitly specifying a size like 565 will still result in + // having larger (888) configs first in the returned list. We need to handle this + // ourselves later by manually filtering the list, instead of just blindly taking the + // first config from it. + + configAttributes.append(EGL_RED_SIZE); + configAttributes.append(redSize > 0 ? redSize : 0); + + configAttributes.append(EGL_GREEN_SIZE); + configAttributes.append(greenSize > 0 ? greenSize : 0); + + configAttributes.append(EGL_BLUE_SIZE); + configAttributes.append(blueSize > 0 ? blueSize : 0); + + configAttributes.append(EGL_ALPHA_SIZE); + configAttributes.append(alphaSize > 0 ? alphaSize : 0); + + configAttributes.append(EGL_SAMPLES); + configAttributes.append(sampleCount > 0 ? sampleCount : 0); + + configAttributes.append(EGL_SAMPLE_BUFFERS); + configAttributes.append(sampleCount > 0); + + if (format.renderableType() != QSurfaceFormat::OpenVG) { + configAttributes.append(EGL_DEPTH_SIZE); + configAttributes.append(depthSize > 0 ? depthSize : 0); + + configAttributes.append(EGL_STENCIL_SIZE); + configAttributes.append(stencilSize > 0 ? stencilSize : 0); + } else { + // OpenVG needs alpha mask for clipping + configAttributes.append(EGL_ALPHA_MASK_SIZE); + configAttributes.append(8); + } + + return configAttributes; +} + +bool q_reduceConfigAttributes(QList<EGLint> *configAttributes) +{ + // Reduce the complexity of a configuration request to ask for less + // because the previous request did not result in success. Returns + // true if the complexity was reduced, or false if no further + // reductions in complexity are possible. + + qsizetype i = configAttributes->indexOf(EGL_SWAP_BEHAVIOR); + if (i >= 0) { + configAttributes->remove(i,2); + } + +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't + // find a config which supports pre-multiplied formats, remove the flag on the surface type: + + i = configAttributes->indexOf(EGL_SURFACE_TYPE); + if (i >= 0) { + EGLint surfaceType = configAttributes->at(i +1); + if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) { + surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT; + configAttributes->replace(i+1,surfaceType); + return true; + } + } +#endif + + // EGL chooses configs with the highest color depth over + // those with smaller (but faster) lower color depths. One + // way around this is to set EGL_BUFFER_SIZE to 16, which + // trumps the others. Of course, there may not be a 16-bit + // config available, so it's the first restraint we remove. + i = configAttributes->indexOf(EGL_BUFFER_SIZE); + if (i >= 0) { + if (configAttributes->at(i+1) == 16) { + configAttributes->remove(i,2); + return true; + } + } + + i = configAttributes->indexOf(EGL_SAMPLES); + if (i >= 0) { + EGLint value = configAttributes->value(i+1, 0); + if (value > 1) + configAttributes->replace(i+1, qMin(EGLint(16), value / 2)); + else + configAttributes->remove(i, 2); + return true; + } + + i = configAttributes->indexOf(EGL_SAMPLE_BUFFERS); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } + + i = configAttributes->indexOf(EGL_DEPTH_SIZE); + if (i >= 0) { + if (configAttributes->at(i + 1) >= 32) + configAttributes->replace(i + 1, 24); + else if (configAttributes->at(i + 1) > 1) + configAttributes->replace(i + 1, 1); + else + configAttributes->remove(i, 2); + return true; + } + + i = configAttributes->indexOf(EGL_ALPHA_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); +#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB) + i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGBA); + if (i >= 0) { + configAttributes->replace(i,EGL_BIND_TO_TEXTURE_RGB); + configAttributes->replace(i+1,true); + + } +#endif + return true; + } + + i = configAttributes->indexOf(EGL_STENCIL_SIZE); + if (i >= 0) { + if (configAttributes->at(i + 1) > 1) + configAttributes->replace(i + 1, 1); + else + configAttributes->remove(i, 2); + return true; + } + +#ifdef EGL_BIND_TO_TEXTURE_RGB + i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGB); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } +#endif + + return false; +} + +QEglConfigChooser::QEglConfigChooser(EGLDisplay display) + : m_display(display) + , m_surfaceType(EGL_WINDOW_BIT) + , m_ignore(false) + , m_confAttrRed(0) + , m_confAttrGreen(0) + , m_confAttrBlue(0) + , m_confAttrAlpha(0) +{ +} + +QEglConfigChooser::~QEglConfigChooser() +{ +} + +EGLConfig QEglConfigChooser::chooseConfig() +{ + QList<EGLint> configureAttributes = q_createConfigAttributesFromFormat(m_format); + configureAttributes.append(EGL_SURFACE_TYPE); + configureAttributes.append(surfaceType()); + + configureAttributes.append(EGL_RENDERABLE_TYPE); + bool needsES2Plus = false; + switch (m_format.renderableType()) { + case QSurfaceFormat::OpenVG: + configureAttributes.append(EGL_OPENVG_BIT); + break; +#ifdef EGL_VERSION_1_4 + case QSurfaceFormat::DefaultRenderableType: { +#ifndef QT_NO_OPENGL + // NVIDIA EGL only provides desktop GL for development purposes, and recommends against using it. + const char *vendor = eglQueryString(display(), EGL_VENDOR); + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL && (!vendor || !strstr(vendor, "NVIDIA"))) + configureAttributes.append(EGL_OPENGL_BIT); + else +#endif // QT_NO_OPENGL + needsES2Plus = true; + break; + } + case QSurfaceFormat::OpenGL: + configureAttributes.append(EGL_OPENGL_BIT); + break; +#endif + case QSurfaceFormat::OpenGLES: + if (m_format.majorVersion() == 1) { + configureAttributes.append(EGL_OPENGL_ES_BIT); + break; + } + Q_FALLTHROUGH(); + default: + needsES2Plus = true; + break; + } + if (needsES2Plus) { + if (m_format.majorVersion() >= 3 && q_hasEglExtension(display(), "EGL_KHR_create_context")) + configureAttributes.append(EGL_OPENGL_ES3_BIT_KHR); + else + configureAttributes.append(EGL_OPENGL_ES2_BIT); + } + configureAttributes.append(EGL_NONE); + + EGLConfig cfg = nullptr; + do { + // Get the number of matching configurations for this set of properties. + EGLint matching = 0; + if (!eglChooseConfig(display(), configureAttributes.constData(), nullptr, 0, &matching) || !matching) + continue; + + // Fetch all of the matching configurations and find the + // first that matches the pixel format we wanted. + qsizetype i = configureAttributes.indexOf(EGL_RED_SIZE); + m_confAttrRed = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_GREEN_SIZE); + m_confAttrGreen = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_BLUE_SIZE); + m_confAttrBlue = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_ALPHA_SIZE); + m_confAttrAlpha = i == -1 ? 0 : configureAttributes.at(i+1); + + QList<EGLConfig> configs(matching); + eglChooseConfig(display(), configureAttributes.constData(), configs.data(), + EGLint(configs.size()), &matching); + if (!cfg && matching > 0) + cfg = configs.first(); + + // Filter the list. Due to the EGL sorting rules configs with higher depth are + // placed first when the minimum color channel sizes have been specified (i.e. the + // QSurfaceFormat contains color sizes > 0). To prevent returning a 888 config + // when the QSurfaceFormat explicitly asked for 565, go through the returned + // configs and look for one that exactly matches the requested sizes. When no + // sizes have been given, take the first, which will be a config with the smaller + // (e.g. 16-bit) depth. + for (int i = 0; i < configs.size(); ++i) { + if (filterConfig(configs[i])) + return configs.at(i); + } + } while (q_reduceConfigAttributes(&configureAttributes)); + + if (!cfg) + qWarning("Cannot find EGLConfig, returning null config"); + return cfg; +} + +bool QEglConfigChooser::filterConfig(EGLConfig config) const +{ + // If we are fine with the highest depth (e.g. RGB888 configs) even when something + // smaller (565) was explicitly requested, do nothing. + if (m_ignore) + return true; + + EGLint red = 0; + EGLint green = 0; + EGLint blue = 0; + EGLint alpha = 0; + + // Compare only if a size was given. Otherwise just accept. + if (m_confAttrRed) + eglGetConfigAttrib(display(), config, EGL_RED_SIZE, &red); + if (m_confAttrGreen) + eglGetConfigAttrib(display(), config, EGL_GREEN_SIZE, &green); + if (m_confAttrBlue) + eglGetConfigAttrib(display(), config, EGL_BLUE_SIZE, &blue); + if (m_confAttrAlpha) + eglGetConfigAttrib(display(), config, EGL_ALPHA_SIZE, &alpha); + + return red == m_confAttrRed && green == m_confAttrGreen + && blue == m_confAttrBlue && alpha == m_confAttrAlpha; +} + +EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType) +{ + QEglConfigChooser chooser(display); + chooser.setSurfaceFormat(format); + chooser.setSurfaceType(surfaceType); + chooser.setIgnoreColorChannels(highestPixelFormat); + + return chooser.chooseConfig(); +} + +QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat) +{ + QSurfaceFormat format; + EGLint redSize = 0; + EGLint greenSize = 0; + EGLint blueSize = 0; + EGLint alphaSize = 0; + EGLint depthSize = 0; + EGLint stencilSize = 0; + EGLint sampleCount = 0; + EGLint renderableType = 0; + + eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); + eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); + eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); + eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); + eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); + eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); + eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); + eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE, &renderableType); + + if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG && (renderableType & EGL_OPENVG_BIT)) + format.setRenderableType(QSurfaceFormat::OpenVG); +#ifdef EGL_VERSION_1_4 + else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL + && (renderableType & EGL_OPENGL_BIT)) + format.setRenderableType(QSurfaceFormat::OpenGL); + else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType +#ifndef QT_NO_OPENGL + && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL + && !strstr(eglQueryString(display, EGL_VENDOR), "NVIDIA") +#endif + && (renderableType & EGL_OPENGL_BIT)) + format.setRenderableType(QSurfaceFormat::OpenGL); +#endif + else + format.setRenderableType(QSurfaceFormat::OpenGLES); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSamples(sampleCount); + format.setStereo(false); // EGL doesn't support stereo buffers + format.setSwapInterval(referenceFormat.swapInterval()); + + // Clear the EGL error state because some of the above may + // have errored out because the attribute is not applicable + // to the surface type. Such errors don't matter. + eglGetError(); + + return format; +} + +bool q_hasEglExtension(EGLDisplay display, const char* extensionName) +{ + QList<QByteArray> extensions = + QByteArray(reinterpret_cast<const char *> + (eglQueryString(display, EGL_EXTENSIONS))).split(' '); + return extensions.contains(extensionName); +} + +struct AttrInfo { EGLint attr; const char *name; }; +static struct AttrInfo attrs[] = { + {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"}, + {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"}, + {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"}, + {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"}, + {EGL_RED_SIZE, "EGL_RED_SIZE"}, + {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"}, + {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"}, + {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"}, + {EGL_CONFIG_ID, "EGL_CONFIG_ID"}, + {EGL_LEVEL, "EGL_LEVEL"}, + {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"}, + {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"}, + {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"}, + {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"}, + {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"}, + {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"}, + {EGL_SAMPLES, "EGL_SAMPLES"}, + {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"}, + {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"}, + {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"}, + {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"}, + {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"}, + {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"}, + {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"}, + {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, + {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, + {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, + {-1, nullptr}}; + +void q_printEglConfig(EGLDisplay display, EGLConfig config) +{ + EGLint index; + for (index = 0; attrs[index].attr != -1; ++index) { + EGLint value; + if (eglGetConfigAttrib(display, config, attrs[index].attr, &value)) { + qDebug("\t%s: %d", attrs[index].name, (int)value); + } + } +} + +#ifdef Q_OS_UNIX + +QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize) +{ +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice); +#endif + const int defaultPhysicalDpi = 100; + static QSizeF size; + + if (size.isEmpty()) { + // Note: in millimeters + int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH"); + int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT"); + + if (width && height) { + size.setWidth(width); + size.setHeight(height); + return size; + } + + int w = -1; + int h = -1; + QSize screenResolution; +#ifdef Q_OS_LINUX + struct fb_var_screeninfo vinfo; + + if (framebufferDevice != -1) { + if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) { + qWarning("eglconvenience: Could not query screen info"); + } else { + w = vinfo.width; + h = vinfo.height; + screenResolution = QSize(vinfo.xres, vinfo.yres); + } + } else +#endif + { + // Use the provided screen size, when available, since some platforms may have their own + // specific way to query it. Otherwise try querying it from the framebuffer. + screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize; + } + + size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); + size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); + + if (w <= 0 || h <= 0) + qWarning("Unable to query physical screen size, defaulting to %d dpi.\n" + "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH " + "and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi); + } + + return size; +} + +QSize q_screenSizeFromFb(int framebufferDevice) +{ +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice); +#endif + const int defaultWidth = 800; + const int defaultHeight = 600; + static QSize size; + + if (size.isEmpty()) { + int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_WIDTH"); + int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_HEIGHT"); + + if (width && height) { + size.setWidth(width); + size.setHeight(height); + return size; + } + +#ifdef Q_OS_LINUX + struct fb_var_screeninfo vinfo; + int xres = -1; + int yres = -1; + + if (framebufferDevice != -1) { + if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) { + qWarning("eglconvenience: Could not read screen info"); + } else { + xres = vinfo.xres; + yres = vinfo.yres; + } + } + + size.setWidth(xres <= 0 ? defaultWidth : xres); + size.setHeight(yres <= 0 ? defaultHeight : yres); +#else + size.setWidth(defaultWidth); + size.setHeight(defaultHeight); +#endif + } + + return size; +} + +int q_screenDepthFromFb(int framebufferDevice) +{ +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice); +#endif + const int defaultDepth = 32; + static int depth = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEPTH"); + + if (depth == 0) { +#ifdef Q_OS_LINUX + struct fb_var_screeninfo vinfo; + + if (framebufferDevice != -1) { + if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) + qWarning("eglconvenience: Could not query screen info"); + else + depth = vinfo.bits_per_pixel; + } + + if (depth <= 0) + depth = defaultDepth; +#else + depth = defaultDepth; +#endif + } + + return depth; +} + +qreal q_refreshRateFromFb(int framebufferDevice) +{ +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice); +#endif + + static qreal rate = 0; + +#ifdef Q_OS_LINUX + if (rate == 0) { + if (framebufferDevice != -1) { + struct fb_var_screeninfo vinfo; + if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) != -1) { + const quint64 quot = quint64(vinfo.left_margin + vinfo.right_margin + vinfo.xres + vinfo.hsync_len) + * quint64(vinfo.upper_margin + vinfo.lower_margin + vinfo.yres + vinfo.vsync_len) + * vinfo.pixclock; + if (quot) + rate = 1000000000000LLU / quot; + } else { + qWarning("eglconvenience: Could not query screen info"); + } + } + } +#endif + + if (rate == 0) + rate = 60; + + return rate; +} + +#endif // Q_OS_UNIX + +QT_END_NAMESPACE diff --git a/src/gui/opengl/platform/egl/qeglconvenience_p.h b/src/gui/opengl/platform/egl/qeglconvenience_p.h new file mode 100644 index 0000000000..d4a250c90f --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglconvenience_p.h @@ -0,0 +1,91 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLCONVENIENCE_H +#define QEGLCONVENIENCE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtGui/qsurfaceformat.h> +#include <QtCore/qlist.h> +#include <QtCore/qsize.h> + +#include <QtGui/private/qt_egl_p.h> + + +QT_BEGIN_NAMESPACE + +Q_GUI_EXPORT QList<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format); + +Q_GUI_EXPORT bool q_reduceConfigAttributes(QList<EGLint> *configAttributes); + +Q_GUI_EXPORT EGLConfig q_configFromGLFormat(EGLDisplay display, + const QSurfaceFormat &format, + bool highestPixelFormat = false, + int surfaceType = EGL_WINDOW_BIT); + +Q_GUI_EXPORT QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, + const QSurfaceFormat &referenceFormat = {}); + +Q_GUI_EXPORT bool q_hasEglExtension(EGLDisplay display,const char* extensionName); + +Q_GUI_EXPORT void q_printEglConfig(EGLDisplay display, EGLConfig config); + +#ifdef Q_OS_UNIX +Q_GUI_EXPORT QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, + const QSize &screenSize = {}); + +Q_GUI_EXPORT QSize q_screenSizeFromFb(int framebufferDevice); + +Q_GUI_EXPORT int q_screenDepthFromFb(int framebufferDevice); + +Q_GUI_EXPORT qreal q_refreshRateFromFb(int framebufferDevice); + +#endif + +class Q_GUI_EXPORT QEglConfigChooser +{ +public: + QEglConfigChooser(EGLDisplay display); + virtual ~QEglConfigChooser(); + + EGLDisplay display() const { return m_display; } + + void setSurfaceType(EGLint surfaceType) { m_surfaceType = surfaceType; } + EGLint surfaceType() const { return m_surfaceType; } + + void setSurfaceFormat(const QSurfaceFormat &format) { m_format = format; } + QSurfaceFormat surfaceFormat() const { return m_format; } + + void setIgnoreColorChannels(bool ignore) { m_ignore = ignore; } + bool ignoreColorChannels() const { return m_ignore; } + + EGLConfig chooseConfig(); + +protected: + virtual bool filterConfig(EGLConfig config) const; + + QSurfaceFormat m_format; + EGLDisplay m_display; + EGLint m_surfaceType; + bool m_ignore; + + int m_confAttrRed; + int m_confAttrGreen; + int m_confAttrBlue; + int m_confAttrAlpha; +}; + + +QT_END_NAMESPACE + +#endif //QEGLCONVENIENCE_H diff --git a/src/gui/opengl/platform/egl/qeglpbuffer.cpp b/src/gui/opengl/platform/egl/qeglpbuffer.cpp new file mode 100644 index 0000000000..6a79d88f8c --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglpbuffer.cpp @@ -0,0 +1,63 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include <QtGui/qoffscreensurface.h> +#include "qeglpbuffer_p.h" +#include "qeglconvenience_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QEGLPbuffer + \brief A pbuffer-based implementation of QPlatformOffscreenSurface for EGL. + \since 5.2 + \internal + \ingroup qpa + + To use this implementation in the platform plugin simply + reimplement QPlatformIntegration::createPlatformOffscreenSurface() + and return a new instance of this class. +*/ + +QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface, + QEGLPlatformContext::Flags flags) + : QPlatformOffscreenSurface(offscreenSurface) + , m_format(format) + , m_display(display) + , m_pbuffer(EGL_NO_SURFACE) +{ + m_hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless) + && q_hasEglExtension(display, "EGL_KHR_surfaceless_context"); + + if (m_hasSurfaceless) + return; + + EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT); + + if (config) { + const EGLint attributes[] = { + EGL_WIDTH, offscreenSurface->size().width(), + EGL_HEIGHT, offscreenSurface->size().height(), + EGL_LARGEST_PBUFFER, EGL_FALSE, + EGL_NONE + }; + + m_pbuffer = eglCreatePbufferSurface(m_display, config, attributes); + + if (m_pbuffer != EGL_NO_SURFACE) + m_format = q_glFormatFromConfig(m_display, config); + } +} + +QEGLPbuffer::~QEGLPbuffer() +{ + if (m_pbuffer != EGL_NO_SURFACE) + eglDestroySurface(m_display, m_pbuffer); +} + +bool QEGLPbuffer::isValid() const +{ + return m_pbuffer != EGL_NO_SURFACE || m_hasSurfaceless; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/platform/egl/qeglpbuffer_p.h b/src/gui/opengl/platform/egl/qeglpbuffer_p.h new file mode 100644 index 0000000000..e6b6db1f38 --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglpbuffer_p.h @@ -0,0 +1,44 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLPBUFFER_H +#define QEGLPBUFFER_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <qpa/qplatformoffscreensurface.h> +#include <QtGui/private/qeglplatformcontext_p.h> + +QT_BEGIN_NAMESPACE + +class Q_GUI_EXPORT QEGLPbuffer : public QPlatformOffscreenSurface +{ +public: + QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface, + QEGLPlatformContext::Flags flags = { }); + ~QEGLPbuffer(); + + QSurfaceFormat format() const override { return m_format; } + bool isValid() const override; + + EGLSurface pbuffer() const { return m_pbuffer; } + +private: + QSurfaceFormat m_format; + EGLDisplay m_display; + EGLSurface m_pbuffer; + bool m_hasSurfaceless; +}; + +QT_END_NAMESPACE + +#endif // QEGLPBUFFER_H diff --git a/src/gui/opengl/platform/egl/qeglplatformcontext.cpp b/src/gui/opengl/platform/egl/qeglplatformcontext.cpp new file mode 100644 index 0000000000..0a6e83e875 --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglplatformcontext.cpp @@ -0,0 +1,838 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglplatformcontext_p.h" +#include "qeglconvenience_p.h" +#include "qeglpbuffer_p.h" +#include <qpa/qplatformwindow.h> +#include <QtGui/qopenglcontext.h> +#include <QtCore/qdebug.h> + +#ifdef Q_OS_ANDROID +#include <QtCore/private/qjnihelpers_p.h> +#endif +#ifndef Q_OS_WIN +#include <dlfcn.h> +#endif + +QT_BEGIN_NAMESPACE + +/*! + \class QEGLPlatformContext + \brief An EGL context implementation. + \since 5.2 + \internal + \ingroup qpa + + Implement QPlatformOpenGLContext using EGL. To use it in platform + plugins a subclass must be created since + eglSurfaceForPlatformSurface() has to be reimplemented. This + function is used for mapping platform surfaces (windows) to EGL + surfaces and is necessary since different platform plugins may + have different ways of handling native windows (for example, a + plugin may choose not to back every platform window by a real EGL + surface). Other than that, no further customization is necessary. + */ + +// Constants from EGL_KHR_create_context +#ifndef EGL_CONTEXT_MINOR_VERSION_KHR +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#endif +#ifndef EGL_CONTEXT_FLAGS_KHR +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#endif +#ifndef EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#endif +#ifndef EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#endif +#ifndef EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#endif +#ifndef EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#endif +#ifndef EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#endif + +// Constants for OpenGL which are not available in the ES headers. +#ifndef GL_CONTEXT_FLAGS +#define GL_CONTEXT_FLAGS 0x821E +#endif +#ifndef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#endif +#ifndef GL_CONTEXT_FLAG_DEBUG_BIT +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#endif +#ifndef GL_CONTEXT_PROFILE_MASK +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#endif +#ifndef GL_CONTEXT_CORE_PROFILE_BIT +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#endif +#ifndef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#endif + +QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + EGLConfig *config, Flags flags) + : m_eglDisplay(display) + , m_flags(flags) + , m_ownsContext(true) +{ + m_eglConfig = config ? *config : q_configFromGLFormat(display, format); + + m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig, format); + // m_format now has the renderableType() resolved (it cannot be Default anymore) + // but does not yet contain version, profile, options. + m_shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : nullptr; + + QList<EGLint> contextAttrs; + contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + contextAttrs.append(format.majorVersion()); + const bool hasKHRCreateContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_create_context"); + if (hasKHRCreateContext) { + contextAttrs.append(EGL_CONTEXT_MINOR_VERSION_KHR); + contextAttrs.append(format.minorVersion()); + int flags = 0; + // The debug bit is supported both for OpenGL and OpenGL ES. + if (format.testOption(QSurfaceFormat::DebugContext)) + flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; + // The fwdcompat bit is only for OpenGL 3.0+. + if (m_format.renderableType() == QSurfaceFormat::OpenGL + && format.majorVersion() >= 3 + && !format.testOption(QSurfaceFormat::DeprecatedFunctions)) + flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; + if (flags) { + contextAttrs.append(EGL_CONTEXT_FLAGS_KHR); + contextAttrs.append(flags); + } + // Profiles are OpenGL only and mandatory in 3.2+. The value is silently ignored for < 3.2. + if (m_format.renderableType() == QSurfaceFormat::OpenGL) { + contextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); + contextAttrs.append(format.profile() == QSurfaceFormat::CoreProfile + ? EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR + : EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR); + } + } + +#ifdef EGL_EXT_protected_content + if (format.testOption(QSurfaceFormat::ProtectedContent)) { + if (q_hasEglExtension(m_eglDisplay, "EGL_EXT_protected_content")) { + contextAttrs.append(EGL_PROTECTED_CONTENT_EXT); + contextAttrs.append(EGL_TRUE); + } else { + m_format.setOption(QSurfaceFormat::ProtectedContent, false); + } + } +#endif + + // Special Options for OpenVG surfaces + if (m_format.renderableType() == QSurfaceFormat::OpenVG) { + contextAttrs.append(EGL_ALPHA_MASK_SIZE); + contextAttrs.append(8); + } + + contextAttrs.append(EGL_NONE); + m_contextAttrs = contextAttrs; + + switch (m_format.renderableType()) { + case QSurfaceFormat::OpenVG: + m_api = EGL_OPENVG_API; + break; +#ifdef EGL_VERSION_1_4 + case QSurfaceFormat::OpenGL: + m_api = EGL_OPENGL_API; + break; +#endif // EGL_VERSION_1_4 + default: + m_api = EGL_OPENGL_ES_API; + break; + } + + eglBindAPI(m_api); + m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData()); + if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) { + m_shareContext = nullptr; + m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, contextAttrs.constData()); + } + + if (m_eglContext == EGL_NO_CONTEXT) { + qWarning("QEGLPlatformContext: Failed to create context: %x", eglGetError()); + return; + } + + static const bool printConfig = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEBUG"); + if (printConfig) { + qDebug() << "Created context for format" << format << "with config:"; + q_printEglConfig(m_eglDisplay, m_eglConfig); + + static const bool printAllConfigs = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEBUG") > 1; + if (printAllConfigs) { + EGLint numConfigs = 0; + eglGetConfigs(m_eglDisplay, nullptr, 0, &numConfigs); + QVector<EGLConfig> configs; + configs.resize(numConfigs); + eglGetConfigs(m_eglDisplay, configs.data(), numConfigs, &numConfigs); + qDebug("\nAll EGLConfigs: count=%d", numConfigs); + for (EGLint i = 0; i < numConfigs; ++i) { + qDebug("EGLConfig #%d", i); + q_printEglConfig(m_eglDisplay, configs[i]); + } + qDebug("\n"); + } + } + + // Cannot just call updateFormatFromGL() since it relies on virtuals. Defer it to initialize(). +} + +void QEGLPlatformContext::adopt(EGLContext context, EGLDisplay display, QPlatformOpenGLContext *share) +{ + Q_ASSERT(!m_ownsContext); + + m_eglDisplay = display; + + // Figure out the EGLConfig. + EGLint value = 0; + eglQueryContext(m_eglDisplay, context, EGL_CONFIG_ID, &value); + EGLint n = 0; + EGLConfig cfg; + const EGLint attribs[] = { EGL_CONFIG_ID, value, EGL_NONE }; + if (eglChooseConfig(m_eglDisplay, attribs, &cfg, 1, &n) && n == 1) { + m_eglConfig = cfg; + m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig); + } else { + qWarning("QEGLPlatformContext: Failed to get framebuffer configuration for context"); + } + + // Fetch client API type. + value = 0; + eglQueryContext(m_eglDisplay, context, EGL_CONTEXT_CLIENT_TYPE, &value); + if (value == EGL_OPENGL_API || value == EGL_OPENGL_ES_API) { + // if EGL config supports both OpenGL and OpenGL ES render type, + // q_glFormatFromConfig() with the default "referenceFormat" parameter + // will always figure it out as OpenGL render type. + // We can override it to match user's real render type. + if (value == EGL_OPENGL_ES_API) + m_format.setRenderableType(QSurfaceFormat::OpenGLES); + m_api = value; + eglBindAPI(m_api); + } else { + qWarning("QEGLPlatformContext: Failed to get client API type"); + m_api = EGL_OPENGL_ES_API; + } + + m_eglContext = context; + m_shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : nullptr; + updateFormatFromGL(); +} + +void QEGLPlatformContext::initialize() +{ + if (m_eglContext != EGL_NO_CONTEXT) + updateFormatFromGL(); +} + +// Base implementation for pbuffers. Subclasses will handle the specialized cases for +// platforms without pbuffers. +EGLSurface QEGLPlatformContext::createTemporaryOffscreenSurface() +{ + // Make the context current to ensure the GL version query works. This needs a surface too. + const EGLint pbufferAttributes[] = { + EGL_WIDTH, 1, + EGL_HEIGHT, 1, + EGL_LARGEST_PBUFFER, EGL_FALSE, + EGL_NONE + }; + + // Cannot just pass m_eglConfig because it may not be suitable for pbuffers. Instead, + // do what QEGLPbuffer would do: request a config with the same attributes but with + // PBUFFER_BIT set. + EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, EGL_PBUFFER_BIT); + + return eglCreatePbufferSurface(m_eglDisplay, config, pbufferAttributes); +} + +void QEGLPlatformContext::destroyTemporaryOffscreenSurface(EGLSurface surface) +{ + eglDestroySurface(m_eglDisplay, surface); +} + +void QEGLPlatformContext::runGLChecks() +{ + // Nothing to do here, subclasses may override in order to perform OpenGL + // queries needing a context. +} + +void QEGLPlatformContext::updateFormatFromGL() +{ +#ifndef QT_NO_OPENGL + // Have to save & restore to prevent QOpenGLContext::currentContext() from becoming + // inconsistent after QOpenGLContext::create(). + EGLDisplay prevDisplay = eglGetCurrentDisplay(); + if (prevDisplay == EGL_NO_DISPLAY) // when no context is current + prevDisplay = m_eglDisplay; + EGLContext prevContext = eglGetCurrentContext(); + EGLSurface prevSurfaceDraw = eglGetCurrentSurface(EGL_DRAW); + EGLSurface prevSurfaceRead = eglGetCurrentSurface(EGL_READ); + + // Rely on the surfaceless extension, if available. This is beneficial since we can + // avoid creating an extra pbuffer surface which is apparently troublesome with some + // drivers (Mesa) when certain attributes are present (multisampling). + EGLSurface tempSurface = EGL_NO_SURFACE; + EGLContext tempContext = EGL_NO_CONTEXT; + if (m_flags.testFlag(NoSurfaceless) || !q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context")) + tempSurface = createTemporaryOffscreenSurface(); + + EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext); + if (!ok) { + EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, EGL_PBUFFER_BIT); + tempContext = eglCreateContext(m_eglDisplay, config, nullptr, m_contextAttrs.constData()); + if (tempContext != EGL_NO_CONTEXT) + ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, tempContext); + } + if (ok) { + if (m_format.renderableType() == QSurfaceFormat::OpenGL + || m_format.renderableType() == QSurfaceFormat::OpenGLES) { + const GLubyte *s = glGetString(GL_VERSION); + if (s) { + QByteArray version = QByteArray(reinterpret_cast<const char *>(s)); + int major, minor; + if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) { + m_format.setMajorVersion(major); + m_format.setMinorVersion(minor); + } + } + m_format.setProfile(QSurfaceFormat::NoProfile); + m_format.setOptions(QSurfaceFormat::FormatOptions()); + if (m_format.renderableType() == QSurfaceFormat::OpenGL) { + // Check profile and options. + if (m_format.majorVersion() < 3) { + m_format.setOption(QSurfaceFormat::DeprecatedFunctions); + } else { + GLint value = 0; + glGetIntegerv(GL_CONTEXT_FLAGS, &value); + if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) + m_format.setOption(QSurfaceFormat::DeprecatedFunctions); + if (value & GL_CONTEXT_FLAG_DEBUG_BIT) + m_format.setOption(QSurfaceFormat::DebugContext); + if (m_format.version() >= qMakePair(3, 2)) { + value = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); + if (value & GL_CONTEXT_CORE_PROFILE_BIT) + m_format.setProfile(QSurfaceFormat::CoreProfile); + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) + m_format.setProfile(QSurfaceFormat::CompatibilityProfile); + } + } + } + } + runGLChecks(); + eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext); + } else { + qWarning("QEGLPlatformContext: Failed to make temporary surface current, format not updated (%x)", eglGetError()); + } + if (tempSurface != EGL_NO_SURFACE) + destroyTemporaryOffscreenSurface(tempSurface); + if (tempContext != EGL_NO_CONTEXT) + eglDestroyContext(m_eglDisplay, tempContext); +#endif // QT_NO_OPENGL +} + +bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface) +{ + Q_ASSERT(surface->surface()->supportsOpenGL()); + + eglBindAPI(m_api); + + EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); + + // shortcut: on some GPUs, eglMakeCurrent is not a cheap operation + if (eglGetCurrentContext() == m_eglContext && + eglGetCurrentDisplay() == m_eglDisplay && + eglGetCurrentSurface(EGL_READ) == eglSurface && + eglGetCurrentSurface(EGL_DRAW) == eglSurface) { + return true; + } + + const bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext); + if (ok) { + if (!m_swapIntervalEnvChecked) { + m_swapIntervalEnvChecked = true; + if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_SWAPINTERVAL")) { + QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); + bool intervalOk; + const int swapInterval = swapIntervalString.toInt(&intervalOk); + if (intervalOk) + m_swapIntervalFromEnv = swapInterval; + } + } + const int requestedSwapInterval = m_swapIntervalFromEnv >= 0 + ? m_swapIntervalFromEnv + : surface->format().swapInterval(); + if (requestedSwapInterval >= 0 && m_swapInterval != requestedSwapInterval) { + m_swapInterval = requestedSwapInterval; + if (eglSurface != EGL_NO_SURFACE) // skip if using surfaceless context + eglSwapInterval(eglDisplay(), m_swapInterval); + } + } else { + qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); + } + + return ok; +} + +QEGLPlatformContext::~QEGLPlatformContext() +{ + if (m_ownsContext && m_eglContext != EGL_NO_CONTEXT) + eglDestroyContext(m_eglDisplay, m_eglContext); + + m_eglContext = EGL_NO_CONTEXT; +} + +void QEGLPlatformContext::doneCurrent() +{ + eglBindAPI(m_api); + bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!ok) + qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); +} + +void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) +{ + eglBindAPI(m_api); + EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); + if (eglSurface != EGL_NO_SURFACE) { // skip if using surfaceless context + bool ok = eglSwapBuffers(m_eglDisplay, eglSurface); + if (!ok) + qWarning("QEGLPlatformContext: eglSwapBuffers failed: %x", eglGetError()); + } +} + +QFunctionPointer QEGLPlatformContext::getProcAddress(const char *procName) +{ + eglBindAPI(m_api); + QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); +#if !defined(Q_OS_WIN) && !defined(Q_OS_INTEGRITY) + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); +#elif !defined(QT_OPENGL_DYNAMIC) + // On systems without KHR_get_all_proc_addresses and without + // dynamic linking there still has to be a way to access the + // standard GLES functions. QOpenGL(Extra)Functions never makes + // direct GL API calls since Qt 5.7, so all such workarounds are + // expected to be handled in the platform plugin. + if (!proc) { + static struct StdFunc { + const char *name; + QFunctionPointer func; + } standardFuncs[] = { +#if QT_CONFIG(opengles2) + { "glBindTexture", (QFunctionPointer) ::glBindTexture }, + { "glBlendFunc", (QFunctionPointer) ::glBlendFunc }, + { "glClear", (QFunctionPointer) ::glClear }, + { "glClearColor", (QFunctionPointer) ::glClearColor }, + { "glClearStencil", (QFunctionPointer) ::glClearStencil }, + { "glColorMask", (QFunctionPointer) ::glColorMask }, + { "glCopyTexImage2D", (QFunctionPointer) ::glCopyTexImage2D }, + { "glCopyTexSubImage2D", (QFunctionPointer) ::glCopyTexSubImage2D }, + { "glCullFace", (QFunctionPointer) ::glCullFace }, + { "glDeleteTextures", (QFunctionPointer) ::glDeleteTextures }, + { "glDepthFunc", (QFunctionPointer) ::glDepthFunc }, + { "glDepthMask", (QFunctionPointer) ::glDepthMask }, + { "glDisable", (QFunctionPointer) ::glDisable }, + { "glDrawArrays", (QFunctionPointer) ::glDrawArrays }, + { "glDrawElements", (QFunctionPointer) ::glDrawElements }, + { "glEnable", (QFunctionPointer) ::glEnable }, + { "glFinish", (QFunctionPointer) ::glFinish }, + { "glFlush", (QFunctionPointer) ::glFlush }, + { "glFrontFace", (QFunctionPointer) ::glFrontFace }, + { "glGenTextures", (QFunctionPointer) ::glGenTextures }, + { "glGetBooleanv", (QFunctionPointer) ::glGetBooleanv }, + { "glGetError", (QFunctionPointer) ::glGetError }, + { "glGetFloatv", (QFunctionPointer) ::glGetFloatv }, + { "glGetIntegerv", (QFunctionPointer) ::glGetIntegerv }, + { "glGetString", (QFunctionPointer) ::glGetString }, + { "glGetTexParameterfv", (QFunctionPointer) ::glGetTexParameterfv }, + { "glGetTexParameteriv", (QFunctionPointer) ::glGetTexParameteriv }, + { "glHint", (QFunctionPointer) ::glHint }, + { "glIsEnabled", (QFunctionPointer) ::glIsEnabled }, + { "glIsTexture", (QFunctionPointer) ::glIsTexture }, + { "glLineWidth", (QFunctionPointer) ::glLineWidth }, + { "glPixelStorei", (QFunctionPointer) ::glPixelStorei }, + { "glPolygonOffset", (QFunctionPointer) ::glPolygonOffset }, + { "glReadPixels", (QFunctionPointer) ::glReadPixels }, + { "glScissor", (QFunctionPointer) ::glScissor }, + { "glStencilFunc", (QFunctionPointer) ::glStencilFunc }, + { "glStencilMask", (QFunctionPointer) ::glStencilMask }, + { "glStencilOp", (QFunctionPointer) ::glStencilOp }, + { "glTexImage2D", (QFunctionPointer) ::glTexImage2D }, + { "glTexParameterf", (QFunctionPointer) ::glTexParameterf }, + { "glTexParameterfv", (QFunctionPointer) ::glTexParameterfv }, + { "glTexParameteri", (QFunctionPointer) ::glTexParameteri }, + { "glTexParameteriv", (QFunctionPointer) ::glTexParameteriv }, + { "glTexSubImage2D", (QFunctionPointer) ::glTexSubImage2D }, + { "glViewport", (QFunctionPointer) ::glViewport }, + + { "glActiveTexture", (QFunctionPointer) ::glActiveTexture }, + { "glAttachShader", (QFunctionPointer) ::glAttachShader }, + { "glBindAttribLocation", (QFunctionPointer) ::glBindAttribLocation }, + { "glBindBuffer", (QFunctionPointer) ::glBindBuffer }, + { "glBindFramebuffer", (QFunctionPointer) ::glBindFramebuffer }, + { "glBindRenderbuffer", (QFunctionPointer) ::glBindRenderbuffer }, + { "glBlendColor", (QFunctionPointer) ::glBlendColor }, + { "glBlendEquation", (QFunctionPointer) ::glBlendEquation }, + { "glBlendEquationSeparate", (QFunctionPointer) ::glBlendEquationSeparate }, + { "glBlendFuncSeparate", (QFunctionPointer) ::glBlendFuncSeparate }, + { "glBufferData", (QFunctionPointer) ::glBufferData }, + { "glBufferSubData", (QFunctionPointer) ::glBufferSubData }, + { "glCheckFramebufferStatus", (QFunctionPointer) ::glCheckFramebufferStatus }, + { "glCompileShader", (QFunctionPointer) ::glCompileShader }, + { "glCompressedTexImage2D", (QFunctionPointer) ::glCompressedTexImage2D }, + { "glCompressedTexSubImage2D", (QFunctionPointer) ::glCompressedTexSubImage2D }, + { "glCreateProgram", (QFunctionPointer) ::glCreateProgram }, + { "glCreateShader", (QFunctionPointer) ::glCreateShader }, + { "glDeleteBuffers", (QFunctionPointer) ::glDeleteBuffers }, + { "glDeleteFramebuffers", (QFunctionPointer) ::glDeleteFramebuffers }, + { "glDeleteProgram", (QFunctionPointer) ::glDeleteProgram }, + { "glDeleteRenderbuffers", (QFunctionPointer) ::glDeleteRenderbuffers }, + { "glDeleteShader", (QFunctionPointer) ::glDeleteShader }, + { "glDetachShader", (QFunctionPointer) ::glDetachShader }, + { "glDisableVertexAttribArray", (QFunctionPointer) ::glDisableVertexAttribArray }, + { "glEnableVertexAttribArray", (QFunctionPointer) ::glEnableVertexAttribArray }, + { "glFramebufferRenderbuffer", (QFunctionPointer) ::glFramebufferRenderbuffer }, + { "glFramebufferTexture2D", (QFunctionPointer) ::glFramebufferTexture2D }, + { "glGenBuffers", (QFunctionPointer) ::glGenBuffers }, + { "glGenerateMipmap", (QFunctionPointer) ::glGenerateMipmap }, + { "glGenFramebuffers", (QFunctionPointer) ::glGenFramebuffers }, + { "glGenRenderbuffers", (QFunctionPointer) ::glGenRenderbuffers }, + { "glGetActiveAttrib", (QFunctionPointer) ::glGetActiveAttrib }, + { "glGetActiveUniform", (QFunctionPointer) ::glGetActiveUniform }, + { "glGetAttachedShaders", (QFunctionPointer) ::glGetAttachedShaders }, + { "glGetAttribLocation", (QFunctionPointer) ::glGetAttribLocation }, + { "glGetBufferParameteriv", (QFunctionPointer) ::glGetBufferParameteriv }, + { "glGetFramebufferAttachmentParameteriv", (QFunctionPointer) ::glGetFramebufferAttachmentParameteriv }, + { "glGetProgramiv", (QFunctionPointer) ::glGetProgramiv }, + { "glGetProgramInfoLog", (QFunctionPointer) ::glGetProgramInfoLog }, + { "glGetRenderbufferParameteriv", (QFunctionPointer) ::glGetRenderbufferParameteriv }, + { "glGetShaderiv", (QFunctionPointer) ::glGetShaderiv }, + { "glGetShaderInfoLog", (QFunctionPointer) ::glGetShaderInfoLog }, + { "glGetShaderPrecisionFormat", (QFunctionPointer) ::glGetShaderPrecisionFormat }, + { "glGetShaderSource", (QFunctionPointer) ::glGetShaderSource }, + { "glGetUniformfv", (QFunctionPointer) ::glGetUniformfv }, + { "glGetUniformiv", (QFunctionPointer) ::glGetUniformiv }, + { "glGetUniformLocation", (QFunctionPointer) ::glGetUniformLocation }, + { "glGetVertexAttribfv", (QFunctionPointer) ::glGetVertexAttribfv }, + { "glGetVertexAttribiv", (QFunctionPointer) ::glGetVertexAttribiv }, + { "glGetVertexAttribPointerv", (QFunctionPointer) ::glGetVertexAttribPointerv }, + { "glIsBuffer", (QFunctionPointer) ::glIsBuffer }, + { "glIsFramebuffer", (QFunctionPointer) ::glIsFramebuffer }, + { "glIsProgram", (QFunctionPointer) ::glIsProgram }, + { "glIsRenderbuffer", (QFunctionPointer) ::glIsRenderbuffer }, + { "glIsShader", (QFunctionPointer) ::glIsShader }, + { "glLinkProgram", (QFunctionPointer) ::glLinkProgram }, + { "glReleaseShaderCompiler", (QFunctionPointer) ::glReleaseShaderCompiler }, + { "glRenderbufferStorage", (QFunctionPointer) ::glRenderbufferStorage }, + { "glSampleCoverage", (QFunctionPointer) ::glSampleCoverage }, + { "glShaderBinary", (QFunctionPointer) ::glShaderBinary }, + { "glShaderSource", (QFunctionPointer) ::glShaderSource }, + { "glStencilFuncSeparate", (QFunctionPointer) ::glStencilFuncSeparate }, + { "glStencilMaskSeparate", (QFunctionPointer) ::glStencilMaskSeparate }, + { "glStencilOpSeparate", (QFunctionPointer) ::glStencilOpSeparate }, + { "glUniform1f", (QFunctionPointer) ::glUniform1f }, + { "glUniform1fv", (QFunctionPointer) ::glUniform1fv }, + { "glUniform1i", (QFunctionPointer) ::glUniform1i }, + { "glUniform1iv", (QFunctionPointer) ::glUniform1iv }, + { "glUniform2f", (QFunctionPointer) ::glUniform2f }, + { "glUniform2fv", (QFunctionPointer) ::glUniform2fv }, + { "glUniform2i", (QFunctionPointer) ::glUniform2i }, + { "glUniform2iv", (QFunctionPointer) ::glUniform2iv }, + { "glUniform3f", (QFunctionPointer) ::glUniform3f }, + { "glUniform3fv", (QFunctionPointer) ::glUniform3fv }, + { "glUniform3i", (QFunctionPointer) ::glUniform3i }, + { "glUniform3iv", (QFunctionPointer) ::glUniform3iv }, + { "glUniform4f", (QFunctionPointer) ::glUniform4f }, + { "glUniform4fv", (QFunctionPointer) ::glUniform4fv }, + { "glUniform4i", (QFunctionPointer) ::glUniform4i }, + { "glUniform4iv", (QFunctionPointer) ::glUniform4iv }, + { "glUniformMatrix2fv", (QFunctionPointer) ::glUniformMatrix2fv }, + { "glUniformMatrix3fv", (QFunctionPointer) ::glUniformMatrix3fv }, + { "glUniformMatrix4fv", (QFunctionPointer) ::glUniformMatrix4fv }, + { "glUseProgram", (QFunctionPointer) ::glUseProgram }, + { "glValidateProgram", (QFunctionPointer) ::glValidateProgram }, + { "glVertexAttrib1f", (QFunctionPointer) ::glVertexAttrib1f }, + { "glVertexAttrib1fv", (QFunctionPointer) ::glVertexAttrib1fv }, + { "glVertexAttrib2f", (QFunctionPointer) ::glVertexAttrib2f }, + { "glVertexAttrib2fv", (QFunctionPointer) ::glVertexAttrib2fv }, + { "glVertexAttrib3f", (QFunctionPointer) ::glVertexAttrib3f }, + { "glVertexAttrib3fv", (QFunctionPointer) ::glVertexAttrib3fv }, + { "glVertexAttrib4f", (QFunctionPointer) ::glVertexAttrib4f }, + { "glVertexAttrib4fv", (QFunctionPointer) ::glVertexAttrib4fv }, + { "glVertexAttribPointer", (QFunctionPointer) ::glVertexAttribPointer }, + + { "glClearDepthf", (QFunctionPointer) ::glClearDepthf }, + { "glDepthRangef", (QFunctionPointer) ::glDepthRangef }, +#endif // QT_CONFIG(opengles2) + +#if QT_CONFIG(opengles3) + { "glBeginQuery", (QFunctionPointer) ::glBeginQuery }, + { "glBeginTransformFeedback", (QFunctionPointer) ::glBeginTransformFeedback }, + { "glBindBufferBase", (QFunctionPointer) ::glBindBufferBase }, + { "glBindBufferRange", (QFunctionPointer) ::glBindBufferRange }, + { "glBindSampler", (QFunctionPointer) ::glBindSampler }, + { "glBindTransformFeedback", (QFunctionPointer) ::glBindTransformFeedback }, + { "glBindVertexArray", (QFunctionPointer) ::glBindVertexArray }, + { "glBlitFramebuffer", (QFunctionPointer) ::glBlitFramebuffer }, + { "glClearBufferfi", (QFunctionPointer) ::glClearBufferfi }, + { "glClearBufferfv", (QFunctionPointer) ::glClearBufferfv }, + { "glClearBufferiv", (QFunctionPointer) ::glClearBufferiv }, + { "glClearBufferuiv", (QFunctionPointer) ::glClearBufferuiv }, + { "glClientWaitSync", (QFunctionPointer) ::glClientWaitSync }, + { "glCompressedTexImage3D", (QFunctionPointer) ::glCompressedTexImage3D }, + { "glCompressedTexSubImage3D", (QFunctionPointer) ::glCompressedTexSubImage3D }, + { "glCopyBufferSubData", (QFunctionPointer) ::glCopyBufferSubData }, + { "glCopyTexSubImage3D", (QFunctionPointer) ::glCopyTexSubImage3D }, + { "glDeleteQueries", (QFunctionPointer) ::glDeleteQueries }, + { "glDeleteSamplers", (QFunctionPointer) ::glDeleteSamplers }, + { "glDeleteSync", (QFunctionPointer) ::glDeleteSync }, + { "glDeleteTransformFeedbacks", (QFunctionPointer) ::glDeleteTransformFeedbacks }, + { "glDeleteVertexArrays", (QFunctionPointer) ::glDeleteVertexArrays }, + { "glDrawArraysInstanced", (QFunctionPointer) ::glDrawArraysInstanced }, + { "glDrawBuffers", (QFunctionPointer) ::glDrawBuffers }, + { "glDrawElementsInstanced", (QFunctionPointer) ::glDrawElementsInstanced }, + { "glDrawRangeElements", (QFunctionPointer) ::glDrawRangeElements }, + { "glEndQuery", (QFunctionPointer) ::glEndQuery }, + { "glEndTransformFeedback", (QFunctionPointer) ::glEndTransformFeedback }, + { "glFenceSync", (QFunctionPointer) ::glFenceSync }, + { "glFlushMappedBufferRange", (QFunctionPointer) ::glFlushMappedBufferRange }, + { "glFramebufferTextureLayer", (QFunctionPointer) ::glFramebufferTextureLayer }, + { "glGenQueries", (QFunctionPointer) ::glGenQueries }, + { "glGenSamplers", (QFunctionPointer) ::glGenSamplers }, + { "glGenTransformFeedbacks", (QFunctionPointer) ::glGenTransformFeedbacks }, + { "glGenVertexArrays", (QFunctionPointer) ::glGenVertexArrays }, + { "glGetActiveUniformBlockName", (QFunctionPointer) ::glGetActiveUniformBlockName }, + { "glGetActiveUniformBlockiv", (QFunctionPointer) ::glGetActiveUniformBlockiv }, + { "glGetActiveUniformsiv", (QFunctionPointer) ::glGetActiveUniformsiv }, + { "glGetBufferParameteri64v", (QFunctionPointer) ::glGetBufferParameteri64v }, + { "glGetBufferPointerv", (QFunctionPointer) ::glGetBufferPointerv }, + { "glGetFragDataLocation", (QFunctionPointer) ::glGetFragDataLocation }, + { "glGetInteger64i_v", (QFunctionPointer) ::glGetInteger64i_v }, + { "glGetInteger64v", (QFunctionPointer) ::glGetInteger64v }, + { "glGetIntegeri_v", (QFunctionPointer) ::glGetIntegeri_v }, + { "glGetInternalformativ", (QFunctionPointer) ::glGetInternalformativ }, + { "glGetProgramBinary", (QFunctionPointer) ::glGetProgramBinary }, + { "glGetQueryObjectuiv", (QFunctionPointer) ::glGetQueryObjectuiv }, + { "glGetQueryiv", (QFunctionPointer) ::glGetQueryiv }, + { "glGetSamplerParameterfv", (QFunctionPointer) ::glGetSamplerParameterfv }, + { "glGetSamplerParameteriv", (QFunctionPointer) ::glGetSamplerParameteriv }, + { "glGetStringi", (QFunctionPointer) ::glGetStringi }, + { "glGetSynciv", (QFunctionPointer) ::glGetSynciv }, + { "glGetTransformFeedbackVarying", (QFunctionPointer) ::glGetTransformFeedbackVarying }, + { "glGetUniformBlockIndex", (QFunctionPointer) ::glGetUniformBlockIndex }, + { "glGetUniformIndices", (QFunctionPointer) ::glGetUniformIndices }, + { "glGetUniformuiv", (QFunctionPointer) ::glGetUniformuiv }, + { "glGetVertexAttribIiv", (QFunctionPointer) ::glGetVertexAttribIiv }, + { "glGetVertexAttribIuiv", (QFunctionPointer) ::glGetVertexAttribIuiv }, + { "glInvalidateFramebuffer", (QFunctionPointer) ::glInvalidateFramebuffer }, + { "glInvalidateSubFramebuffer", (QFunctionPointer) ::glInvalidateSubFramebuffer }, + { "glIsQuery", (QFunctionPointer) ::glIsQuery }, + { "glIsSampler", (QFunctionPointer) ::glIsSampler }, + { "glIsSync", (QFunctionPointer) ::glIsSync }, + { "glIsTransformFeedback", (QFunctionPointer) ::glIsTransformFeedback }, + { "glIsVertexArray", (QFunctionPointer) ::glIsVertexArray }, + { "glMapBufferRange", (QFunctionPointer) ::glMapBufferRange }, + { "glPauseTransformFeedback", (QFunctionPointer) ::glPauseTransformFeedback }, + { "glProgramBinary", (QFunctionPointer) ::glProgramBinary }, + { "glProgramParameteri", (QFunctionPointer) ::glProgramParameteri }, + { "glReadBuffer", (QFunctionPointer) ::glReadBuffer }, + { "glRenderbufferStorageMultisample", (QFunctionPointer) ::glRenderbufferStorageMultisample }, + { "glResumeTransformFeedback", (QFunctionPointer) ::glResumeTransformFeedback }, + { "glSamplerParameterf", (QFunctionPointer) ::glSamplerParameterf }, + { "glSamplerParameterfv", (QFunctionPointer) ::glSamplerParameterfv }, + { "glSamplerParameteri", (QFunctionPointer) ::glSamplerParameteri }, + { "glSamplerParameteriv", (QFunctionPointer) ::glSamplerParameteriv }, + { "glTexImage3D", (QFunctionPointer) ::glTexImage3D }, + { "glTexStorage2D", (QFunctionPointer) ::glTexStorage2D }, + { "glTexStorage3D", (QFunctionPointer) ::glTexStorage3D }, + { "glTexSubImage3D", (QFunctionPointer) ::glTexSubImage3D }, + { "glTransformFeedbackVaryings", (QFunctionPointer) ::glTransformFeedbackVaryings }, + { "glUniform1ui", (QFunctionPointer) ::glUniform1ui }, + { "glUniform1uiv", (QFunctionPointer) ::glUniform1uiv }, + { "glUniform2ui", (QFunctionPointer) ::glUniform2ui }, + { "glUniform2uiv", (QFunctionPointer) ::glUniform2uiv }, + { "glUniform3ui", (QFunctionPointer) ::glUniform3ui }, + { "glUniform3uiv", (QFunctionPointer) ::glUniform3uiv }, + { "glUniform4ui", (QFunctionPointer) ::glUniform4ui }, + { "glUniform4uiv", (QFunctionPointer) ::glUniform4uiv }, + { "glUniformBlockBinding", (QFunctionPointer) ::glUniformBlockBinding }, + { "glUniformMatrix2x3fv", (QFunctionPointer) ::glUniformMatrix2x3fv }, + { "glUniformMatrix2x4fv", (QFunctionPointer) ::glUniformMatrix2x4fv }, + { "glUniformMatrix3x2fv", (QFunctionPointer) ::glUniformMatrix3x2fv }, + { "glUniformMatrix3x4fv", (QFunctionPointer) ::glUniformMatrix3x4fv }, + { "glUniformMatrix4x2fv", (QFunctionPointer) ::glUniformMatrix4x2fv }, + { "glUniformMatrix4x3fv", (QFunctionPointer) ::glUniformMatrix4x3fv }, + { "glUnmapBuffer", (QFunctionPointer) ::glUnmapBuffer }, + { "glVertexAttribDivisor", (QFunctionPointer) ::glVertexAttribDivisor }, + { "glVertexAttribI4i", (QFunctionPointer) ::glVertexAttribI4i }, + { "glVertexAttribI4iv", (QFunctionPointer) ::glVertexAttribI4iv }, + { "glVertexAttribI4ui", (QFunctionPointer) ::glVertexAttribI4ui }, + { "glVertexAttribI4uiv", (QFunctionPointer) ::glVertexAttribI4uiv }, + { "glVertexAttribIPointer", (QFunctionPointer) ::glVertexAttribIPointer }, + { "glWaitSync", (QFunctionPointer) ::glWaitSync }, +#endif // QT_CONFIG(opengles3) + +#if QT_CONFIG(opengles31) + { "glActiveShaderProgram", (QFunctionPointer) ::glActiveShaderProgram }, + { "glBindImageTexture", (QFunctionPointer) ::glBindImageTexture }, + { "glBindProgramPipeline", (QFunctionPointer) ::glBindProgramPipeline }, + { "glBindVertexBuffer", (QFunctionPointer) ::glBindVertexBuffer }, + { "glCreateShaderProgramv", (QFunctionPointer) ::glCreateShaderProgramv }, + { "glDeleteProgramPipelines", (QFunctionPointer) ::glDeleteProgramPipelines }, + { "glDispatchCompute", (QFunctionPointer) ::glDispatchCompute }, + { "glDispatchComputeIndirect", (QFunctionPointer) ::glDispatchComputeIndirect }, + { "glDrawArraysIndirect", (QFunctionPointer) ::glDrawArraysIndirect }, + { "glDrawElementsIndirect", (QFunctionPointer) ::glDrawElementsIndirect }, + { "glFramebufferParameteri", (QFunctionPointer) ::glFramebufferParameteri }, + { "glGenProgramPipelines", (QFunctionPointer) ::glGenProgramPipelines }, + { "glGetBooleani_v", (QFunctionPointer) ::glGetBooleani_v }, + { "glGetFramebufferParameteriv", (QFunctionPointer) ::glGetFramebufferParameteriv }, + { "glGetMultisamplefv", (QFunctionPointer) ::glGetMultisamplefv }, + { "glGetProgramInterfaceiv", (QFunctionPointer) ::glGetProgramInterfaceiv }, + { "glGetProgramPipelineInfoLog", (QFunctionPointer) ::glGetProgramPipelineInfoLog }, + { "glGetProgramPipelineiv", (QFunctionPointer) ::glGetProgramPipelineiv }, + { "glGetProgramResourceIndex", (QFunctionPointer) ::glGetProgramResourceIndex }, + { "glGetProgramResourceLocation", (QFunctionPointer) ::glGetProgramResourceLocation }, + { "glGetProgramResourceName", (QFunctionPointer) ::glGetProgramResourceName }, + { "glGetProgramResourceiv", (QFunctionPointer) ::glGetProgramResourceiv }, + { "glGetTexLevelParameterfv", (QFunctionPointer) ::glGetTexLevelParameterfv }, + { "glGetTexLevelParameteriv", (QFunctionPointer) ::glGetTexLevelParameteriv }, + { "glIsProgramPipeline", (QFunctionPointer) ::glIsProgramPipeline }, + { "glMemoryBarrier", (QFunctionPointer) ::glMemoryBarrier }, + { "glMemoryBarrierByRegion", (QFunctionPointer) ::glMemoryBarrierByRegion }, + { "glProgramUniform1f", (QFunctionPointer) ::glProgramUniform1f }, + { "glProgramUniform1fv", (QFunctionPointer) ::glProgramUniform1fv }, + { "glProgramUniform1i", (QFunctionPointer) ::glProgramUniform1i }, + { "glProgramUniform1iv", (QFunctionPointer) ::glProgramUniform1iv }, + { "glProgramUniform1ui", (QFunctionPointer) ::glProgramUniform1ui }, + { "glProgramUniform1uiv", (QFunctionPointer) ::glProgramUniform1uiv }, + { "glProgramUniform2f", (QFunctionPointer) ::glProgramUniform2f }, + { "glProgramUniform2fv", (QFunctionPointer) ::glProgramUniform2fv }, + { "glProgramUniform2i", (QFunctionPointer) ::glProgramUniform2i }, + { "glProgramUniform2iv", (QFunctionPointer) ::glProgramUniform2iv }, + { "glProgramUniform2ui", (QFunctionPointer) ::glProgramUniform2ui }, + { "glProgramUniform2uiv", (QFunctionPointer) ::glProgramUniform2uiv }, + { "glProgramUniform3f", (QFunctionPointer) ::glProgramUniform3f }, + { "glProgramUniform3fv", (QFunctionPointer) ::glProgramUniform3fv }, + { "glProgramUniform3i", (QFunctionPointer) ::glProgramUniform3i }, + { "glProgramUniform3iv", (QFunctionPointer) ::glProgramUniform3iv }, + { "glProgramUniform3ui", (QFunctionPointer) ::glProgramUniform3ui }, + { "glProgramUniform3uiv", (QFunctionPointer) ::glProgramUniform3uiv }, + { "glProgramUniform4f", (QFunctionPointer) ::glProgramUniform4f }, + { "glProgramUniform4fv", (QFunctionPointer) ::glProgramUniform4fv }, + { "glProgramUniform4i", (QFunctionPointer) ::glProgramUniform4i }, + { "glProgramUniform4iv", (QFunctionPointer) ::glProgramUniform4iv }, + { "glProgramUniform4ui", (QFunctionPointer) ::glProgramUniform4ui }, + { "glProgramUniform4uiv", (QFunctionPointer) ::glProgramUniform4uiv }, + { "glProgramUniformMatrix2fv", (QFunctionPointer) ::glProgramUniformMatrix2fv }, + { "glProgramUniformMatrix2x3fv", (QFunctionPointer) ::glProgramUniformMatrix2x3fv }, + { "glProgramUniformMatrix2x4fv", (QFunctionPointer) ::glProgramUniformMatrix2x4fv }, + { "glProgramUniformMatrix3fv", (QFunctionPointer) ::glProgramUniformMatrix3fv }, + { "glProgramUniformMatrix3x2fv", (QFunctionPointer) ::glProgramUniformMatrix3x2fv }, + { "glProgramUniformMatrix3x4fv", (QFunctionPointer) ::glProgramUniformMatrix3x4fv }, + { "glProgramUniformMatrix4fv", (QFunctionPointer) ::glProgramUniformMatrix4fv }, + { "glProgramUniformMatrix4x2fv", (QFunctionPointer) ::glProgramUniformMatrix4x2fv }, + { "glProgramUniformMatrix4x3fv", (QFunctionPointer) ::glProgramUniformMatrix4x3fv }, + { "glSampleMaski", (QFunctionPointer) ::glSampleMaski }, + { "glTexStorage2DMultisample", (QFunctionPointer) ::glTexStorage2DMultisample }, + { "glUseProgramStages", (QFunctionPointer) ::glUseProgramStages }, + { "glValidateProgramPipeline", (QFunctionPointer) ::glValidateProgramPipeline }, + { "glVertexAttribBinding", (QFunctionPointer) ::glVertexAttribBinding }, + { "glVertexAttribFormat", (QFunctionPointer) ::glVertexAttribFormat }, + { "glVertexAttribIFormat", (QFunctionPointer) ::glVertexAttribIFormat }, + { "glVertexBindingDivisor", (QFunctionPointer) ::glVertexBindingDivisor }, +#endif // QT_CONFIG(opengles31) + +#if QT_CONFIG(opengles32) + { "glBlendBarrier", (QFunctionPointer) ::glBlendBarrier }, + { "glCopyImageSubData", (QFunctionPointer) ::glCopyImageSubData }, + { "glDebugMessageControl", (QFunctionPointer) ::glDebugMessageControl }, + { "glDebugMessageInsert", (QFunctionPointer) ::glDebugMessageInsert }, + { "glDebugMessageCallback", (QFunctionPointer) ::glDebugMessageCallback }, + { "glGetDebugMessageLog", (QFunctionPointer) ::glGetDebugMessageLog }, + { "glPushDebugGroup", (QFunctionPointer) ::glPushDebugGroup }, + { "glPopDebugGroup", (QFunctionPointer) ::glPopDebugGroup }, + { "glObjectLabel", (QFunctionPointer) ::glObjectLabel }, + { "glGetObjectLabel", (QFunctionPointer) ::glGetObjectLabel }, + { "glObjectPtrLabel", (QFunctionPointer) ::glObjectPtrLabel }, + { "glGetObjectPtrLabel", (QFunctionPointer) ::glGetObjectPtrLabel }, + { "glGetPointerv", (QFunctionPointer) ::glGetPointerv }, + { "glEnablei", (QFunctionPointer) ::glEnablei }, + { "glDisablei", (QFunctionPointer) ::glDisablei }, + { "glBlendEquationi", (QFunctionPointer) ::glBlendEquationi }, + { "glBlendEquationSeparatei", (QFunctionPointer) ::glBlendEquationSeparatei }, + { "glBlendFunci", (QFunctionPointer) ::glBlendFunci }, + { "glBlendFuncSeparatei", (QFunctionPointer) ::glBlendFuncSeparatei }, + { "glColorMaski", (QFunctionPointer) ::glColorMaski }, + { "glIsEnabledi", (QFunctionPointer) ::glIsEnabledi }, + { "glDrawElementsBaseVertex", (QFunctionPointer) ::glDrawElementsBaseVertex }, + { "glDrawRangeElementsBaseVertex", (QFunctionPointer) ::glDrawRangeElementsBaseVertex }, + { "glDrawElementsInstancedBaseVertex", (QFunctionPointer) ::glDrawElementsInstancedBaseVertex }, + { "glFramebufferTexture", (QFunctionPointer) ::glFramebufferTexture }, + { "glPrimitiveBoundingBox", (QFunctionPointer) ::glPrimitiveBoundingBox }, + { "glGetGraphicsResetStatus", (QFunctionPointer) ::glGetGraphicsResetStatus }, + { "glReadnPixels", (QFunctionPointer) ::glReadnPixels }, + { "glGetnUniformfv", (QFunctionPointer) ::glGetnUniformfv }, + { "glGetnUniformiv", (QFunctionPointer) ::glGetnUniformiv }, + { "glGetnUniformuiv", (QFunctionPointer) ::glGetnUniformuiv }, + { "glMinSampleShading", (QFunctionPointer) ::glMinSampleShading }, + { "glPatchParameteri", (QFunctionPointer) ::glPatchParameteri }, + { "glTexParameterIiv", (QFunctionPointer) ::glTexParameterIiv }, + { "glTexParameterIuiv", (QFunctionPointer) ::glTexParameterIuiv }, + { "glGetTexParameterIiv", (QFunctionPointer) ::glGetTexParameterIiv }, + { "glGetTexParameterIuiv", (QFunctionPointer) ::glGetTexParameterIuiv }, + { "glSamplerParameterIiv", (QFunctionPointer) ::glSamplerParameterIiv }, + { "glSamplerParameterIuiv", (QFunctionPointer) ::glSamplerParameterIuiv }, + { "glGetSamplerParameterIiv", (QFunctionPointer) ::glGetSamplerParameterIiv }, + { "glGetSamplerParameterIuiv", (QFunctionPointer) ::glGetSamplerParameterIuiv }, + { "glTexBuffer", (QFunctionPointer) ::glTexBuffer }, + { "glTexBufferRange", (QFunctionPointer) ::glTexBufferRange }, + { "glTexStorage3DMultisample", (QFunctionPointer) ::glTexStorage3DMultisample }, +#endif // QT_CONFIG(opengles32) + }; + + for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i) { + if (!qstrcmp(procName, standardFuncs[i].name)) { + proc = standardFuncs[i].func; + break; + } + } + } +#endif + + return proc; +} + +QSurfaceFormat QEGLPlatformContext::format() const +{ + return m_format; +} + +EGLContext QEGLPlatformContext::eglContext() const +{ + return m_eglContext; +} + +EGLDisplay QEGLPlatformContext::eglDisplay() const +{ + return m_eglDisplay; +} + +EGLConfig QEGLPlatformContext::eglConfig() const +{ + return m_eglConfig; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/platform/egl/qeglplatformcontext_p.h b/src/gui/opengl/platform/egl/qeglplatformcontext_p.h new file mode 100644 index 0000000000..b1e9c4b4c2 --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglplatformcontext_p.h @@ -0,0 +1,115 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLPLATFORMCONTEXT_H +#define QEGLPLATFORMCONTEXT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qtextstream.h> +#include <qpa/qplatformwindow.h> +#include <qpa/qplatformopenglcontext.h> +#include <QtCore/qvariant.h> +#include <QtGui/private/qt_egl_p.h> +#include <QtGui/private/qopenglcontext_p.h> + +QT_BEGIN_NAMESPACE + +class Q_GUI_EXPORT QEGLPlatformContext : public QPlatformOpenGLContext, + public QNativeInterface::QEGLContext +{ +public: + enum Flag { + NoSurfaceless = 0x01 + }; + Q_DECLARE_FLAGS(Flags, Flag) + + QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + EGLConfig *config = nullptr, Flags flags = { }); + + template <typename T> + static QOpenGLContext *createFrom(EGLContext context, EGLDisplay contextDisplay, + EGLDisplay platformDisplay, QOpenGLContext *shareContext) + { + if (!context) + return nullptr; + + // A context belonging to a given EGLDisplay cannot be used with another one + if (contextDisplay != platformDisplay) { + qWarning("QEGLPlatformContext: Cannot adopt context from different display"); + return nullptr; + } + + QPlatformOpenGLContext *shareHandle = shareContext ? shareContext->handle() : nullptr; + + auto *resultingContext = new QOpenGLContext; + auto *contextPrivate = QOpenGLContextPrivate::get(resultingContext); + auto *platformContext = new T; + platformContext->adopt(context, contextDisplay, shareHandle); + contextPrivate->adopt(platformContext); + return resultingContext; + } + + ~QEGLPlatformContext(); + + void initialize() override; + bool makeCurrent(QPlatformSurface *surface) override; + void doneCurrent() override; + void swapBuffers(QPlatformSurface *surface) override; + QFunctionPointer getProcAddress(const char *procName) override; + + QSurfaceFormat format() const override; + bool isSharing() const override { return m_shareContext != EGL_NO_CONTEXT; } + bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT && !m_markedInvalid; } + + EGLContext nativeContext() const override { return eglContext(); } + EGLConfig config() const override { return eglConfig(); } + EGLDisplay display() const override { return eglDisplay(); } + + virtual void invalidateContext() override { m_markedInvalid = true; } + + EGLContext eglContext() const; + EGLDisplay eglDisplay() const; + EGLConfig eglConfig() const; + +protected: + QEGLPlatformContext() {} // For adoption + virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0; + virtual EGLSurface createTemporaryOffscreenSurface(); + virtual void destroyTemporaryOffscreenSurface(EGLSurface surface); + virtual void runGLChecks(); + +private: + void adopt(EGLContext context, EGLDisplay display, QPlatformOpenGLContext *shareContext); + void updateFormatFromGL(); + + EGLContext m_eglContext; + EGLContext m_shareContext; + EGLDisplay m_eglDisplay; + EGLConfig m_eglConfig; + QSurfaceFormat m_format; + EGLenum m_api; + int m_swapInterval = -1; + bool m_swapIntervalEnvChecked = false; + int m_swapIntervalFromEnv = -1; + Flags m_flags; + bool m_ownsContext = false; + QList<EGLint> m_contextAttrs; + + bool m_markedInvalid = false; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QEGLPlatformContext::Flags) + +QT_END_NAMESPACE + +#endif //QEGLPLATFORMCONTEXT_H diff --git a/src/gui/opengl/platform/egl/qeglstreamconvenience.cpp b/src/gui/opengl/platform/egl/qeglstreamconvenience.cpp new file mode 100644 index 0000000000..869e763bb8 --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglstreamconvenience.cpp @@ -0,0 +1,87 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglstreamconvenience_p.h" +#include <string.h> + +QT_BEGIN_NAMESPACE + +QEGLStreamConvenience::QEGLStreamConvenience() + : initialized(false), + has_egl_platform_device(false), + has_egl_device_base(false), + has_egl_stream(false), + has_egl_stream_producer_eglsurface(false), + has_egl_stream_consumer_egloutput(false), + has_egl_output_drm(false), + has_egl_output_base(false), + has_egl_stream_cross_process_fd(false), + has_egl_stream_consumer_gltexture(false) +{ + const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + if (!extensions) { + qWarning("Failed to query EGL extensions"); + return; + } + + query_devices = reinterpret_cast<PFNEGLQUERYDEVICESEXTPROC>(eglGetProcAddress("eglQueryDevicesEXT")); + query_device_string = reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>(eglGetProcAddress("eglQueryDeviceStringEXT")); + get_platform_display = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT")); + + has_egl_device_base = strstr(extensions, "EGL_EXT_device_base"); + has_egl_platform_device = strstr(extensions, "EGL_EXT_platform_device"); +} + +void QEGLStreamConvenience::initialize(EGLDisplay dpy) +{ + if (initialized) + return; + + if (!eglBindAPI(EGL_OPENGL_ES_API)) { + qWarning("Failed to bind OpenGL ES API"); + return; + } + + const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS); + if (!extensions) { + qWarning("Failed to query EGL extensions"); + return; + } + + create_stream = reinterpret_cast<PFNEGLCREATESTREAMKHRPROC>(eglGetProcAddress("eglCreateStreamKHR")); + destroy_stream = reinterpret_cast<PFNEGLDESTROYSTREAMKHRPROC>(eglGetProcAddress("eglDestroyStreamKHR")); + stream_attrib = reinterpret_cast<PFNEGLSTREAMATTRIBKHRPROC>(eglGetProcAddress("eglStreamAttribKHR")); + query_stream = reinterpret_cast<PFNEGLQUERYSTREAMKHRPROC>(eglGetProcAddress("eglQueryStreamKHR")); + query_stream_u64 = reinterpret_cast<PFNEGLQUERYSTREAMU64KHRPROC>(eglGetProcAddress("eglQueryStreamu64KHR")); + create_stream_producer_surface = reinterpret_cast<PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC>(eglGetProcAddress("eglCreateStreamProducerSurfaceKHR")); + stream_consumer_output = reinterpret_cast<PFNEGLSTREAMCONSUMEROUTPUTEXTPROC>(eglGetProcAddress("eglStreamConsumerOutputEXT")); + get_output_layers = reinterpret_cast<PFNEGLGETOUTPUTLAYERSEXTPROC>(eglGetProcAddress("eglGetOutputLayersEXT")); + get_output_ports = reinterpret_cast<PFNEGLGETOUTPUTPORTSEXTPROC>(eglGetProcAddress("eglGetOutputPortsEXT")); + output_layer_attrib = reinterpret_cast<PFNEGLOUTPUTLAYERATTRIBEXTPROC>(eglGetProcAddress("eglOutputLayerAttribEXT")); + query_output_layer_attrib = reinterpret_cast<PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC>(eglGetProcAddress("eglQueryOutputLayerAttribEXT")); + query_output_layer_string = reinterpret_cast<PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC>(eglGetProcAddress("eglQueryOutputLayerStringEXT")); + query_output_port_attrib = reinterpret_cast<PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC>(eglGetProcAddress("eglQueryOutputPortAttribEXT")); + query_output_port_string = reinterpret_cast<PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC>(eglGetProcAddress("eglQueryOutputPortStringEXT")); + get_stream_file_descriptor = reinterpret_cast<PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC>(eglGetProcAddress("eglGetStreamFileDescriptorKHR")); + create_stream_from_file_descriptor = reinterpret_cast<PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC>(eglGetProcAddress("eglCreateStreamFromFileDescriptorKHR")); + stream_consumer_gltexture = reinterpret_cast<PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC>(eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR")); + stream_consumer_acquire = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREKHRPROC>(eglGetProcAddress("eglStreamConsumerAcquireKHR")); + stream_consumer_release = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEKHRPROC>(eglGetProcAddress("eglStreamConsumerReleaseKHR")); + create_stream_attrib_nv = reinterpret_cast<PFNEGLCREATESTREAMATTRIBNVPROC>(eglGetProcAddress("eglCreateStreamAttribNV")); + set_stream_attrib_nv = reinterpret_cast<PFNEGLSETSTREAMATTRIBNVPROC>(eglGetProcAddress("eglSetStreamAttribNV")); + query_stream_attrib_nv = reinterpret_cast<PFNEGLQUERYSTREAMATTRIBNVPROC>(eglGetProcAddress("eglQueryStreamAttribNV")); + acquire_stream_attrib_nv = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC>(eglGetProcAddress("eglStreamConsumerAcquireAttribNV")); + release_stream_attrib_nv = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC>(eglGetProcAddress("eglStreamConsumerReleaseAttribNV")); + + has_egl_stream = strstr(extensions, "EGL_KHR_stream"); + has_egl_stream_producer_eglsurface = strstr(extensions, "EGL_KHR_stream_producer_eglsurface"); + has_egl_stream_consumer_egloutput = strstr(extensions, "EGL_EXT_stream_consumer_egloutput"); + has_egl_output_drm = strstr(extensions, "EGL_EXT_output_drm"); + has_egl_output_base = strstr(extensions, "EGL_EXT_output_base"); + has_egl_stream_cross_process_fd = strstr(extensions, "EGL_KHR_stream_cross_process_fd"); + has_egl_stream_consumer_gltexture = strstr(extensions, "EGL_KHR_stream_consumer_gltexture"); + + initialized = true; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h b/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h new file mode 100644 index 0000000000..edf73fe981 --- /dev/null +++ b/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h @@ -0,0 +1,179 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLSTREAMCONVENIENCE_H +#define QEGLSTREAMCONVENIENCE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtGui/qtguiglobal.h> + +#include <QtGui/private/qt_egl_p.h> + +// This provides runtime EGLDevice/Output/Stream support even when eglext.h in +// the sysroot is not up-to-date. + +#ifndef EGL_VERSION_1_5 +typedef intptr_t EGLAttrib; +#endif + +#ifndef EGL_EXT_platform_base +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); +#endif + +#ifndef EGL_EXT_device_base +typedef void *EGLDeviceEXT; +#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0)) +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); +#endif + +#ifndef EGL_EXT_output_base +typedef void *EGLOutputLayerEXT; +typedef void *EGLOutputPortEXT; +#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0) +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#endif + +#ifndef EGL_KHR_stream +typedef void *EGLStreamKHR; +typedef quint64 EGLuint64KHR; +#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif + +#ifndef EGL_KHR_stream_fifo +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#endif + +#ifndef EGL_KHR_stream_producer_eglsurface +#define EGL_STREAM_BIT_KHR 0x0800 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif + +#ifndef EGL_KHR_stream_cross_process_fd +typedef int EGLNativeFileDescriptorKHR; +#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif + +#ifndef EGL_KHR_stream_consumer_gltexture +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#endif + +#ifndef EGL_EXT_stream_consumer_egloutput +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#endif + +#ifndef EGL_EXT_platform_device +#define EGL_PLATFORM_DEVICE_EXT 0x313F +#endif + +#ifndef EGL_EXT_device_drm +#define EGL_DRM_DEVICE_FILE_EXT 0x3233 +#endif + +#ifndef EGL_EXT_output_drm +#define EGL_DRM_CRTC_EXT 0x3234 +#define EGL_DRM_PLANE_EXT 0x3235 +#endif + +#ifndef EGL_PLATFORM_X11_KHR +#define EGL_PLATFORM_X11_KHR 0x31D5 +#endif + +#ifndef EGL_PLATFORM_XCB_KHR +#define EGL_PLATFORM_XCB_KHR 0x31DC +#endif + +#ifndef EGL_NV_stream_attrib +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#endif + +QT_BEGIN_NAMESPACE + +class Q_GUI_EXPORT QEGLStreamConvenience +{ +public: + QEGLStreamConvenience(); + void initialize(EGLDisplay dpy); + + PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display; + PFNEGLQUERYDEVICESEXTPROC query_devices; + PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string; + PFNEGLCREATESTREAMKHRPROC create_stream; + PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib_nv; + PFNEGLSETSTREAMATTRIBNVPROC set_stream_attrib_nv; + PFNEGLQUERYSTREAMATTRIBNVPROC query_stream_attrib_nv; + PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC acquire_stream_attrib_nv; + PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC release_stream_attrib_nv; + PFNEGLDESTROYSTREAMKHRPROC destroy_stream; + PFNEGLSTREAMATTRIBKHRPROC stream_attrib; + PFNEGLQUERYSTREAMKHRPROC query_stream; + PFNEGLQUERYSTREAMU64KHRPROC query_stream_u64; + PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface; + PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output; + PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers; + PFNEGLGETOUTPUTPORTSEXTPROC get_output_ports; + PFNEGLOUTPUTLAYERATTRIBEXTPROC output_layer_attrib; + PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib; + PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC query_output_layer_string; + PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC query_output_port_attrib; + PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC query_output_port_string; + PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC get_stream_file_descriptor; + PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_file_descriptor; + PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture; + PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire; + PFNEGLSTREAMCONSUMERRELEASEKHRPROC stream_consumer_release; + + bool initialized; + + bool has_egl_platform_device; + bool has_egl_device_base; + bool has_egl_stream; + bool has_egl_stream_producer_eglsurface; + bool has_egl_stream_consumer_egloutput; + bool has_egl_output_drm; + bool has_egl_output_base; + bool has_egl_stream_cross_process_fd; + bool has_egl_stream_consumer_gltexture; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/opengl/platform/egl/qt_egl_p.h b/src/gui/opengl/platform/egl/qt_egl_p.h new file mode 100644 index 0000000000..1f538e22af --- /dev/null +++ b/src/gui/opengl/platform/egl/qt_egl_p.h @@ -0,0 +1,97 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QT_EGL_P_H +#define QT_EGL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +// q(data/text)stream.h must be included before any header file that defines Status +#include <QtCore/qdatastream.h> +#include <QtCore/qtextstream.h> +#include <QtCore/private/qglobal_p.h> + +#ifdef QT_EGL_NO_X11 +# ifndef EGL_NO_X11 +# define EGL_NO_X11 +# endif +# ifndef MESA_EGL_NO_X11_HEADERS +# define MESA_EGL_NO_X11_HEADERS // MESA +# endif +# if !defined(Q_OS_INTEGRITY) +# define WIN_INTERFACE_CUSTOM // NV +# endif // Q_OS_INTEGRITY +#else // QT_EGL_NO_X11 +// If one has an eglplatform.h with https://github.com/KhronosGroup/EGL-Registry/pull/130 +// that needs USE_X11 to be defined. +# define USE_X11 +#endif + +#ifdef QT_EGL_WAYLAND +# define WAYLAND // NV +#endif // QT_EGL_WAYLAND + +#include <EGL/egl.h> +#include <EGL/eglext.h> + +#include <stdint.h> + +QT_BEGIN_NAMESPACE + +namespace QtInternal { + +template <class FromType, class ToType> +struct QtEglConverter +{ + static inline ToType convert(FromType v) + { return v; } +}; + +template <> +struct QtEglConverter<uint32_t, uintptr_t> +{ + static inline uintptr_t convert(uint32_t v) + { return v; } +}; + +#if QT_POINTER_SIZE > 4 +template <> +struct QtEglConverter<uintptr_t, uint32_t> +{ + static inline uint32_t convert(uintptr_t v) + { return uint32_t(v); } +}; +#endif + +template <> +struct QtEglConverter<uint32_t, void *> +{ + static inline void *convert(uint32_t v) + { return reinterpret_cast<void *>(uintptr_t(v)); } +}; + +template <> +struct QtEglConverter<void *, uint32_t> +{ + static inline uint32_t convert(void *v) + { return uintptr_t(v); } +}; + +} // QtInternal + +template <class ToType, class FromType> +static inline ToType qt_egl_cast(FromType from) +{ return QtInternal::QtEglConverter<FromType, ToType>::convert(from); } + +QT_END_NAMESPACE + +#endif // QT_EGL_P_H diff --git a/src/gui/opengl/platform/unix/qglxconvenience.cpp b/src/gui/opengl/platform/unix/qglxconvenience.cpp new file mode 100644 index 0000000000..ce70818042 --- /dev/null +++ b/src/gui/opengl/platform/unix/qglxconvenience.cpp @@ -0,0 +1,437 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +// We have to include this before the X11 headers dragged in by +// qglxconvenience_p.h. +#include <QtCore/qbytearray.h> +#include <QtCore/qmetatype.h> +#include <QtCore/qscopedpointer.h> +#include <QtCore/qtextstream.h> +#include <QtGui/qcolorspace.h> +#include "qglxconvenience_p.h" + +#include <QtCore/qloggingcategory.h> +#include <QtCore/qvarlengtharray.h> + + +#include <GL/glxext.h> + +enum { + XFocusOut = FocusOut, + XFocusIn = FocusIn, + XKeyPress = KeyPress, + XKeyRelease = KeyRelease, + XNone = None, + XRevertToParent = RevertToParent, + XGrayScale = GrayScale, + XCursorShape = CursorShape +}; +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + +#ifndef GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 +#endif + +QT_BEGIN_NAMESPACE + +Q_LOGGING_CATEGORY(lcGlx, "qt.glx") + +QList<int> qglx_buildSpec(const QSurfaceFormat &format, int drawableBit, int flags) +{ + QList<int> spec; + + spec << GLX_LEVEL + << 0 + + << GLX_RENDER_TYPE + << GLX_RGBA_BIT + + << GLX_RED_SIZE + << qMax(1, format.redBufferSize()) + + << GLX_GREEN_SIZE + << qMax(1, format.greenBufferSize()) + + << GLX_BLUE_SIZE + << qMax(1, format.blueBufferSize()) + + << GLX_ALPHA_SIZE + << qMax(0, format.alphaBufferSize()); + + if (format.swapBehavior() != QSurfaceFormat::SingleBuffer) + spec << GLX_DOUBLEBUFFER + << True; + + if (format.stereo()) + spec << GLX_STEREO + << True; + + if (format.depthBufferSize() != -1) + spec << GLX_DEPTH_SIZE + << format.depthBufferSize(); + + if (format.stencilBufferSize() != -1) + spec << GLX_STENCIL_SIZE + << format.stencilBufferSize(); + + if (format.samples() > 1) + spec << GLX_SAMPLE_BUFFERS_ARB + << 1 + << GLX_SAMPLES_ARB + << format.samples(); + + if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QColorSpace::SRgb) + spec << GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB + << True; + + spec << GLX_DRAWABLE_TYPE + << drawableBit + + << XNone; + + return spec; +} + +namespace { +struct QXcbSoftwareOpenGLEnforcer { + QXcbSoftwareOpenGLEnforcer() { + // Allow forcing LIBGL_ALWAYS_SOFTWARE for Qt 5 applications only. + // This is most useful with drivers that only support OpenGL 1. + // We need OpenGL 2, but the user probably doesn't want + // LIBGL_ALWAYS_SOFTWARE in OpenGL 1 apps. + + if (!checkedForceSoftwareOpenGL) { + // If LIBGL_ALWAYS_SOFTWARE is already set, don't mess with it. + // We want to unset LIBGL_ALWAYS_SOFTWARE at the end so it does not + // get inherited by other processes, of course only if it wasn't + // already set before. + if (!qEnvironmentVariableIsEmpty("QT_XCB_FORCE_SOFTWARE_OPENGL") + && !qEnvironmentVariableIsSet("LIBGL_ALWAYS_SOFTWARE")) + forceSoftwareOpenGL = true; + + checkedForceSoftwareOpenGL = true; + } + + if (forceSoftwareOpenGL) + qputenv("LIBGL_ALWAYS_SOFTWARE", "1"); + } + + ~QXcbSoftwareOpenGLEnforcer() { + // unset LIBGL_ALWAYS_SOFTWARE now so other processes don't inherit it + if (forceSoftwareOpenGL) + qunsetenv("LIBGL_ALWAYS_SOFTWARE"); + } + + static bool checkedForceSoftwareOpenGL; + static bool forceSoftwareOpenGL; +}; + +bool QXcbSoftwareOpenGLEnforcer::checkedForceSoftwareOpenGL = false; +bool QXcbSoftwareOpenGLEnforcer::forceSoftwareOpenGL = false; + +template <class T> +struct QXlibScopedPointerDeleter { + static inline void cleanup(T *pointer) { + if (pointer) + XFree(pointer); + } +}; + +template <class T> +using QXlibPointer = QScopedPointer<T, QXlibScopedPointerDeleter<T>>; + +template <class T> +using QXlibArrayPointer = QScopedArrayPointer<T, QXlibScopedPointerDeleter<T>>; +} + +GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format, bool highestPixelFormat, int drawableBit, int flags) +{ + QXcbSoftwareOpenGLEnforcer softwareOpenGLEnforcer; + + GLXFBConfig config = nullptr; + + do { + const QList<int> spec = qglx_buildSpec(format, drawableBit, flags); + + int confcount = 0; + QXlibArrayPointer<GLXFBConfig> configs(glXChooseFBConfig(display, screen, spec.constData(), &confcount)); + + if (!config && confcount > 0) { + config = configs[0]; + if (highestPixelFormat && !format.hasAlpha()) + break; + } + + const int requestedRed = qMax(0, format.redBufferSize()); + const int requestedGreen = qMax(0, format.greenBufferSize()); + const int requestedBlue = qMax(0, format.blueBufferSize()); + const int requestedAlpha = qMax(0, format.alphaBufferSize()); + + GLXFBConfig compatibleCandidate = nullptr; + for (int i = 0; i < confcount; i++) { + GLXFBConfig candidate = configs[i]; + + if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QColorSpace::SRgb) { + int srgbCapable = 0; + glXGetFBConfigAttrib(display, candidate, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable); + if (!srgbCapable) + continue; + } + + QXlibPointer<XVisualInfo> visual(glXGetVisualFromFBConfig(display, candidate)); + if (!visual) + continue; + int actualRed; + int actualGreen; + int actualBlue; + int actualAlpha; + glXGetFBConfigAttrib(display, candidate, GLX_RED_SIZE, &actualRed); + glXGetFBConfigAttrib(display, candidate, GLX_GREEN_SIZE, &actualGreen); + glXGetFBConfigAttrib(display, candidate, GLX_BLUE_SIZE, &actualBlue); + glXGetFBConfigAttrib(display, candidate, GLX_ALPHA_SIZE, &actualAlpha); + // Sometimes the visuals don't have a depth that includes the alpha channel. + actualAlpha = qMin(actualAlpha, visual->depth - actualRed - actualGreen - actualBlue); + + if (requestedRed && actualRed < requestedRed) + continue; + if (requestedGreen && actualGreen < requestedGreen) + continue; + if (requestedBlue && actualBlue < requestedBlue) + continue; + if (requestedAlpha && actualAlpha < requestedAlpha) + continue; + if (!compatibleCandidate) // Only pick up the first compatible one offered by the server + compatibleCandidate = candidate; + + if (requestedRed && actualRed != requestedRed) + continue; + if (requestedGreen && actualGreen != requestedGreen) + continue; + if (requestedBlue && actualBlue != requestedBlue) + continue; + if (requestedAlpha && actualAlpha != requestedAlpha) + continue; + + return candidate; + } + if (compatibleCandidate) { + qCDebug(lcGlx) << "qglx_findConfig: Found non-matching but compatible FBConfig"; + return compatibleCandidate; + } + } while (qglx_reduceFormat(&format)); + + if (!config) + qCWarning(lcGlx) << "qglx_findConfig: Failed to finding matching FBConfig for" << format; + + return config; +} + +XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format, int drawableBit, int flags) +{ + Q_ASSERT(format); + + XVisualInfo *visualInfo = nullptr; + + GLXFBConfig config = qglx_findConfig(display, screen, *format, false, drawableBit, flags); + if (config) + visualInfo = glXGetVisualFromFBConfig(display, config); + + if (visualInfo) { + qglx_surfaceFormatFromGLXFBConfig(format, display, config, flags); + return visualInfo; + } + + // attempt to fall back to glXChooseVisual + do { + QList<int> attribs = qglx_buildSpec(*format, drawableBit, flags); + visualInfo = glXChooseVisual(display, screen, attribs.data()); + + if (visualInfo) { + qglx_surfaceFormatFromVisualInfo(format, display, visualInfo, flags); + return visualInfo; + } + } while (qglx_reduceFormat(format)); + + return visualInfo; +} + +void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display, GLXFBConfig config, int flags) +{ + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleBuffers = 0; + int sampleCount = 0; + int stereo = 0; + int srgbCapable = 0; + + glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); + glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); + glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); + glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); + glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); + glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); + glXGetFBConfigAttrib(display, config, GLX_SAMPLE_BUFFERS_ARB, &sampleBuffers); + glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); + if (flags & QGLX_SUPPORTS_SRGB) + glXGetFBConfigAttrib(display, config, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable); + + format->setRedBufferSize(redSize); + format->setGreenBufferSize(greenSize); + format->setBlueBufferSize(blueSize); + format->setAlphaBufferSize(alphaSize); + format->setDepthBufferSize(depthSize); + format->setStencilBufferSize(stencilSize); + if (sampleBuffers) { + glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); + format->setSamples(sampleCount); + } + if (srgbCapable) + format->setColorSpace(QColorSpace::SRgb); + else + format->setColorSpace(QColorSpace()); + + format->setStereo(stereo); +} + +void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display, XVisualInfo *visualInfo, int flags) +{ + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleBuffers = 0; + int sampleCount = 0; + int stereo = 0; + int srgbCapable = 0; + + glXGetConfig(display, visualInfo, GLX_RED_SIZE, &redSize); + glXGetConfig(display, visualInfo, GLX_GREEN_SIZE, &greenSize); + glXGetConfig(display, visualInfo, GLX_BLUE_SIZE, &blueSize); + glXGetConfig(display, visualInfo, GLX_ALPHA_SIZE, &alphaSize); + glXGetConfig(display, visualInfo, GLX_DEPTH_SIZE, &depthSize); + glXGetConfig(display, visualInfo, GLX_STENCIL_SIZE, &stencilSize); + glXGetConfig(display, visualInfo, GLX_SAMPLE_BUFFERS_ARB, &sampleBuffers); + glXGetConfig(display, visualInfo, GLX_STEREO, &stereo); + if (flags & QGLX_SUPPORTS_SRGB) + glXGetConfig(display, visualInfo, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable); + + format->setRedBufferSize(redSize); + format->setGreenBufferSize(greenSize); + format->setBlueBufferSize(blueSize); + format->setAlphaBufferSize(alphaSize); + format->setDepthBufferSize(depthSize); + format->setStencilBufferSize(stencilSize); + if (sampleBuffers) { + glXGetConfig(display, visualInfo, GLX_SAMPLES_ARB, &sampleCount); + format->setSamples(sampleCount); + } + if (srgbCapable) + format->setColorSpace(QColorSpace::SRgb); + else + format->setColorSpace(QColorSpace()); + + format->setStereo(stereo); +} + +bool qglx_reduceFormat(QSurfaceFormat *format) +{ + Q_ASSERT(format); + if (std::max(std::max(format->redBufferSize(), format->greenBufferSize()), format->blueBufferSize()) > 8) { + if (format->alphaBufferSize() > 2) { + // First try to match 10 10 10 2 + format->setAlphaBufferSize(2); + return true; + } + + format->setRedBufferSize(std::min(format->redBufferSize(), 8)); + format->setGreenBufferSize(std::min(format->greenBufferSize(), 8)); + format->setBlueBufferSize(std::min(format->blueBufferSize(), 8)); + return true; + } + + if (format->redBufferSize() > 1) { + format->setRedBufferSize(1); + return true; + } + + if (format->greenBufferSize() > 1) { + format->setGreenBufferSize(1); + return true; + } + + if (format->blueBufferSize() > 1) { + format->setBlueBufferSize(1); + return true; + } + + if (format->swapBehavior() != QSurfaceFormat::SingleBuffer){ + format->setSwapBehavior(QSurfaceFormat::SingleBuffer); + return true; + } + + if (format->samples() > 1) { + format->setSamples(qMin(16, format->samples() / 2)); + return true; + } + + if (format->depthBufferSize() >= 32) { + format->setDepthBufferSize(24); + return true; + } + + if (format->depthBufferSize() > 1) { + format->setDepthBufferSize(1); + return true; + } + + if (format->depthBufferSize() > 0) { + format->setDepthBufferSize(0); + return true; + } + + if (format->hasAlpha()) { + format->setAlphaBufferSize(0); + return true; + } + + if (format->stencilBufferSize() > 1) { + format->setStencilBufferSize(1); + return true; + } + + if (format->stencilBufferSize() > 0) { + format->setStencilBufferSize(0); + return true; + } + + if (format->stereo()) { + format->setStereo(false); + return true; + } + + if (format->colorSpace() == QColorSpace::SRgb) { + format->setColorSpace(QColorSpace()); + return true; + } + + return false; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/platform/unix/qglxconvenience_p.h b/src/gui/opengl/platform/unix/qglxconvenience_p.h new file mode 100644 index 0000000000..c755356c50 --- /dev/null +++ b/src/gui/opengl/platform/unix/qglxconvenience_p.h @@ -0,0 +1,57 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QGLXCONVENIENCE_H +#define QGLXCONVENIENCE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qlist.h> +#include <QtGui/qsurfaceformat.h> +#include <QtCore/private/qglobal_p.h> + +#include <X11/Xlib.h> +#include <GL/glx.h> + +QT_BEGIN_NAMESPACE + +enum QGlxFlags +{ + QGLX_SUPPORTS_SRGB = 0x01 +}; + +Q_GUI_EXPORT QList<int> qglx_buildSpec(const QSurfaceFormat &format, + int drawableBit = GLX_WINDOW_BIT, + int flags = 0); + +Q_GUI_EXPORT XVisualInfo *qglx_findVisualInfo(Display *display, int screen, + QSurfaceFormat *format, + int drawableBit = GLX_WINDOW_BIT, + int flags = 0); + +Q_GUI_EXPORT GLXFBConfig qglx_findConfig(Display *display, int screen, + QSurfaceFormat format, + bool highestPixelFormat = false, + int drawableBit = GLX_WINDOW_BIT, + int flags = 0); + +Q_GUI_EXPORT void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display, + GLXFBConfig config, int flags = 0); + +Q_GUI_EXPORT void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display, + XVisualInfo *visualInfo, int flags = 0); + +Q_GUI_EXPORT bool qglx_reduceFormat(QSurfaceFormat *format); + +QT_END_NAMESPACE + +#endif // QGLXCONVENIENCE_H diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 3066b83282..587975085a 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qopengl.h" #include "qopengl_p.h" @@ -56,6 +20,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #if defined(QT_OPENGL_3) typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint); #endif @@ -210,10 +176,10 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v) if (!v.isObject()) return result; const QJsonObject o = v.toObject(); - result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString()); - const QString opS = o.value(QLatin1String("op")).toString(); + result.number = QVersionNumber::fromString(o.value("value"_L1).toString()); + const QString opS = o.value("op"_L1).toString(); for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) { - if (opS == QLatin1String(operators[i])) { + if (opS == QLatin1StringView(operators[i])) { result.op = static_cast<Operator>(i); break; } @@ -229,29 +195,13 @@ struct OsTypeTerm static QString hostOs(); static QVersionNumber hostKernelVersion() { return QVersionNumber::fromString(QSysInfo::kernelVersion()); } static QString hostOsRelease() { - QString ver; #ifdef Q_OS_WIN - const auto osver = QOperatingSystemVersion::current(); -#define Q_WINVER(major, minor) (major << 8 | minor) - switch (Q_WINVER(osver.majorVersion(), osver.minorVersion())) { - case Q_WINVER(6, 1): - ver = QStringLiteral("7"); - break; - case Q_WINVER(6, 2): - ver = QStringLiteral("8"); - break; - case Q_WINVER(6, 3): - ver = QStringLiteral("8.1"); - break; - case Q_WINVER(10, 0): - ver = QStringLiteral("10"); - break; - default: - break; - } -#undef Q_WINVER + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11) + return u"11"_s; + return u"10"_s; +#else + return {}; #endif - return ver; } bool isNull() const { return type.isEmpty(); } @@ -282,9 +232,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v) if (!v.isObject()) return result; const QJsonObject o = v.toObject(); - result.type = o.value(QLatin1String("type")).toString(); - result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version"))); - result.release = o.value(QLatin1String("release")).toArray(); + result.type = o.value("type"_L1).toString(); + result.versionTerm = VersionTerm::fromJson(o.value("version"_L1)); + result.release = o.value("release"_L1).toArray(); return result; } @@ -308,8 +258,8 @@ QString OsTypeTerm::hostOs() static QString msgSyntaxWarning(const QJsonObject &object, const QString &what) { QString result; - QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt() - << " (\"" << object.value(QLatin1String("description")).toString() + QTextStream(&result) << "Id " << object.value("id"_L1).toInt() + << " (\"" << object.value("description"_L1).toString() << "\"): " << what; return result; } @@ -323,11 +273,11 @@ static bool matches(const QJsonObject &object, const QString &osRelease, const QOpenGLConfig::Gpu &gpu) { - const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os"))); + const OsTypeTerm os = OsTypeTerm::fromJson(object.value("os"_L1)); if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease)) return false; - const QJsonValue exceptionsV = object.value(QLatin1String("exceptions")); + const QJsonValue exceptionsV = object.value("exceptions"_L1); if (exceptionsV.isArray()) { const QJsonArray exceptionsA = exceptionsV.toArray(); for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) { @@ -336,20 +286,20 @@ static bool matches(const QJsonObject &object, } } - const QJsonValue vendorV = object.value(QLatin1String("vendor_id")); + const QJsonValue vendorV = object.value("vendor_id"_L1); if (vendorV.isString()) { if (gpu.vendorId != vendorV.toString().toUInt(nullptr, /* base */ 0)) return false; } else { - if (object.contains(QLatin1String("gl_vendor"))) { - const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8(); + if (object.contains("gl_vendor"_L1)) { + const QByteArray glVendorV = object.value("gl_vendor"_L1).toString().toUtf8(); if (!gpu.glVendor.contains(glVendorV)) return false; } } if (gpu.deviceId) { - const QJsonValue deviceIdV = object.value(QLatin1String("device_id")); + const QJsonValue deviceIdV = object.value("device_id"_L1); switch (deviceIdV.type()) { case QJsonValue::Array: if (!contains(deviceIdV.toArray(), gpu.deviceId)) @@ -360,12 +310,11 @@ static bool matches(const QJsonObject &object, break; default: qWarning().noquote() - << msgSyntaxWarning(object, - QLatin1String("Device ID must be of type array.")); + << msgSyntaxWarning(object, "Device ID must be of type array."_L1); } } if (!gpu.driverVersion.isNull()) { - const QJsonValue driverVersionV = object.value(QLatin1String("driver_version")); + const QJsonValue driverVersionV = object.value("driver_version"_L1); switch (driverVersionV.type()) { case QJsonValue::Object: if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion)) @@ -376,13 +325,12 @@ static bool matches(const QJsonObject &object, break; default: qWarning().noquote() - << msgSyntaxWarning(object, - QLatin1String("Driver version must be of type object.")); + << msgSyntaxWarning(object, "Driver version must be of type object."_L1); } } if (!gpu.driverDescription.isEmpty()) { - const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description")); + const QJsonValue driverDescriptionV = object.value("driver_description"_L1); if (driverDescriptionV.isString()) { if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8())) return false; @@ -402,9 +350,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, { result->clear(); errorMessage->clear(); - const QJsonValue entriesV = doc.object().value(QLatin1String("entries")); + const QJsonValue entriesV = doc.object().value("entries"_L1); if (!entriesV.isArray()) { - *errorMessage = QLatin1String("No entries read."); + *errorMessage = "No entries read."_L1; return false; } @@ -413,7 +361,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, if (eit->isObject()) { const QJsonObject object = eit->toObject(); if (matches(object, osName, kernelVersion, osRelease, gpu)) { - const QJsonValue featuresListV = object.value(QLatin1String("features")); + const QJsonValue featuresListV = object.value("features"_L1); if (featuresListV.isArray()) { const QJsonArray featuresListA = featuresListV.toArray(); for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit) @@ -437,7 +385,8 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, QJsonParseError error; const QJsonDocument document = QJsonDocument::fromJson(jsonAsciiData, &error); if (document.isNull()) { - const int lineNumber = 1 + jsonAsciiData.left(error.offset).count('\n'); + const qsizetype lineNumber = + QByteArrayView(jsonAsciiData).left(error.offset).count('\n') + 1; QTextStream str(errorMessage); str << "Failed to parse data: \"" << error.errorString() << "\" at line " << lineNumber << " (offset: " @@ -465,9 +414,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, } const bool success = readGpuFeatures(gpu, osName, kernelVersion, osRelease, file.readAll(), result, errorMessage); if (!success) { - errorMessage->prepend(QLatin1String("Error reading \"") + errorMessage->prepend("Error reading \""_L1 + QDir::toNativeSeparators(fileName) - + QLatin1String("\": ")); + + "\": "_L1); } return success; } diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 5c0885f4ec..e9a11080ce 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENGL_H #define QOPENGL_H @@ -44,9 +8,19 @@ #ifndef QT_NO_OPENGL -// Windows always needs this to ensure that APIENTRY gets defined +// On Windows we need to ensure that APIENTRY and WINGDIAPI are defined before +// we can include gl.h. But we do not want to include <windows.h> in this public +// Qt header, as it pollutes the global namespace with macros. #if defined(Q_OS_WIN) -# include <QtCore/qt_windows.h> +# ifndef APIENTRY +# define APIENTRY __stdcall +# define Q_UNDEF_APIENTRY +# endif // APIENTRY +# ifndef WINGDIAPI +# define WINGDIAPI __declspec(dllimport) +# define Q_UNDEF_WINGDIAPI +# endif // WINGDIAPI +# define QT_APIENTRY __stdcall #endif // Note: Apple is a "controlled platform" for OpenGL ABI so we @@ -157,20 +131,18 @@ typedef char GLchar; # endif #endif -QT_BEGIN_NAMESPACE - // When all else fails we provide sensible fallbacks - this is needed to // allow compilation on OS X 10.6 #if !QT_CONFIG(opengles2) // OS X 10.6 doesn't define these which are needed below -// OS X 10.7 and later defien them in gl3.h -#ifndef APIENTRY -#define APIENTRY +// OS X 10.7 and later define them in gl3.h +#ifndef QT_APIENTRY +#define QT_APIENTRY #endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * +#ifndef QT_APIENTRYP +#define QT_APIENTRYP QT_APIENTRY * #endif #ifndef GLAPI #define GLAPI extern @@ -269,15 +241,15 @@ struct _cl_event; #endif #ifndef GL_ARB_debug_output -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam); +typedef void (QT_APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam); #endif #ifndef GL_AMD_debug_output -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +typedef void (QT_APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); #endif #ifndef GL_KHR_debug -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam); +typedef void (QT_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam); #endif #ifndef GL_NV_vdpau_interop @@ -287,14 +259,15 @@ typedef GLintptr GLvdpauSurfaceNV; // End of block copied from glext.h #endif +QT_BEGIN_NAMESPACE // Types that aren't defined in all system's gl.h files. typedef ptrdiff_t qopengl_GLintptr; typedef ptrdiff_t qopengl_GLsizeiptr; -#if defined(APIENTRY) && !defined(QOPENGLF_APIENTRY) -# define QOPENGLF_APIENTRY APIENTRY +#if defined(QT_APIENTRY) && !defined(QOPENGLF_APIENTRY) +# define QOPENGLF_APIENTRY QT_APIENTRY #endif # ifndef QOPENGLF_APIENTRYP @@ -308,6 +281,15 @@ typedef ptrdiff_t qopengl_GLsizeiptr; QT_END_NAMESPACE +#ifdef Q_UNDEF_WINGDIAPI +# undef WINGDIAPI +# undef Q_UNDEF_WINGDIAPI +#endif +#ifdef Q_UNDEF_APIENTRY +# undef APIENTRY +# undef Q_UNDEF_APIENTRY +#endif + #endif // QT_NO_OPENGL #endif // QOPENGL_H diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h index 07fd159ba8..a3b2be7b49 100644 --- a/src/gui/opengl/qopengl_p.h +++ b/src/gui/opengl/qopengl_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENGL_P_H #define QOPENGL_P_H diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h index 0d58b5f301..a6c4a68c6c 100644 --- a/src/gui/opengl/qopenglextensions_p.h +++ b/src/gui/opengl/qopenglextensions_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENGL_EXTENSIONS_P_H #define QOPENGL_EXTENSIONS_P_H @@ -93,6 +57,11 @@ public: Sized16Formats = 0x00800000, TextureSwizzle = 0x01000000, StandardDerivatives = 0x02000000, + ASTCTextureCompression = 0x04000000, + ETC2TextureCompression = 0x08000000, + HalfFloatVertex = 0x10000000, + MultiView = 0x20000000, + MultiViewExtended = 0x40000000 }; Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension) @@ -101,9 +70,9 @@ public: GLvoid *glMapBuffer(GLenum target, GLenum access); void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data); - void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); void flushShared(); + void discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments); QOpenGLExtensionsPrivate *d() const; @@ -148,14 +117,6 @@ inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, qopengl_GLintpt Q_OPENGL_FUNCTIONS_DEBUG } - -inline void QOpenGLExtensions::glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments) -{ - Q_D(QOpenGLExtensions); - Q_ASSERT(QOpenGLExtensions::isInitialized(d)); - d->DiscardFramebuffer(target,numAttachments, attachments); - Q_OPENGL_FUNCTIONS_DEBUG -} QT_END_NAMESPACE #endif // QOPENGL_EXTENSIONS_P_H diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h index 4b02b1a60d..e2608e9946 100644 --- a/src/gui/opengl/qopenglextrafunctions.h +++ b/src/gui/opengl/qopenglextrafunctions.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENGLEXTRAFUNCTIONS_H #define QOPENGLEXTRAFUNCTIONS_H diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 7c17d3798b..c9352fbc31 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qopenglfunctions.h" #include "qopenglextrafunctions.h" @@ -57,6 +21,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1 #define QT_OPENGL_FUNCTION_NAMES(ret, name, args) \ "gl"#name"\0" @@ -364,6 +330,8 @@ static int qt_gl_resolve_extensions() extensions |= QOpenGLExtensions::ETC1TextureCompression; if (extensionMatcher.match("GL_IMG_texture_compression_pvrtc")) extensions |= QOpenGLExtensions::PVRTCTextureCompression; + if (extensionMatcher.match("GL_KHR_texture_compression_astc_ldr")) + extensions |= QOpenGLExtensions::ASTCTextureCompression; if (extensionMatcher.match("GL_ARB_texture_mirrored_repeat")) extensions |= QOpenGLExtensions::MirroredRepeat; if (extensionMatcher.match("GL_EXT_stencil_two_side")) @@ -378,6 +346,12 @@ static int qt_gl_resolve_extensions() extensions |= QOpenGLExtensions::TextureSwizzle; if (extensionMatcher.match("GL_OES_standard_derivatives")) extensions |= QOpenGLExtensions::StandardDerivatives; + if (extensionMatcher.match("GL_ARB_half_float_vertex")) + extensions |= QOpenGLExtensions::HalfFloatVertex; + if (extensionMatcher.match("GL_OVR_multiview")) + extensions |= QOpenGLExtensions::MultiView; + if (extensionMatcher.match("GL_OVR_multiview2")) + extensions |= QOpenGLExtensions::MultiViewExtended; if (ctx->isOpenGLES()) { if (format.majorVersion() >= 2) @@ -391,7 +365,10 @@ static int qt_gl_resolve_extensions() | QOpenGLExtensions::FramebufferBlit | QOpenGLExtensions::FramebufferMultisample | QOpenGLExtensions::Sized8Formats - | QOpenGLExtensions::StandardDerivatives; + | QOpenGLExtensions::DiscardFramebuffer + | QOpenGLExtensions::StandardDerivatives + | QOpenGLExtensions::ETC2TextureCompression + | QOpenGLExtensions::HalfFloatVertex; #ifndef Q_OS_WASM // WebGL 2.0 specification explicitly does not support texture swizzles // https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.19 @@ -413,6 +390,8 @@ static int qt_gl_resolve_extensions() extensions |= QOpenGLExtensions::FramebufferMultisample; if (extensionMatcher.match("GL_OES_rgb8_rgba8")) extensions |= QOpenGLExtensions::Sized8Formats; + if (extensionMatcher.match("GL_OES_compressed_ETC2_RGB8_texture")) + extensions |= QOpenGLExtensions::ETC2TextureCompression; } if (extensionMatcher.match("GL_OES_mapbuffer")) @@ -422,13 +401,13 @@ static int qt_gl_resolve_extensions() // We don't match GL_APPLE_texture_format_BGRA8888 here because it has different semantics. if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888")) extensions |= QOpenGLExtensions::BGRATextureFormat; -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) +#ifdef Q_OS_ANDROID QString *deviceName = static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName")); static bool wrongfullyReportsBgra8888Support = deviceName != 0 - && (deviceName->compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0 - || deviceName->compare(QLatin1String("samsung SM-T210"), Qt::CaseInsensitive) == 0 - || deviceName->compare(QLatin1String("samsung SM-T215"), Qt::CaseInsensitive) == 0); + && (deviceName->compare("samsung SM-T211"_L1, Qt::CaseInsensitive) == 0 + || deviceName->compare("samsung SM-T210"_L1, Qt::CaseInsensitive) == 0 + || deviceName->compare("samsung SM-T215"_L1, Qt::CaseInsensitive) == 0); if (wrongfullyReportsBgra8888Support) extensions &= ~QOpenGLExtensions::BGRATextureFormat; #endif @@ -472,6 +451,9 @@ static int qt_gl_resolve_extensions() if (format.version() >= qMakePair(3, 3)) extensions |= QOpenGLExtensions::TextureSwizzle; + if (format.version() >= qMakePair(4, 3) || extensionMatcher.match("GL_ARB_invalidate_subdata")) + extensions |= QOpenGLExtensions::DiscardFramebuffer; + if (extensionMatcher.match("GL_ARB_map_buffer_range")) extensions |= QOpenGLExtensions::MapBufferRange; @@ -481,6 +463,9 @@ static int qt_gl_resolve_extensions() if (srgbCapableFramebuffers) extensions |= QOpenGLExtensions::SRGBFrameBuffer; } + + if (extensionMatcher.match("GL_ARB_ES3_compatibility")) + extensions |= QOpenGLExtensions::ETC2TextureCompression; } return extensions; @@ -563,13 +548,6 @@ bool QOpenGLExtensions::hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension ex } /*! - \fn void QOpenGLFunctions::initializeGLFunctions() - \obsolete - - Use initializeOpenGLFunctions() instead. -*/ - -/*! Initializes OpenGL function resolution for the current context. After calling this function, the QOpenGLFunctions object can only be @@ -587,7 +565,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBindTexture(\a target, \a texture). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindTexture.xhtml}{glBindTexture()}. \since 5.3 @@ -598,7 +576,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBlendFunc(\a sfactor, \a dfactor). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFunc.xhtml}{glBlendFunc()}. \since 5.3 @@ -609,7 +587,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glClear(\a mask). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClear.xhtml}{glClear()}. \since 5.3 @@ -620,7 +598,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glClearColor(\a red, \a green, \a blue, \a alpha). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClearColor.xhtml}{glClearColor()}. \since 5.3 @@ -631,7 +609,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glClearStencil(\a s). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClearStencil.xhtml}{glClearStencil()}. \since 5.3 @@ -642,7 +620,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glColorMask(\a red, \a green, \a blue, \a alpha). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glColorMask.xhtml}{glColorMask()}. \since 5.3 @@ -653,7 +631,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCopyTexImage2D(\a target, \a level, \a internalformat, \a x, \a y, \a width, \a height, \a border). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCopyTexImage2D.xhtml}{glCopyTexImage2D()}. \since 5.3 @@ -664,7 +642,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCopyTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a x, \a y, \a width, \a height). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCopyTexSubImage2D.xhtml}{glCopyTexSubImage2D()}. \since 5.3 @@ -675,7 +653,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCullFace(\a mode). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCullFace.xhtml}{glCullFace()}. \since 5.3 @@ -686,7 +664,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDeleteTextures(\a n, \a textures). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteTextures.xhtml}{glDeleteTextures()}. \since 5.3 @@ -697,7 +675,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDepthFunc(\a func). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDepthFunc.xhtml}{glDepthFunc()}. \since 5.3 @@ -708,7 +686,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDepthMask(\a flag). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDepthMask.xhtml}{glDepthMask()}. \since 5.3 @@ -719,8 +697,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDisable(\a cap). - For more information, see the OpenGL ES 2.0 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDisable.xhtml}{glDisable()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnable.xhtml}{glDisable()}. \since 5.3 */ @@ -730,7 +708,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDrawArrays(\a mode, \a first, \a count). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawArrays.xhtml}{glDrawArrays()}. \since 5.3 @@ -741,7 +719,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDrawElements(\a mode, \a count, \a type, \a indices). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElements.xhtml}{glDrawElements()}. \since 5.3 @@ -752,7 +730,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glEnable(\a cap). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnable.xhtml}{glEnable()}. \since 5.3 @@ -763,7 +741,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glFinish(). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFinish.xhtml}{glFinish()}. \since 5.3 @@ -774,7 +752,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glFlush(). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFlush.xhtml}{glFlush()}. \since 5.3 @@ -785,7 +763,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glFrontFace(\a mode). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFrontFace.xhtml}{glFrontFace()}. \since 5.3 @@ -796,7 +774,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGenTextures(\a n, \a textures). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenTextures.xhtml}{glGenTextures()}. \since 5.3 @@ -807,7 +785,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetBooleanv(\a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGet.xhtml}{glGetBooleanv()}. \since 5.3 @@ -818,7 +796,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetError(). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetError.xhtml}{glGetError()}. \since 5.3 @@ -829,7 +807,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetFloatv(\a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGet.xhtml}{glGetFloatv()}. \since 5.3 @@ -840,7 +818,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetIntegerv(\a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGet.xhtml}{glGetIntegerv()}. \since 5.3 @@ -851,7 +829,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetString(\a name). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetString.xhtml}{glGetString()}. \since 5.3 @@ -862,7 +840,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetTexParameterfv(\a target, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameterfv()}. \since 5.3 @@ -873,7 +851,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetTexParameteriv(\a target, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameteriv()}. \since 5.3 @@ -884,7 +862,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glHint(\a target, \a mode). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glHint.xhtml}{glHint()}. \since 5.3 @@ -895,7 +873,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsEnabled(\a cap). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsEnabled.xhtml}{glIsEnabled()}. \since 5.3 @@ -906,7 +884,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsTexture(\a texture). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsTexture.xhtml}{glIsTexture()}. \since 5.3 @@ -917,7 +895,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glLineWidth(\a width). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glLineWidth.xhtml}{glLineWidth()}. \since 5.3 @@ -928,7 +906,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glPixelStorei(\a pname, \a param). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPixelStorei.xhtml}{glPixelStorei()}. \since 5.3 @@ -939,7 +917,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glPolygonOffset(\a factor, \a units). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPolygonOffset.xhtml}{glPolygonOffset()}. \since 5.3 @@ -950,7 +928,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glReadPixels(\a x, \a y, \a width, \a height, \a format, \a type, \a pixels). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glReadPixels.xhtml}{glReadPixels()}. \since 5.3 @@ -961,7 +939,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glScissor(\a x, \a y, \a width, \a height). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glScissor.xhtml}{glScissor()}. \since 5.3 @@ -972,7 +950,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glStencilFunc(\a func, \a ref, \a mask). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilFunc.xhtml}{glStencilFunc()}. \since 5.3 @@ -983,7 +961,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glStencilMask(\a mask). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilMask.xhtml}{glStencilMask()}. \since 5.3 @@ -994,7 +972,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glStencilOp(\a fail, \a zfail, \a zpass). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilOp.xhtml}{glStencilOp()}. \since 5.3 @@ -1005,7 +983,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a format, \a type, \a pixels). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexImage2D.xhtml}{glTexImage2D()}. \since 5.3 @@ -1016,7 +994,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glTexParameterf(\a target, \a pname, \a param). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterf()}. \since 5.3 @@ -1027,7 +1005,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glTexParameterfv(\a target, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterfv()}. \since 5.3 @@ -1038,7 +1016,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glTexParameteri(\a target, \a pname, \a param). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameteri()}. \since 5.3 @@ -1049,7 +1027,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glTexParameteriv(\a target, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameteriv()}. \since 5.3 @@ -1060,7 +1038,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a type, \a pixels). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexSubImage2D.xhtml}{glTexSubImage2D()}. \since 5.3 @@ -1071,7 +1049,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glViewport(\a x, \a y, \a width, \a height). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glViewport.xhtml}{glViewport()}. \since 5.3 @@ -1082,7 +1060,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glActiveTexture(\a texture). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glActiveTexture.xhtml}{glActiveTexture()}. */ @@ -1091,7 +1069,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glAttachShader(\a program, \a shader). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glAttachShader.xhtml}{glAttachShader()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1102,7 +1080,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBindAttribLocation(\a program, \a index, \a name). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindAttribLocation.xhtml}{glBindAttribLocation()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1113,7 +1091,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBindBuffer(\a target, \a buffer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindBuffer.xhtml}{glBindBuffer()}. */ @@ -1125,7 +1103,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Note that Qt will translate a \a framebuffer argument of 0 to the currently bound QOpenGLContext's defaultFramebufferObject(). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindFramebuffer.xhtml}{glBindFramebuffer()}. */ @@ -1134,7 +1112,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindRenderbuffer.xhtml}{glBindRenderbuffer()}. */ @@ -1143,7 +1121,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendColor.xhtml}{glBlendColor()}. */ @@ -1152,7 +1130,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBlendEquation(\a mode). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquation.xhtml}{glBlendEquation()}. */ @@ -1161,7 +1139,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquationSeparate.xhtml}{glBlendEquationSeparate()}. */ @@ -1170,7 +1148,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFuncSeparate.xhtml}{glBlendFuncSeparate()}. */ @@ -1179,7 +1157,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBufferData.xhtml}{glBufferData()}. */ @@ -1188,7 +1166,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBufferSubData.xhtml}{glBufferSubData()}. */ @@ -1197,7 +1175,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCheckFramebufferStatus(\a target). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCheckFramebufferStatus.xhtml}{glCheckFramebufferStatus()}. */ @@ -1208,7 +1186,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() desktop OpenGL systems and glClearDepthf(\a depth) on embedded OpenGL ES systems. - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClearDepthf.xhtml}{glClearDepthf()}. */ @@ -1217,7 +1195,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCompileShader(\a shader). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCompileShader.xhtml}{glCompileShader()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1228,7 +1206,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCompressedTexImage2D.xhtml}{glCompressedTexImage2D()}. */ @@ -1237,7 +1215,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCompressedTexSubImage2D.xhtml}{glCompressedTexSubImage2D()}. */ @@ -1246,7 +1224,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCreateProgram(). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateProgram.xhtml}{glCreateProgram()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1257,7 +1235,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glCreateShader(\a type). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateShader.xhtml}{glCreateShader()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1268,7 +1246,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDeleteBuffers(\a n, \a buffers). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteBuffers.xhtml}{glDeleteBuffers()}. */ @@ -1277,7 +1255,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteFramebuffers.xhtml}{glDeleteFramebuffers()}. */ @@ -1286,7 +1264,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDeleteProgram(\a program). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteProgram.xhtml}{glDeleteProgram()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1297,7 +1275,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteRenderbuffers.xhtml}{glDeleteRenderbuffers()}. */ @@ -1306,7 +1284,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDeleteShader(\a shader). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteShader.xhtml}{glDeleteShader()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1319,7 +1297,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on embedded OpenGL ES systems. - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDepthRangef.xhtml}{glDepthRangef()}. */ @@ -1328,7 +1306,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDetachShader(\a program, \a shader). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDetachShader.xhtml}{glDetachShader()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1339,8 +1317,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glDisableVertexAttribArray(\a index). - For more information, see the OpenGL ES 2.0 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es2.0/html/glDisableVertexAttribArray.xhtml}{glDisableVertexAttribArray()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnableVertexAttribArray.xhtml}{glDisableVertexAttribArray()}. This convenience function will do nothing on OpenGL ES 1.x systems. */ @@ -1350,7 +1328,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glEnableVertexAttribArray(\a index). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnableVertexAttribArray.xhtml}{glEnableVertexAttribArray()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1361,7 +1339,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFramebufferRenderbuffer.xhtml}{glFramebufferRenderbuffer()}. */ @@ -1370,7 +1348,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFramebufferTexture2D.xhtml}{glFramebufferTexture2D()}. */ @@ -1379,7 +1357,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGenBuffers(\a n, \a buffers). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenBuffers.xhtml}{glGenBuffers()}. */ @@ -1388,7 +1366,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGenerateMipmap(\a target). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenerateMipmap.xhtml}{glGenerateMipmap()}. */ @@ -1397,7 +1375,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGenFramebuffers(\a n, \a framebuffers). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenFramebuffers.xhtml}{glGenFramebuffers()}. */ @@ -1406,7 +1384,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenRenderbuffers.xhtml}{glGenRenderbuffers()}. */ @@ -1415,7 +1393,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetActiveAttrib.xhtml}{glGetActiveAttrib()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1426,7 +1404,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetActiveUniform.xhtml}{glGetActiveUniform()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1437,7 +1415,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetAttachedShaders.xhtml}{glGetAttachedShaders()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1448,7 +1426,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetAttribLocation(\a program, \a name). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetAttribLocation.xhtml}{glGetAttribLocation()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1459,8 +1437,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetBufferParameteriv.xhtml}{glGetBufferParameteriv()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetBufferParameter.xhtml}{glGetBufferParameteriv()}. */ /*! @@ -1468,7 +1446,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetFramebufferAttachmentParameteriv.xhtml}{glGetFramebufferAttachmentParameteriv()}. */ @@ -1477,7 +1455,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetProgramiv(\a program, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetProgramiv.xhtml}{glGetProgramiv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1488,7 +1466,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetProgramInfoLog.xhtml}{glGetProgramInfoLog()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1499,7 +1477,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetRenderbufferParameteriv.xhtml}{glGetRenderbufferParameteriv()}. */ @@ -1508,7 +1486,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderiv.xhtml}{glGetShaderiv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1519,7 +1497,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderInfoLog.xhtml}{glGetShaderInfoLog()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1530,7 +1508,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderPrecisionFormat.xhtml}{glGetShaderPrecisionFormat()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1541,7 +1519,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderSource.xhtml}{glGetShaderSource()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1552,7 +1530,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetUniformfv(\a program, \a location, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetUniformfv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1563,7 +1541,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetUniformiv(\a program, \a location, \a params). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetUniformiv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1574,7 +1552,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetUniformLocation(\a program, \a name). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniformLocation.xhtml}{glGetUniformLocation()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1585,8 +1563,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttribfv.xhtml}{glGetVertexAttribfv()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttrib.xhtml}{glGetVertexAttribfv()}. This convenience function will do nothing on OpenGL ES 1.x systems. */ @@ -1596,8 +1574,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params). - For more information, see the OpenGL ES 2.0 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttribiv.xhtml}{glGetVertexAttribiv()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttrib.xhtml}{glGetVertexAttribiv()}. This convenience function will do nothing on OpenGL ES 1.x systems. */ @@ -1607,7 +1585,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttribPointerv.xhtml}{glGetVertexAttribPointerv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1618,7 +1596,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsBuffer(\a buffer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsBuffer.xhtml}{glIsBuffer()}. */ @@ -1627,7 +1605,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsFramebuffer(\a framebuffer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsFramebuffer.xhtml}{glIsFramebuffer()}. */ @@ -1636,7 +1614,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsProgram(\a program). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsProgram.xhtml}{glIsProgram()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1647,7 +1625,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsRenderbuffer(\a renderbuffer). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsRenderbuffer.xhtml}{glIsRenderbuffer()}. */ @@ -1656,7 +1634,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glIsShader(\a shader). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsShader.xhtml}{glIsShader()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1667,7 +1645,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glLinkProgram(\a program). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glLinkProgram.xhtml}{glLinkProgram()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1678,7 +1656,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glReleaseShaderCompiler(). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glReleaseShaderCompiler.xhtml}{glReleaseShaderCompiler()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1689,7 +1667,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glRenderbufferStorage.xhtml}{glRenderbufferStorage()}. */ @@ -1698,7 +1676,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glSampleCoverage(\a value, \a invert). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glSampleCoverage.xhtml}{glSampleCoverage()}. */ @@ -1707,7 +1685,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glShaderBinary.xhtml}{glShaderBinary()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1718,7 +1696,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glShaderSource.xhtml}{glShaderSource()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1729,7 +1707,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilFuncSeparate.xhtml}{glStencilFuncSeparate()}. */ @@ -1738,7 +1716,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glStencilMaskSeparate(\a face, \a mask). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilMaskSeparate.xhtml}{glStencilMaskSeparate()}. */ @@ -1747,7 +1725,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilOpSeparate.xhtml}{glStencilOpSeparate()}. */ @@ -1756,7 +1734,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform1f(\a location, \a x). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1767,7 +1745,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform1fv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1778,7 +1756,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform1i(\a location, \a x). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1i()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1789,7 +1767,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform1iv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1iv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1800,7 +1778,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform2f(\a location, \a x, \a y). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1811,7 +1789,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform2fv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1822,7 +1800,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform2i(\a location, \a x, \a y). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2i()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1833,7 +1811,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform2iv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2iv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1844,7 +1822,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1855,7 +1833,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform3fv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1866,7 +1844,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3i()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1877,7 +1855,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform3iv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3iv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1888,7 +1866,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1899,7 +1877,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform4fv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1910,7 +1888,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4i()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1921,7 +1899,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniform4iv(\a location, \a count, \a v). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4iv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1932,7 +1910,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniformMatrix2fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1943,7 +1921,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniformMatrix3fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1954,7 +1932,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniformMatrix4fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1965,7 +1943,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glUseProgram(\a program). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUseProgram.xhtml}{glUseProgram()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1976,7 +1954,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glValidateProgram(\a program). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glValidateProgram.xhtml}{glValidateProgram()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1987,7 +1965,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib1f(\a indx, \a x). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib1f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -1998,7 +1976,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib1fv(\a indx, \a values). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib1fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2009,7 +1987,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib2f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2020,7 +1998,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib2fv(\a indx, \a values). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib2fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2031,7 +2009,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib3f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2042,7 +2020,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib3fv(\a indx, \a values). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib3fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2053,7 +2031,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib4f()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2064,7 +2042,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttrib4fv(\a indx, \a values). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib4fv()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2075,7 +2053,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions() Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr). - For more information, see the OpenGL ES 2.0 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttribPointer.xhtml}{glVertexAttribPointer()}. This convenience function will do nothing on OpenGL ES 1.x systems. @@ -2570,7 +2548,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) function either in core or as an extension. For more information, see the OpenGL ES 3.x documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEndQuery.xhtml}{glEndQuery()}. + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBeginQuery.xhtml}{glEndQuery()}. */ /*! @@ -2583,7 +2561,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) function either in core or as an extension. For more information, see the OpenGL ES 3.x documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEndTransformFeedback.xhtml}{glEndTransformFeedback()}. + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBeginTransformFeedback.xhtml}{glEndTransformFeedback()}. */ /*! @@ -3480,7 +3458,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) function either in core or as an extension. For more information, see the OpenGL ES 3.x documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUnmapBuffer.xhtml}{glUnmapBuffer()}. + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glMapBufferRange.xhtml}{glUnmapBuffer()}. */ /*! @@ -3636,7 +3614,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) function either in core or as an extension. For more information, see the OpenGL ES 3.x documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateShaderProgramv.xhtml}{glCreateShaderProgramv()}. + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateShaderProgram.xhtml}{glCreateShaderProgramv()}. */ /*! @@ -4442,7 +4420,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) function either in core or as an extension. For more information, see the OpenGL ES 3.x documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttribIFormat.xhtml}{glVertexAttribIFormat()}. + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttribFormat.xhtml}{glVertexAttribIFormat()}. */ /*! @@ -4467,7 +4445,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendBarrier.xhtml}{glBlendBarrier()}. */ @@ -4480,7 +4458,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquationSeparate.xhtml}{glBlendEquationSeparatei()}. */ @@ -4493,8 +4471,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquationi.xhtml}{glBlendEquationi()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquation.xhtml}{glBlendEquationi()}. */ /*! @@ -4506,7 +4484,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFuncSeparate.xhtml}{glBlendFuncSeparatei()}. */ @@ -4519,8 +4497,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFunci.xhtml}{glBlendFunci()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFunc.xhtml}{glBlendFunci()}. */ /*! @@ -4532,7 +4510,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glColorMask.xhtml}{glColorMaski()}. */ @@ -4545,7 +4523,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCopyImageSubData.xhtml}{glCopyImageSubData()}. */ @@ -4558,7 +4536,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDebugMessageCallback.xhtml}{glDebugMessageCallback()}. */ @@ -4571,7 +4549,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDebugMessageControl.xhtml}{glDebugMessageContro()}. */ @@ -4584,7 +4562,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDebugMessageInsert.xhtml}{glDebugMessageInsert()}. */ @@ -4597,7 +4575,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glEnable.xhtml}{glDisablei()}. */ @@ -4610,7 +4588,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsBaseVertex.xhtml}{glDrawElementsBaseVerte()}. */ @@ -4623,7 +4601,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsInstancedBaseVertex.xhtml}{glDrawElementsInstancedBaseVerte()}. */ @@ -4636,7 +4614,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawRangeElementsBaseVertex.xhtml}{glDrawRangeElementsBaseVerte()}. */ @@ -4649,8 +4627,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for - \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnablei.xhtml}{glEnablei()}. + For more information, see the OpenGL ES 3.X documentation for + \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnable.xhtml}{glEnablei()}. */ /*! @@ -4662,7 +4640,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFramebufferTexture.xhtml}{glFramebufferTexture()}. */ @@ -4675,7 +4653,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetDebugMessageLog.xhtml}{glGetDebugMessageLog()}. */ @@ -4688,7 +4666,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetGraphicsResetStatus.xhtml}{glGetGraphicsResetStatus()}. */ @@ -4701,7 +4679,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetObjectLabel.xhtml}{glGetObjectLabe()}. */ @@ -4714,7 +4692,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetObjectPtrLabel.xhtml}{glGetObjectPtrLabe()}. */ @@ -4727,7 +4705,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetPointerv.xhtml}{glGetPointerv()}. */ @@ -4740,7 +4718,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetSamplerParameter.xhtml}{glGetSamplerParameterIiv()}. */ @@ -4753,7 +4731,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetSamplerParameter.xhtml}{glGetSamplerParameterIuiv()}. */ @@ -4766,7 +4744,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameterIiv()}. */ @@ -4779,7 +4757,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameterIuiv()}. */ @@ -4792,7 +4770,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetnUniformfv()}. */ @@ -4805,7 +4783,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetnUniformiv()}. */ @@ -4818,7 +4796,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetnUniformuiv()}. */ @@ -4831,7 +4809,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsEnabled.xhtml}{glIsEnabledi()}. */ @@ -4844,7 +4822,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glMinSampleShading.xhtml}{glMinSampleShading()}. */ @@ -4857,7 +4835,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glObjectLabel.xhtml}{glObjectLabe()}. */ @@ -4870,7 +4848,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glObjectPtrLabel.xhtml}{glObjectPtrLabe()}. */ @@ -4883,7 +4861,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPatchParameteri.xhtml}{glPatchParameteri()}. */ @@ -4896,7 +4874,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPopDebugGroup.xhtml}{glPopDebugGroup()}. */ @@ -4909,7 +4887,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPrimitiveBoundingBox.xhtml}{glPrimitiveBoundingBo()}. */ @@ -4922,7 +4900,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPushDebugGroup.xhtml}{glPushDebugGroup()}. */ @@ -4935,7 +4913,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glReadPixels.xhtml}{glReadnPixels()}. */ @@ -4948,7 +4926,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glSamplerParameter.xhtml}{glSamplerParameterIiv()}. */ @@ -4961,7 +4939,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glSamplerParameter.xhtml}{glSamplerParameterIuiv()}. */ @@ -4974,7 +4952,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexBuffer.xhtml}{glTexBuffer()}. */ @@ -4987,7 +4965,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexBufferRange.xhtml}{glTexBufferRange()}. */ @@ -5000,7 +4978,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterIiv()}. */ @@ -5013,7 +4991,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterIuiv()}. */ @@ -5026,7 +5004,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS) with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension. - For more information, see the OpenGL ES 3.2 documentation for + For more information, see the OpenGL ES 3.X documentation for \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexStorage3DMultisample.xhtml}{glTexStorage3DMultisample()}. */ @@ -5077,7 +5055,23 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx) MapBuffer = RESOLVE(MapBuffer); GetBufferSubData = RESOLVE(GetBufferSubData); DiscardFramebuffer = RESOLVE(DiscardFramebuffer); - } +} + +void QOpenGLExtensions::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments) +{ + Q_D(QOpenGLExtensions); + Q_ASSERT(QOpenGLExtensions::isInitialized(d)); + Q_ASSERT(d->f.InvalidateFramebuffer || d->DiscardFramebuffer); + + // On GLES >= 3 we prefer glInvalidateFramebuffer, even if the + // discard extension is present + if (d->f.InvalidateFramebuffer) + d->f.InvalidateFramebuffer(target, numAttachments, attachments); + else + d->DiscardFramebuffer(target, numAttachments, attachments); + + Q_OPENGL_FUNCTIONS_DEBUG +} void QOpenGLExtensions::flushShared() { diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 66bdac5ca5..05435903fb 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENGLFUNCTIONS_H #define QOPENGLFUNCTIONS_H @@ -68,7 +32,7 @@ typedef double GLdouble; unsigned clamped = qMin(unsigned(error - GL_INVALID_ENUM), 4U); \ const char *errors[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "Unknown" }; \ printf("GL error at %s:%d: %s\n", __FILE__, __LINE__, errors[clamped]); \ - int *value = 0; \ + int *value = nullptr; \ *value = 0; \ } #else @@ -227,7 +191,7 @@ struct QOpenGLFunctionsPrivate; #undef glTexLevelParameteriv -#if defined(Q_CLANG_QDOC) +#if defined(Q_QDOC) #undef GLbitfield typedef unsigned int GLbitfield; #undef GLchar @@ -269,10 +233,6 @@ public: void initializeOpenGLFunctions(); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED void initializeGLFunctions() { initializeOpenGLFunctions(); } -#endif - // GLES2 + OpenGL1 common subset void glBindTexture(GLenum target, GLuint texture); void glBlendFunc(GLenum sfactor, GLenum dfactor); diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 631c3d151b..28b09b553a 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qopenglprogrambinarycache_p.h" #include <QOpenGLContext> @@ -54,6 +18,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(lcOpenGLProgramDiskCache, "qt.opengl.diskcache") #ifndef GL_CONTEXT_LOST @@ -117,22 +83,26 @@ static inline bool qt_ensureWritableDir(const QString &name) QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache() : m_cacheWritable(false) { - const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + QLatin1Char('/'); + const QString subPath = "/qtshadercache-"_L1 + QSysInfo::buildAbi() + u'/'; const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); + m_globalCacheDir = sharedCachePath + subPath; + m_localCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath; + if (!sharedCachePath.isEmpty()) { - m_cacheDir = sharedCachePath + subPath; - m_cacheWritable = qt_ensureWritableDir(m_cacheDir); + m_currentCacheDir = m_globalCacheDir; + m_cacheWritable = qt_ensureWritableDir(m_currentCacheDir); } if (!m_cacheWritable) { - m_cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath; - m_cacheWritable = qt_ensureWritableDir(m_cacheDir); + m_currentCacheDir = m_localCacheDir; + m_cacheWritable = qt_ensureWritableDir(m_currentCacheDir); } - qCDebug(lcOpenGLProgramDiskCache, "Cache location '%s' writable = %d", qPrintable(m_cacheDir), m_cacheWritable); + + qCDebug(lcOpenGLProgramDiskCache, "Cache location '%s' writable = %d", qPrintable(m_currentCacheDir), m_cacheWritable); } QString QOpenGLProgramBinaryCache::cacheFileName(const QByteArray &cacheKey) const { - return m_cacheDir + QString::fromUtf8(cacheKey); + return m_currentCacheDir + QString::fromUtf8(cacheKey); } #define BASE_HEADER_SIZE (int(4 * sizeof(quint32))) @@ -361,6 +331,25 @@ static inline void writeStr(uchar **p, const QByteArray &str) *p += str.size(); } +static inline bool writeFile(const QString &filename, const QByteArray &data) +{ +#if QT_CONFIG(temporaryfile) + QSaveFile f(filename); + if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + f.write(data); + if (f.commit()) + return true; + } +#else + QFile f(filename); + if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + if (f.write(data) == data.length()) + return true; + } +#endif + return false; +} + void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) { if (!m_cacheWritable) @@ -427,20 +416,20 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) writeUInt(&blobFormatPtr, blobFormat); -#if QT_CONFIG(temporaryfile) - QSaveFile f(cacheFileName(cacheKey)); - if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - f.write(blob); - if (!f.commit()) -#else - QFile f(cacheFileName(cacheKey)); - if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - if (f.write(blob) < blob.length()) -#endif - qCDebug(lcOpenGLProgramDiskCache, "Failed to write %s to shader cache", qPrintable(f.fileName())); - } else { - qCDebug(lcOpenGLProgramDiskCache, "Failed to create %s in shader cache", qPrintable(f.fileName())); + QString filename = cacheFileName(cacheKey); + bool ok = writeFile(filename, blob); + if (!ok && m_currentCacheDir == m_globalCacheDir) { + m_currentCacheDir = m_localCacheDir; + m_cacheWritable = qt_ensureWritableDir(m_currentCacheDir); + qCDebug(lcOpenGLProgramDiskCache, "Cache location changed to '%s' writable = %d", + qPrintable(m_currentCacheDir), m_cacheWritable); + if (m_cacheWritable) { + filename = cacheFileName(cacheKey); + ok = writeFile(filename, blob); + } } + if (!ok) + qCDebug(lcOpenGLProgramDiskCache, "Failed to write %s to shader cache", qPrintable(filename)); } #if QT_CONFIG(opengles2) diff --git a/src/gui/opengl/qopenglprogrambinarycache_p.h b/src/gui/opengl/qopenglprogrambinarycache_p.h index d8fdf1d8c5..c3850bdee3 100644 --- a/src/gui/opengl/qopenglprogrambinarycache_p.h +++ b/src/gui/opengl/qopenglprogrambinarycache_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENGLPROGRAMBINARYCACHE_P_H #define QOPENGLPROGRAMBINARYCACHE_P_H @@ -56,7 +20,7 @@ #include <QtCore/qmutex.h> #include <QtCore/QLoggingCategory> #include <QtGui/private/qopenglcontext_p.h> -#include <QtGui/private/qshader_p.h> +#include <rhi/qshader.h> QT_BEGIN_NAMESPACE @@ -64,7 +28,7 @@ QT_BEGIN_NAMESPACE // therefore stay independent from QOpenGLShader(Program). Must rely only on // QOpenGLContext/Functions. -Q_GUI_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache) +Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcOpenGLProgramDiskCache, Q_GUI_EXPORT) class Q_GUI_EXPORT QOpenGLProgramBinaryCache { @@ -92,7 +56,9 @@ private: bool verifyHeader(const QByteArray &buf) const; bool setProgramBinary(uint programId, uint blobFormat, const void *p, uint blobSize); - QString m_cacheDir; + QString m_globalCacheDir; + QString m_localCacheDir; + QString m_currentCacheDir; bool m_cacheWritable; struct MemCacheEntry { MemCacheEntry(const void *p, int size, uint format) diff --git a/src/gui/opengl/qt_attribution.json b/src/gui/opengl/qt_attribution.json index d3ff10d803..44310980e2 100644 --- a/src/gui/opengl/qt_attribution.json +++ b/src/gui/opengl/qt_attribution.json @@ -5,7 +5,7 @@ "QDocModule": "qtgui", "Description": "OpenGL header generated from the Khronos OpenGL / OpenGL ES XML API Registry.", "QtUsage": "Used on Windows and Linux in the OpenGL related headers of Qt GUI.", - "Path": "qopenglext.h", + "Files": "qopenglext.h", "Homepage": "https://www.khronos.org/", "Version": "Revision 27684", @@ -20,7 +20,7 @@ "QDocModule": "qtgui", "Description": "OpenGL ES 2 header generated from the Khronos OpenGL / OpenGL ES XML API Registry.", "QtUsage": "Used on Windows and Linux in the OpenGL related headers of Qt GUI.", - "Path": "qopengles2ext.h", + "Files": "qopengles2ext.h", "Homepage": "https://www.khronos.org/", "Version": "Revision 27673", |