d3d11: Allow building UWP features with Desktop features if possible
WINAPI_PARTITION_DESKTOP and WINAPI_PARTITION_APP can coexist. Although UWP only binaries should be used for production stage, this change will be useful for development stage Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1962>
This commit is contained in:
parent
46c577222d
commit
d16b5b7f7f
@ -10,6 +10,7 @@ G_BEGIN_DECLS
|
|||||||
#mesondefine GST_D3D11_DXGI_HEADER_VERSION
|
#mesondefine GST_D3D11_DXGI_HEADER_VERSION
|
||||||
#mesondefine GST_D3D11_HEADER_VERSION
|
#mesondefine GST_D3D11_HEADER_VERSION
|
||||||
#mesondefine GST_D3D11_WINAPI_ONLY_APP
|
#mesondefine GST_D3D11_WINAPI_ONLY_APP
|
||||||
|
#mesondefine GST_D3D11_WINAPI_APP
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -80,15 +80,15 @@ if not have_d3d11
|
|||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
winapi_desktop = cxx.compiles('''#include <winapifamily.h>
|
d3d11_winapi_desktop = cxx.compiles('''#include <winapifamily.h>
|
||||||
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
#error "not win32"
|
#error "not win32"
|
||||||
#endif''',
|
#endif''',
|
||||||
dependencies: [d3d11_lib, dxgi_lib],
|
dependencies: [d3d11_lib, dxgi_lib],
|
||||||
name: 'checking if building for Win32')
|
name: 'building for Win32')
|
||||||
|
|
||||||
if runtimeobject_lib.found() and d3dcompiler_lib.found()
|
if runtimeobject_lib.found() and d3dcompiler_lib.found()
|
||||||
winapi_app = cxx.compiles('''#include <winapifamily.h>
|
d3d11_winapi_app = cxx.compiles('''#include <winapifamily.h>
|
||||||
#include <windows.applicationmodel.core.h>
|
#include <windows.applicationmodel.core.h>
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
#include <wrl/wrappers/corewrappers.h>
|
#include <wrl/wrappers/corewrappers.h>
|
||||||
@ -96,17 +96,21 @@ if runtimeobject_lib.found() and d3dcompiler_lib.found()
|
|||||||
#include <dxgi1_2.h>
|
#include <dxgi1_2.h>
|
||||||
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||||
#error "not winrt"
|
#error "not winrt"
|
||||||
|
#endif
|
||||||
|
#if (WINVER < 0x0A00)
|
||||||
|
#error "Windows 10 API is not guaranteed"
|
||||||
#endif''',
|
#endif''',
|
||||||
dependencies: [d3d11_lib, dxgi_lib, runtimeobject_lib],
|
dependencies: [d3d11_lib, dxgi_lib, runtimeobject_lib],
|
||||||
name: 'checking if building for WinRT')
|
name: 'building for WinRT')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if not winapi_desktop and not winapi_app
|
if not d3d11_winapi_desktop and not d3d11_winapi_app
|
||||||
error('Neither Desktop partition nor App partition')
|
error('Neither Desktop partition nor App partition')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
d3d11_winapi_only_app = winapi_app and not winapi_desktop
|
d3d11_winapi_only_app = d3d11_winapi_app and not d3d11_winapi_desktop
|
||||||
d3d11_conf.set10('GST_D3D11_WINAPI_ONLY_APP', d3d11_winapi_only_app)
|
d3d11_conf.set10('GST_D3D11_WINAPI_ONLY_APP', d3d11_winapi_only_app)
|
||||||
|
d3d11_conf.set10('GST_D3D11_WINAPI_APP', d3d11_winapi_app)
|
||||||
|
|
||||||
# for enabling debug layer
|
# for enabling debug layer
|
||||||
# NOTE: Disable d3d11/dxgi debug layer in case of [UWP build + release CRT]
|
# NOTE: Disable d3d11/dxgi debug layer in case of [UWP build + release CRT]
|
||||||
|
@ -25,10 +25,11 @@
|
|||||||
#include "gstd3d11videoprocessor.h"
|
#include "gstd3d11videoprocessor.h"
|
||||||
#include "gstd3d11pluginutils.h"
|
#include "gstd3d11pluginutils.h"
|
||||||
|
|
||||||
#if GST_D3D11_WINAPI_ONLY_APP
|
#if GST_D3D11_WINAPI_APP
|
||||||
#include "gstd3d11window_corewindow.h"
|
#include "gstd3d11window_corewindow.h"
|
||||||
#include "gstd3d11window_swapchainpanel.h"
|
#include "gstd3d11window_swapchainpanel.h"
|
||||||
#else
|
#endif
|
||||||
|
#if (!GST_D3D11_WINAPI_ONLY_APP)
|
||||||
#include "gstd3d11window_win32.h"
|
#include "gstd3d11window_win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -669,7 +670,8 @@ gst_d3d11_video_sink_prepare_window (GstD3D11VideoSink * self)
|
|||||||
case GST_D3D11_WINDOW_NATIVE_TYPE_HWND:
|
case GST_D3D11_WINDOW_NATIVE_TYPE_HWND:
|
||||||
self->window = gst_d3d11_window_win32_new (self->device, self->window_id);
|
self->window = gst_d3d11_window_win32_new (self->device, self->window_id);
|
||||||
break;
|
break;
|
||||||
#else
|
#endif
|
||||||
|
#if GST_D3D11_WINAPI_APP
|
||||||
case GST_D3D11_WINDOW_NATIVE_TYPE_CORE_WINDOW:
|
case GST_D3D11_WINDOW_NATIVE_TYPE_CORE_WINDOW:
|
||||||
self->window = gst_d3d11_window_core_window_new (self->device,
|
self->window = gst_d3d11_window_core_window_new (self->device,
|
||||||
self->window_id);
|
self->window_id);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "gstd3d11window.h"
|
#include "gstd3d11window.h"
|
||||||
#include "gstd3d11pluginutils.h"
|
#include "gstd3d11pluginutils.h"
|
||||||
|
|
||||||
#if GST_D3D11_WINAPI_ONLY_APP
|
#if GST_D3D11_WINAPI_APP
|
||||||
/* workaround for GetCurrentTime collision */
|
/* workaround for GetCurrentTime collision */
|
||||||
#ifdef GetCurrentTime
|
#ifdef GetCurrentTime
|
||||||
#undef GetCurrentTime
|
#undef GetCurrentTime
|
||||||
@ -40,7 +40,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GST_D3D11_WINAPI_ONLY_APP || defined(HAVE_DIRECT_WRITE)
|
#if GST_D3D11_WINAPI_APP || defined(HAVE_DIRECT_WRITE)
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
#include <wrl/wrappers/corewrappers.h>
|
#include <wrl/wrappers/corewrappers.h>
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
@ -1259,7 +1259,8 @@ gst_d3d11_window_get_native_type_from_handle (guintptr handle)
|
|||||||
#if (!GST_D3D11_WINAPI_ONLY_APP)
|
#if (!GST_D3D11_WINAPI_ONLY_APP)
|
||||||
if (IsWindow ((HWND) handle))
|
if (IsWindow ((HWND) handle))
|
||||||
return GST_D3D11_WINDOW_NATIVE_TYPE_HWND;
|
return GST_D3D11_WINDOW_NATIVE_TYPE_HWND;
|
||||||
#else
|
#endif
|
||||||
|
#if GST_D3D11_WINAPI_ONLY_APP
|
||||||
{
|
{
|
||||||
ComPtr<IInspectable> window = reinterpret_cast<IInspectable*> (handle);
|
ComPtr<IInspectable> window = reinterpret_cast<IInspectable*> (handle);
|
||||||
ComPtr<ABI::Windows::UI::Core::ICoreWindow> core_window;
|
ComPtr<ABI::Windows::UI::Core::ICoreWindow> core_window;
|
||||||
|
@ -65,11 +65,15 @@ if d3d11_winapi_only_app and (not d3dcompiler_lib.found() or not runtimeobject_l
|
|||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if d3d11_winapi_only_app
|
# if build target is Windows 10 and WINAPI_PARTITION_APP is allowed,
|
||||||
|
# we can build UWP only modules as well
|
||||||
|
if d3d11_winapi_app
|
||||||
d3d11_sources += ['gstd3d11window_corewindow.cpp',
|
d3d11_sources += ['gstd3d11window_corewindow.cpp',
|
||||||
'gstd3d11window_swapchainpanel.cpp']
|
'gstd3d11window_swapchainpanel.cpp']
|
||||||
extra_dep += [runtimeobject_lib, d3dcompiler_lib]
|
extra_dep += [runtimeobject_lib, d3dcompiler_lib]
|
||||||
else
|
endif
|
||||||
|
|
||||||
|
if d3d11_winapi_desktop
|
||||||
d3d11_sources += ['gstd3d11window_win32.cpp']
|
d3d11_sources += ['gstd3d11window_win32.cpp']
|
||||||
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6
|
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6
|
||||||
# Desktop Duplication API is unavailable for UWP
|
# Desktop Duplication API is unavailable for UWP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user