Skip to content
Snippets Groups Projects
Commit a38ea63e authored by Pierre Lamot's avatar Pierre Lamot Committed by Jean-Baptiste Kempf
Browse files

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
parent bc0fd236
No related branches found
No related tags found
1 merge request!738qt: don't release ANGLE internal D3D11 Device
Pipeline #146244 passed with stage
in 13 minutes and 35 seconds
......@@ -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());
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment