Commit d16b5b7f authored by Seungha Yang's avatar Seungha Yang 🐑 Committed by GStreamer Marge Bot
Browse files

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: <gstreamer/gst-plugins-bad!1962>
parent 46c57722
......@@ -10,6 +10,7 @@ G_BEGIN_DECLS
#mesondefine GST_D3D11_DXGI_HEADER_VERSION
#mesondefine GST_D3D11_HEADER_VERSION
#mesondefine GST_D3D11_WINAPI_ONLY_APP
#mesondefine GST_D3D11_WINAPI_APP
G_END_DECLS
......
......@@ -80,15 +80,15 @@ if not have_d3d11
subdir_done()
endif
winapi_desktop = cxx.compiles('''#include <winapifamily.h>
d3d11_winapi_desktop = cxx.compiles('''#include <winapifamily.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#error "not win32"
#endif''',
dependencies: [d3d11_lib, dxgi_lib],
name: 'checking if building for Win32')
name: 'building for Win32')
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 <wrl.h>
#include <wrl/wrappers/corewrappers.h>
......@@ -96,17 +96,21 @@ if runtimeobject_lib.found() and d3dcompiler_lib.found()
#include <dxgi1_2.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#error "not winrt"
#endif
#if (WINVER < 0x0A00)
#error "Windows 10 API is not guaranteed"
#endif''',
dependencies: [d3d11_lib, dxgi_lib, runtimeobject_lib],
name: 'checking if building for WinRT')
name: 'building for WinRT')
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')
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_APP', d3d11_winapi_app)
# for enabling debug layer
# NOTE: Disable d3d11/dxgi debug layer in case of [UWP build + release CRT]
......
......@@ -25,10 +25,11 @@
#include "gstd3d11videoprocessor.h"
#include "gstd3d11pluginutils.h"
#if GST_D3D11_WINAPI_ONLY_APP
#if GST_D3D11_WINAPI_APP
#include "gstd3d11window_corewindow.h"
#include "gstd3d11window_swapchainpanel.h"
#else
#endif
#if (!GST_D3D11_WINAPI_ONLY_APP)
#include "gstd3d11window_win32.h"
#endif
......@@ -669,7 +670,8 @@ gst_d3d11_video_sink_prepare_window (GstD3D11VideoSink * self)
case GST_D3D11_WINDOW_NATIVE_TYPE_HWND:
self->window = gst_d3d11_window_win32_new (self->device, self->window_id);
break;
#else
#endif
#if GST_D3D11_WINAPI_APP
case GST_D3D11_WINDOW_NATIVE_TYPE_CORE_WINDOW:
self->window = gst_d3d11_window_core_window_new (self->device,
self->window_id);
......
......@@ -25,7 +25,7 @@
#include "gstd3d11window.h"
#include "gstd3d11pluginutils.h"
#if GST_D3D11_WINAPI_ONLY_APP
#if GST_D3D11_WINAPI_APP
/* workaround for GetCurrentTime collision */
#ifdef GetCurrentTime
#undef GetCurrentTime
......@@ -40,7 +40,7 @@
#include <sstream>
#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/wrappers/corewrappers.h>
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 (IsWindow ((HWND) handle))
return GST_D3D11_WINDOW_NATIVE_TYPE_HWND;
#else
#endif
#if GST_D3D11_WINAPI_ONLY_APP
{
ComPtr<IInspectable> window = reinterpret_cast<IInspectable*> (handle);
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()
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',
'gstd3d11window_swapchainpanel.cpp']
extra_dep += [runtimeobject_lib, d3dcompiler_lib]
else
endif
if d3d11_winapi_desktop
d3d11_sources += ['gstd3d11window_win32.cpp']
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6
# Desktop Duplication API is unavailable for UWP
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment