List and allow to query EGL extensions on Windows.
This commit is contained in:
parent
27fd82a365
commit
e68f76e6ab
2 changed files with 31 additions and 0 deletions
|
|
@ -17,6 +17,12 @@
|
||||||
#include <QtGui/QOpenGLFunctions>
|
#include <QtGui/QOpenGLFunctions>
|
||||||
#include <QtWidgets/QOpenGLWidget>
|
#include <QtWidgets/QOpenGLWidget>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <QtGui/QGuiApplication>
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
#define LOG_ONCE(x) [[maybe_unused]] static auto logged = [&] { LOG(x); return true; }();
|
#define LOG_ONCE(x) [[maybe_unused]] static auto logged = [&] { LOG(x); return true; }();
|
||||||
|
|
||||||
namespace Ui::GL {
|
namespace Ui::GL {
|
||||||
|
|
@ -142,6 +148,15 @@ Capabilities CheckCapabilities(QWidget *widget) {
|
||||||
list.append(QString::fromLatin1(extension));
|
list.append(QString::fromLatin1(extension));
|
||||||
}
|
}
|
||||||
LOG(("OpenGL Extensions: %1").arg(list.join(", ")));
|
LOG(("OpenGL Extensions: %1").arg(list.join(", ")));
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
auto egllist = QStringList();
|
||||||
|
for (const auto &extension : EGLExtensions(context)) {
|
||||||
|
egllist.append(QString::fromLatin1(extension));
|
||||||
|
}
|
||||||
|
LOG(("EGL Extensions: %1").arg(egllist.join(", ")));
|
||||||
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
|
@ -225,6 +240,19 @@ ANGLE CurrentANGLE() {
|
||||||
return ResolvedANGLE;
|
return ResolvedANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QByteArray> EGLExtensions(not_null<QOpenGLContext*> context) {
|
||||||
|
const auto native = QGuiApplication::platformNativeInterface();
|
||||||
|
Assert(native != nullptr);
|
||||||
|
|
||||||
|
const auto display = static_cast<EGLDisplay>(
|
||||||
|
native->nativeResourceForContext(
|
||||||
|
QByteArrayLiteral("egldisplay"),
|
||||||
|
context));
|
||||||
|
return display
|
||||||
|
? QByteArray(eglQueryString(display, EGL_EXTENSIONS)).split(' ')
|
||||||
|
: QList<QByteArray>();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
} // namespace Ui::GL
|
} // namespace Ui::GL
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,7 @@ void ConfigureANGLE(); // Requires Ui::Integration being set.
|
||||||
void ChangeANGLE(ANGLE backend);
|
void ChangeANGLE(ANGLE backend);
|
||||||
[[nodiscard]] ANGLE CurrentANGLE();
|
[[nodiscard]] ANGLE CurrentANGLE();
|
||||||
|
|
||||||
|
[[nodiscard]] QList<QByteArray> EGLExtensions(
|
||||||
|
not_null<QOpenGLContext*> context);
|
||||||
|
|
||||||
} // namespace Ui::GL
|
} // namespace Ui::GL
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue