[vlc-commits] [Git][videolan/vlc][master] qt: don't release ANGLE internal D3D11 Device

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Oct 9 10:00:21 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
a38ea63e by Pierre Lamot at 2021-10-09T09:42:38+00:00
qt: don't release ANGLE internal D3D11 Device

Using a ComPtr to reference the D3D device was causing it to be destroyed when
the class was released. The device is owned by ANGLE and should not be destroyed
on our side.

fix: #26047

- - - - -


2 changed files:

- modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
- modules/gui/qt/maininterface/compositor_dcomp_uisurface.hpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
=====================================
@@ -185,12 +185,14 @@ bool CompositorDCompositionUISurface::init()
         msg_Err(m_intf, "failed to retreive egl device");
         return false;
     }
-    eglRet = eglQueryDeviceAttribEXT(m_eglDevice, EGL_D3D11_DEVICE_ANGLE, reinterpret_cast<EGLAttrib*>(m_qtd3dDevice.GetAddressOf()));
-    if (!eglRet)
+    ID3D11Device* d3dDevice = nullptr;
+    eglRet = eglQueryDeviceAttribEXT(m_eglDevice, EGL_D3D11_DEVICE_ANGLE, reinterpret_cast<EGLAttrib*>(&d3dDevice));
+    if (!eglRet || !d3dDevice)
     {
         msg_Err(m_intf, "failed to retreive egl device");
         return false;
     }
+    HR(d3dDevice->QueryInterface(__uuidof(ID3D11Device1), (void **)(m_qtd3dDevice1.GetAddressOf())));
 
     m_uiOffscreenSurface = new QOffscreenSurface();
     m_uiOffscreenSurface->setFormat(format);;
@@ -475,8 +477,6 @@ bool CompositorDCompositionUISurface::updateSharedTexture(int width, int height)
         m_d3dContext->PSSetShaderResources(0, 1, m_textureShaderInput.GetAddressOf());
 
         //bind shared texture on Qt side
-        ComPtr<ID3D11Device1> m_qtd3dDevice1;
-        HR(m_qtd3dDevice.As(&m_qtd3dDevice1));
         HR(m_qtd3dDevice1->OpenSharedResource1(m_sharedTextureHandled, IID_PPV_ARGS(&m_d3dInterimTextureQt)), "open shared texture (Qt)");
 
         EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(m_d3dInterimTextureQt.Get());


=====================================
modules/gui/qt/maininterface/compositor_dcomp_uisurface.hpp
=====================================
@@ -34,7 +34,7 @@
 #  define _WIN32_WINNT 0x0603
 # endif
 
-#include <d3d11.h>
+#include <d3d11_1.h>
 #include <dcomp.h>
 #include <wrl.h>
 
@@ -156,7 +156,7 @@ private:
     HANDLE m_sharedTextureHandled = nullptr;
 
     //Shared texture D3D side
-    Microsoft::WRL::ComPtr<ID3D11Device> m_qtd3dDevice;
+    Microsoft::WRL::ComPtr<ID3D11Device1> m_qtd3dDevice1;
     Microsoft::WRL::ComPtr<ID3D11Texture2D> m_d3dInterimTextureQt;
     EGLSurface m_eglInterimTextureQt = 0;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a38ea63ebd96cd95ac10630d0366d779ee24be7e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a38ea63ebd96cd95ac10630d0366d779ee24be7e
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list