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>
This commit is contained in:
parent
d946507727
commit
5814cd9d27
@ -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());
|
||||
|
||||
|
@ -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 = \
|
||||
|
Loading…
Reference in New Issue
Block a user