summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@intopalo.com>2015-10-26 00:08:01 +0200
committerMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2015-10-30 21:49:54 +0000
commit5814cd9d27362db2b5cf06f3ddde3e8eafc5bcc8 (patch)
tree061a131d7626afe1a423868f3653169048c33eb6
parentd946507727b363326d05f48da93c2af04bdda76d (diff)
winrt: initialize EGL display with automatic Trim and WARP
The minimum feature level is now detected before requesting a display. If it is less than 9_3, use the WARP device instead. Task-Id: QTBUG-44495 Task-Id: QTBUG-44694 Change-Id: I9f81f4f92269fab73c291f7373aa07236c7e5f98 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
-rw-r--r--src/plugins/platforms/winrt/qwinrteglcontext.cpp17
-rw-r--r--src/plugins/platforms/winrt/winrt.pro2
2 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp
index 9cb45336d6..b902a02483 100644
--- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp
@@ -40,6 +40,8 @@
#include <functional>
+#include <d3d11.h>
+
#include <EGL/egl.h>
#define EGL_EGLEXT_PROTOTYPES
#include <EGL/eglext.h>
@@ -79,8 +81,21 @@ void QWinRTEGLContext::initialize()
{
Q_D(QWinRTEGLContext);
+ // Test if the hardware supports at least level 9_3
+ D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_9_3 }; // minimum feature level
+ HRESULT hr = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, featureLevels, 1,
+ D3D11_SDK_VERSION, nullptr, nullptr, nullptr);
+ EGLint deviceType = SUCCEEDED(hr) ? EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE
+ : EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE;
+
eglBindAPI(EGL_OPENGL_ES_API);
- d->eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ const EGLint displayAttributes[] = {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, deviceType,
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, true,
+ EGL_NONE,
+ };
+ d->eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes);
if (d->eglDisplay == EGL_NO_DISPLAY)
qCritical("Failed to initialize EGL display: 0x%x", eglGetError());
diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro
index 2718ea62bb..be6aad02d1 100644
--- a/src/plugins/platforms/winrt/winrt.pro
+++ b/src/plugins/platforms/winrt/winrt.pro
@@ -10,7 +10,7 @@ QT += core-private gui-private platformsupport-private
DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__ GL_GLEXT_PROTOTYPES
-LIBS += $$QMAKE_LIBS_CORE -ldwrite
+LIBS += $$QMAKE_LIBS_CORE -ldwrite -ld3d11
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/freetype/include
SOURCES = \