From 78dccc998f51fad51caa6dc220fbfdf14ed5c113 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 23 Sep 2014 16:47:17 +0200 Subject: [PATCH] WMF: fix video rendering with ANGLE. The format of the offscreen surface used for video rendering should be compatible with the EGL config. Change-Id: Ic016245ce80c2483771e620c3eed345262d03c44 Reviewed-by: Laszlo Agocs --- src/plugins/wmf/evrd3dpresentengine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/wmf/evrd3dpresentengine.cpp b/src/plugins/wmf/evrd3dpresentengine.cpp index bc27a7e0..2aa9d0d6 100644 --- a/src/plugins/wmf/evrd3dpresentengine.cpp +++ b/src/plugins/wmf/evrd3dpresentengine.cpp @@ -419,18 +419,19 @@ void D3DPresentEngine::createOffscreenTexture() QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); m_eglDisplay = static_cast( nativeInterface->nativeResourceForContext("eglDisplay", currentContext)); - m_eglConfig = static_cast( + m_eglConfig = static_cast( nativeInterface->nativeResourceForContext("eglConfig", currentContext)); currentContext->functions()->glGenTextures(1, &m_glTexture); int w = m_surfaceFormat.frameWidth(); int h = m_surfaceFormat.frameHeight(); + bool hasAlpha = currentContext->format().hasAlpha(); EGLint attribs[] = { EGL_WIDTH, w, EGL_HEIGHT, h, - EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB, + EGL_TEXTURE_FORMAT, hasAlpha ? EGL_TEXTURE_RGBA : EGL_TEXTURE_RGB, EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, EGL_NONE }; @@ -449,7 +450,7 @@ void D3DPresentEngine::createOffscreenTexture() m_device->CreateTexture(w, h, 1, D3DUSAGE_RENDERTARGET, - D3DFMT_X8R8G8B8, + hasAlpha ? D3DFMT_A8R8G8B8 : D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &m_texture, &share_handle);