[vlc-devel] [PATCH 03/16] qt: don't use SHARED_NTHANDLE on platforms that don't support it
Pierre Lamot
pierre at videolabs.io
Thu Aug 6 09:43:49 CEST 2020
---
.../maininterface/compositor_dcomp_uisurface.cpp | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
index 68bc8662e9..6ff742c59d 100644
--- a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
+++ b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
@@ -430,6 +430,10 @@ bool CompositorDCompositionUISurface::updateSharedTexture(int width, int height)
try
{
releaseSharedTexture();
+
+ D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11Options;
+ HRESULT checkFeatureHR = m_d3dDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11Options, sizeof(d3d11Options));
+
/* interim texture */
D3D11_TEXTURE2D_DESC texDesc = { };
texDesc.MipLevels = 1;
@@ -439,10 +443,18 @@ bool CompositorDCompositionUISurface::updateSharedTexture(int width, int height)
texDesc.Usage = D3D11_USAGE_DEFAULT;
texDesc.CPUAccessFlags = 0;
texDesc.ArraySize = 1;
- texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
texDesc.Height = height;
texDesc.Width = width;
- texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_NTHANDLE;
+ if (SUCCEEDED(checkFeatureHR) && d3d11Options.ExtendedResourceSharing) //D3D11.1 feature
+ {
+ texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_NTHANDLE;
+ }
+ else
+ {
+ texDesc.Format = DXGI_FORMAT_R8G8B8A8_UINT;
+ texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
+ }
HR(m_d3dDevice->CreateTexture2D( &texDesc, NULL, &m_d3dInterimTexture ), "create texture");
--
2.25.1
More information about the vlc-devel
mailing list