2020-12-20 17:47:45 +00:00
|
|
|
d3d11_sources = [
|
2021-06-20 09:48:21 +00:00
|
|
|
'gstd3d11bufferpool.cpp',
|
2022-06-15 18:57:37 +00:00
|
|
|
'gstd3d11compile.cpp',
|
2022-07-20 20:13:21 +00:00
|
|
|
'gstd3d11converter.cpp',
|
2021-06-20 09:48:21 +00:00
|
|
|
'gstd3d11device.cpp',
|
|
|
|
'gstd3d11format.cpp',
|
|
|
|
'gstd3d11memory.cpp',
|
|
|
|
'gstd3d11utils.cpp',
|
2020-12-20 17:47:45 +00:00
|
|
|
]
|
|
|
|
|
2022-06-23 16:25:07 +00:00
|
|
|
d3d11_headers = [
|
|
|
|
'd3d11-prelude.h',
|
|
|
|
'gstd3d11_fwd.h',
|
|
|
|
'gstd3d11.h',
|
|
|
|
'gstd3d11bufferpool.h',
|
2022-08-16 12:01:47 +00:00
|
|
|
'gstd3d11compile.h',
|
2022-07-20 20:13:21 +00:00
|
|
|
'gstd3d11converter.h',
|
2022-06-23 16:25:07 +00:00
|
|
|
'gstd3d11device.h',
|
|
|
|
'gstd3d11format.h',
|
|
|
|
'gstd3d11memory.h',
|
|
|
|
'gstd3d11utils.h',
|
|
|
|
]
|
|
|
|
|
2020-12-20 17:47:45 +00:00
|
|
|
gstd3d11_dep = dependency('', required : false)
|
|
|
|
|
2022-02-11 15:51:56 +00:00
|
|
|
if host_system != 'windows'
|
2020-12-20 17:47:45 +00:00
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
extra_c_args = [
|
|
|
|
'-DCOBJMACROS',
|
2021-06-20 09:48:21 +00:00
|
|
|
]
|
|
|
|
extra_comm_args = [
|
2020-12-20 17:47:45 +00:00
|
|
|
'-DGST_USE_UNSTABLE_API',
|
2021-10-01 14:31:18 +00:00
|
|
|
'-DBUILDING_GST_D3D11',
|
|
|
|
'-DG_LOG_DOMAIN="GStreamer-D3D11"',
|
2020-12-20 17:47:45 +00:00
|
|
|
]
|
2021-06-20 09:48:21 +00:00
|
|
|
|
2020-12-20 17:47:45 +00:00
|
|
|
have_d3d11sdk_h = false
|
|
|
|
have_dxgidebug_h = false
|
2022-02-10 13:31:06 +00:00
|
|
|
d3d11_winapi_app = false
|
2020-12-20 17:47:45 +00:00
|
|
|
d3d11_conf = configuration_data()
|
|
|
|
|
2022-02-11 15:51:56 +00:00
|
|
|
d3d11_lib = cc.find_library('d3d11', required : false)
|
|
|
|
dxgi_lib = cc.find_library('dxgi', required : false)
|
|
|
|
d3dcompiler_lib = cc.find_library('d3dcompiler', required: false)
|
2020-12-20 17:47:45 +00:00
|
|
|
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
|
|
|
|
|
2022-06-15 18:57:37 +00:00
|
|
|
if not d3d11_lib.found() or not dxgi_lib.found()
|
2020-12-20 17:47:45 +00:00
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2022-06-15 18:57:37 +00:00
|
|
|
sdk_headers = [
|
|
|
|
'd3d11_4.h',
|
|
|
|
'dxgi1_6.h',
|
|
|
|
'd3dcompiler.h'
|
|
|
|
]
|
|
|
|
|
|
|
|
foreach h : sdk_headers
|
|
|
|
if not cc.has_header (h)
|
|
|
|
subdir_done ()
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-01-18 10:17:14 +00:00
|
|
|
d3d11_winapi_desktop = cxx.compiles('''#include <winapifamily.h>
|
2020-12-20 17:47:45 +00:00
|
|
|
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
|
|
|
#error "not win32"
|
|
|
|
#endif''',
|
|
|
|
dependencies: [d3d11_lib, dxgi_lib],
|
2021-01-18 10:17:14 +00:00
|
|
|
name: 'building for Win32')
|
2020-12-20 17:47:45 +00:00
|
|
|
|
|
|
|
if runtimeobject_lib.found() and d3dcompiler_lib.found()
|
2021-01-18 10:17:14 +00:00
|
|
|
d3d11_winapi_app = cxx.compiles('''#include <winapifamily.h>
|
2020-12-20 17:47:45 +00:00
|
|
|
#include <windows.applicationmodel.core.h>
|
|
|
|
#include <wrl.h>
|
|
|
|
#include <wrl/wrappers/corewrappers.h>
|
2022-02-10 13:31:06 +00:00
|
|
|
#include <d3d11_4.h>
|
|
|
|
#include <dxgi1_6.h>
|
2020-12-20 17:47:45 +00:00
|
|
|
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
|
|
#error "not winrt"
|
2021-01-18 10:17:14 +00:00
|
|
|
#endif
|
|
|
|
#if (WINVER < 0x0A00)
|
|
|
|
#error "Windows 10 API is not guaranteed"
|
2020-12-20 17:47:45 +00:00
|
|
|
#endif''',
|
|
|
|
dependencies: [d3d11_lib, dxgi_lib, runtimeobject_lib],
|
2021-01-18 10:17:14 +00:00
|
|
|
name: 'building for WinRT')
|
2020-12-20 17:47:45 +00:00
|
|
|
endif
|
|
|
|
|
2021-01-18 10:17:14 +00:00
|
|
|
if not d3d11_winapi_desktop and not d3d11_winapi_app
|
2022-02-11 15:51:56 +00:00
|
|
|
subdir_done()
|
2020-12-20 17:47:45 +00:00
|
|
|
endif
|
|
|
|
|
2022-06-15 18:57:37 +00:00
|
|
|
extra_deps = []
|
2021-01-18 10:17:14 +00:00
|
|
|
d3d11_winapi_only_app = d3d11_winapi_app and not d3d11_winapi_desktop
|
2020-12-20 17:47:45 +00:00
|
|
|
d3d11_conf.set10('GST_D3D11_WINAPI_ONLY_APP', d3d11_winapi_only_app)
|
2021-01-18 10:17:14 +00:00
|
|
|
d3d11_conf.set10('GST_D3D11_WINAPI_APP', d3d11_winapi_app)
|
2020-12-20 17:47:45 +00:00
|
|
|
|
|
|
|
# for enabling debug layer
|
|
|
|
# NOTE: Disable d3d11/dxgi debug layer in case of [UWP build + release CRT]
|
|
|
|
# WACK (Windows App Certification Kit) doesn't seem to be happy with
|
|
|
|
# the DXGIGetDebugInterface1 symbol.
|
|
|
|
|
|
|
|
# FIXME: Probably DXGIGetDebugInterface1 might be used on UWP app for development
|
|
|
|
# purpose. So, I suspect one possible reason why WACK is complaining about
|
|
|
|
# DXGIGetDebugInterface1 is that debugging APIs couldn't be used for
|
|
|
|
# Windows store app, but couldn't find any reference about that.
|
|
|
|
#
|
|
|
|
# [IDXGIDebug1]
|
|
|
|
# https://docs.microsoft.com/en-us/windows/win32/api/dxgidebug/nn-dxgidebug-idxgidebug1
|
|
|
|
# is saying that the IDXGIDebug1 interface is available for both desktop app and
|
|
|
|
# UWP. And then the *DXGIGetDebugInterface1* method need to be called to obtain
|
|
|
|
# the IDXGIDebug1 interface.
|
|
|
|
#
|
|
|
|
# [DXGIGetDebugInterface1]
|
|
|
|
# https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-dxgigetdebuginterface1
|
|
|
|
# is mentioning that DXGIGetDebugInterface1 is desktop app only.
|
|
|
|
#
|
|
|
|
# PLEASE LET US KNOW A CORRECT WAY TO OBTAIN IDXGIDebug1 ON UWP, MICROSOFT
|
|
|
|
if get_option('debug') and not (d3d11_winapi_only_app and get_option('b_vscrt') == 'md')
|
|
|
|
d3d11_debug_libs = [
|
|
|
|
['d3d11sdklayers.h', 'ID3D11Debug', 'ID3D11InfoQueue', 'have_d3d11sdk_h'],
|
|
|
|
['dxgidebug.h', 'IDXGIDebug', 'IDXGIInfoQueue', 'have_dxgidebug_h'],
|
|
|
|
]
|
|
|
|
|
|
|
|
foreach f : d3d11_debug_libs
|
|
|
|
header = f.get(0)
|
|
|
|
debug_obj = f.get(1)
|
|
|
|
info_obj = f.get(2)
|
|
|
|
compile_code = '''
|
|
|
|
#include <d3d11.h>
|
|
|
|
#include <dxgi.h>
|
|
|
|
#include <@0@>
|
|
|
|
int main(int arc, char ** argv) {
|
|
|
|
@1@ *debug = NULL;
|
|
|
|
@2@ *info_queue = NULL;
|
|
|
|
return 0;
|
|
|
|
}'''.format(header, debug_obj, info_obj)
|
|
|
|
if cc.compiles(compile_code, dependencies: [d3d11_lib, dxgi_lib], name: debug_obj)
|
|
|
|
set_variable(f.get(3), true)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
else
|
|
|
|
message('Disable D3D11Debug and DXGIDebug layers')
|
|
|
|
endif
|
|
|
|
|
|
|
|
# don't need to be defined in gstd3d11config.h since it's gstd3d11device internal
|
|
|
|
if have_d3d11sdk_h
|
2021-06-20 09:48:21 +00:00
|
|
|
extra_comm_args += ['-DHAVE_D3D11SDKLAYERS_H']
|
2020-12-20 17:47:45 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if have_dxgidebug_h
|
2021-06-20 09:48:21 +00:00
|
|
|
extra_comm_args += ['-DHAVE_DXGIDEBUG_H']
|
|
|
|
endif
|
|
|
|
|
2022-06-15 18:57:37 +00:00
|
|
|
if d3d11_winapi_only_app
|
|
|
|
extra_deps += [d3dcompiler_lib, runtimeobject_lib]
|
|
|
|
endif
|
|
|
|
|
2021-06-20 09:48:21 +00:00
|
|
|
# MinGW 32bits compiler seems to be complaining about redundant-decls
|
|
|
|
# when ComPtr is in use. Let's just disable the warning
|
|
|
|
if cc.get_id() != 'msvc'
|
|
|
|
extra_args = cc.get_supported_arguments([
|
|
|
|
'-Wno-redundant-decls',
|
|
|
|
])
|
|
|
|
|
|
|
|
extra_comm_args += extra_args
|
2020-12-20 17:47:45 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
configure_file(
|
2022-06-23 16:25:07 +00:00
|
|
|
input : 'gstd3d11config.h.meson',
|
|
|
|
output : 'gstd3d11config.h',
|
|
|
|
install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/d3d11',
|
|
|
|
install_tag : 'devel',
|
2020-12-20 17:47:45 +00:00
|
|
|
configuration: d3d11_conf,
|
|
|
|
)
|
|
|
|
|
2020-06-27 04:39:00 +00:00
|
|
|
pkg_name = 'gstreamer-d3d11-' + api_version
|
2020-12-20 17:47:45 +00:00
|
|
|
gstd3d11 = library('gstd3d11-' + api_version,
|
2022-07-20 20:40:45 +00:00
|
|
|
d3d11_sources,
|
2021-06-20 09:48:21 +00:00
|
|
|
c_args : gst_plugins_bad_args + extra_c_args + extra_comm_args,
|
|
|
|
cpp_args : gst_plugins_bad_args + extra_comm_args,
|
2020-12-20 17:47:45 +00:00
|
|
|
include_directories : [configinc, libsinc],
|
|
|
|
version : libversion,
|
|
|
|
soversion : soversion,
|
|
|
|
install : true,
|
2022-06-15 18:57:37 +00:00
|
|
|
dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, d3d11_lib, dxgi_lib] + extra_deps
|
2020-12-20 17:47:45 +00:00
|
|
|
)
|
|
|
|
|
2022-06-23 16:25:07 +00:00
|
|
|
pkgconfig.generate(gstd3d11,
|
|
|
|
libraries : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib],
|
|
|
|
variables : pkgconfig_variables,
|
|
|
|
subdirs : pkgconfig_subdirs,
|
|
|
|
extra_cflags : ['-I${libdir}/gstreamer-1.0/include'],
|
|
|
|
name : pkg_name,
|
|
|
|
description : 'GStreamer Direct3D11 library',
|
|
|
|
)
|
|
|
|
|
2020-06-27 04:39:00 +00:00
|
|
|
library_def = {'lib': gstd3d11}
|
2022-06-23 16:25:07 +00:00
|
|
|
if build_gir
|
|
|
|
gir_includes = ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0']
|
|
|
|
gir = {
|
2022-08-12 13:05:36 +00:00
|
|
|
'sources' : d3d11_sources + d3d11_headers,
|
2022-06-23 16:25:07 +00:00
|
|
|
'namespace' : 'GstD3D11',
|
|
|
|
'nsversion' : api_version,
|
|
|
|
'identifier_prefix' : 'Gst',
|
|
|
|
'symbol_prefix' : 'gst',
|
|
|
|
'export_packages' : pkg_name,
|
|
|
|
'includes' : gir_includes,
|
|
|
|
'install' : true,
|
|
|
|
'extra_args' : gir_init_section + ['-DGST_USE_UNSTABLE_API'],
|
|
|
|
'dependencies' : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib],
|
|
|
|
}
|
|
|
|
if not static_build
|
|
|
|
d3d11_gir = gnome.generate_gir(gstd3d11, kwargs: gir)
|
|
|
|
gen_sources += d3d11_gir
|
|
|
|
endif
|
|
|
|
|
|
|
|
library_def += {'gir': [gir]}
|
|
|
|
endif
|
2022-09-01 15:51:48 +00:00
|
|
|
gst_libraries += [[pkg_name, library_def]]
|
2020-06-27 04:39:00 +00:00
|
|
|
|
2022-06-23 16:25:07 +00:00
|
|
|
install_headers(d3d11_headers, subdir : 'gstreamer-1.0/gst/d3d11')
|
|
|
|
|
2020-12-20 17:47:45 +00:00
|
|
|
gstd3d11_dep = declare_dependency(link_with : gstd3d11,
|
|
|
|
include_directories : [libsinc],
|
2022-06-23 16:25:07 +00:00
|
|
|
dependencies : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib],
|
|
|
|
sources : gen_sources)
|
|
|
|
|
|
|
|
meson.override_dependency(pkg_name, gstd3d11_dep)
|