[Interest] Qt/ANGLE .NET integration stopped working between Qt 5.3 and 5.4

Eirik Ulvik eirik.ulvik at gmail.com
Mon Sep 7 22:06:58 CEST 2015


We have an integration between Qt/OpenGL using QML and .NET/WPF that worked
fine in Qt 5.3.
The integration is based on a question asked on this mailing list before:
http://lists.qt-project.org/pipermail/interest/2014-January/010827.html and
depends the fact that Qt uses ANGLE as the backend renderer.

In order to show a OpenGL based rendering from Qt/C++ code in a .NET based
WPF application we need to get the DirectX buffer pointer. It is a
requirement that the backend rendering system is DirectX 9. I have managed
to force Qt to use ANGLE with a DirectX 9 backend. The output from the QML
scene graph and qt.qpa.gl logger:

  Qt: Untested Windows version 10.0 detected!
  QML debugging is enabled. Only use this in a safe environment.
  qt.scenegraph.info: windows render loop
  qt.scenegraph.info: Using sg animation driver
  qt.scenegraph.info: Animation Driver: using vsync: 16.67 ms
  qt.qpa.gl: Qt: Using EGL from libEGLd.dll
  qt.qpa.gl: Qt: Using OpenGL ES 2.0 from libGLESv2d.dll
  qt.qpa.gl: QWindowsEGLStaticContext::create Created EGL display
0x4add0f0180 v 1 . 4
  qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext
QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24,
redBufferSize -1, greenBufferSize-1, blueBufferSize -1, alphaBufferSize -1,
stencilBufferSize 8, samples -1, swap Behavior 2, swapInterval 1, profile
 0)
  qt.scenegraph.info: texture atlas dimensions: 512x512
  qt.scenegraph.info: R/G/B/A Buffers:    8 8 8 8
  qt.scenegraph.info: Depth Buffer:       24
  qt.scenegraph.info: Stencil Buffer:     8
  qt.scenegraph.info: Samples:            0
  qt.scenegraph.info: GL_VENDOR:          Google Inc.
  qt.scenegraph.info: GL_RENDERER:        ANGLE (AMD Radeon HD 6670
Direct3D9Ex vs_3_0 ps_3_0)
  qt.scenegraph.info: GL_VERSION:         OpenGL ES 2.0 (ANGLE
2.1.30d6c255d238)
  qt.scenegraph.info: GL_EXTENSIONS:      GL_ANGLE_texture_compression_dxt3
GL_ANG
  LE_translated_shader_source GL_OES_packed_depth_stencil
GL_ANGLE_pack_reverse_ro
  w_order GL_EXT_frag_depth GL_EXT_occlusion_query_boolean
GL_EXT_robustness GL_AN
  GLE_framebuffer_multisample GL_OES_rgb8_rgba8 GL_OES_standard_derivatives
GL_EXT
  _shader_texture_lod GL_EXT_texture_format_BGRA8888 GL_ANGLE_depth_texture
GL_OES
  _texture_float GL_EXT_texture_storage GL_ANGLE_texture_compression_dxt5
GL_OES_t
  exture_float_linear GL_EXT_blend_minmax  GL_ANGLE_texture_usage
GL_OES_texture_h
  alf_float_linear GL_OES_texture_npot GL_EXT_texture_filter_anisotropic
GL_ANGLE_
  instanced_arrays GL_NV_fence GL_OES_texture_half_float
GL_ANGLE_framebuffer_blit
   GL_OES_get_program_binary GL_EXT_read_format_bgra GL_EXT_texture_rg
GL_EXT_text
  ure_compression_dxt1 GL_OES_element_index_uint GL_EXT_sRGB
  qt.scenegraph.info: Max Texture Size:  16384

System info:
Windows 10
Installed Qt 5.4 using Visual Studio 2013 compiler.

The code that used to work before is this, but now always fails:

#include <d3d9.h>
#include <dxgi.h>
#include <libEGL/Surface.h>
#if QT_VERSION >= 0x050400
    #include <libGLESv2/renderer/d3d/d3d9/SwapChain9.h>
#elif QT_VERSION >= 0x050300
    #include <libGLESv2/renderer/d3d9/SwapChain9.h>
#else
    #include <libGLESv2/renderer/SwapChain9.h>
#endif
#include <EGL/egl.h>
#include <EGL/eglext.h>

IDirect3DSurface9* AngleQmlRenderSurface::getD3DSurfaceHandle()
{
    //Works in Qt 5.3, always NULL in Qt 5.4
    EGLDisplay display = eglGetCurrentDisplay();
    EGLBoolean result = eglSwapInterval(display, 0);

    //Works in Qt 5.3, always NULL in Qt 5.4
    EGLSurface sfc = eglGetCurrentSurface(EGL_DRAW);
    egl::Surface* surface = static_cast<egl::Surface*>(sfc);
    rx::SwapChain *swapChain = surface->getSwapChain();
    rx::SwapChain9* swapChainD3D9 =
dynamic_cast<rx::SwapChain9*>(swapChain);

    return swapChainD3D9->getRenderTarget();
}

Any suggestion to what might be the problem is much appreciated.

Best regards,
Eirik Ulvik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150907/3016dc58/attachment.html>


More information about the Interest mailing list