2 'gstd3d11bufferpool.cpp',
6 'gstd3d11stagingbufferpool.cpp',
27 gstd3d11_dep = dependency('', required : false)
29 d3d11_option = get_option('d3d11')
30 if host_system != 'windows' or d3d11_option.disabled()
39 '-DGST_USE_UNSTABLE_API',
40 '-DBUILDING_GST_D3D11',
41 '-DG_LOG_DOMAIN="GStreamer-D3D11"',
44 have_dxgi_header = false
45 have_d3d11_header = false
46 have_d3d11sdk_h = false
47 have_dxgidebug_h = false
48 winapi_desktop = false
50 d3d11_conf = configuration_data()
51 d3d11_conf_options = [
52 'GST_D3D11_DXGI_HEADER_VERSION',
53 'GST_D3D11_HEADER_VERSION',
54 'GST_D3D11_WINAPI_ONLY_APP',
57 foreach option : d3d11_conf_options
58 d3d11_conf.set10(option, false)
61 d3d11_lib = cc.find_library('d3d11', required : d3d11_option)
62 dxgi_lib = cc.find_library('dxgi', required : d3d11_option)
63 d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
64 runtimeobject_lib = cc.find_library('runtimeobject', required : false)
66 foreach dxgi_h: dxgi_headers
67 if not have_dxgi_header and cc.has_header(dxgi_h[0])
68 d3d11_conf.set('GST_D3D11_DXGI_HEADER_VERSION', dxgi_h[1])
69 have_dxgi_header = true
73 foreach d3d11_h: d3d11_headers
74 if not have_d3d11_header and cc.has_header(d3d11_h[0])
75 d3d11_conf.set('GST_D3D11_HEADER_VERSION', d3d11_h[1])
76 have_d3d11_header = true
80 have_d3d11 = d3d11_lib.found() and dxgi_lib.found() and have_d3d11_header and have_dxgi_header
82 if d3d11_option.enabled()
83 error('The d3d11 was enabled explicitly, but required dependencies were not found.')
88 d3d11_winapi_desktop = cxx.compiles('''#include <winapifamily.h>
89 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
92 dependencies: [d3d11_lib, dxgi_lib],
93 name: 'building for Win32')
95 if runtimeobject_lib.found() and d3dcompiler_lib.found()
96 d3d11_winapi_app = cxx.compiles('''#include <winapifamily.h>
97 #include <windows.applicationmodel.core.h>
99 #include <wrl/wrappers/corewrappers.h>
102 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
105 #if (WINVER < 0x0A00)
106 #error "Windows 10 API is not guaranteed"
108 dependencies: [d3d11_lib, dxgi_lib, runtimeobject_lib],
109 name: 'building for WinRT')
112 if not d3d11_winapi_desktop and not d3d11_winapi_app
113 error('Neither Desktop partition nor App partition')
116 d3d11_winapi_only_app = d3d11_winapi_app and not d3d11_winapi_desktop
117 d3d11_conf.set10('GST_D3D11_WINAPI_ONLY_APP', d3d11_winapi_only_app)
118 d3d11_conf.set10('GST_D3D11_WINAPI_APP', d3d11_winapi_app)
120 # for enabling debug layer
121 # NOTE: Disable d3d11/dxgi debug layer in case of [UWP build + release CRT]
122 # WACK (Windows App Certification Kit) doesn't seem to be happy with
123 # the DXGIGetDebugInterface1 symbol.
125 # FIXME: Probably DXGIGetDebugInterface1 might be used on UWP app for development
126 # purpose. So, I suspect one possible reason why WACK is complaining about
127 # DXGIGetDebugInterface1 is that debugging APIs couldn't be used for
128 # Windows store app, but couldn't find any reference about that.
131 # https://docs.microsoft.com/en-us/windows/win32/api/dxgidebug/nn-dxgidebug-idxgidebug1
132 # is saying that the IDXGIDebug1 interface is available for both desktop app and
133 # UWP. And then the *DXGIGetDebugInterface1* method need to be called to obtain
134 # the IDXGIDebug1 interface.
136 # [DXGIGetDebugInterface1]
137 # https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-dxgigetdebuginterface1
138 # is mentioning that DXGIGetDebugInterface1 is desktop app only.
140 # PLEASE LET US KNOW A CORRECT WAY TO OBTAIN IDXGIDebug1 ON UWP, MICROSOFT
141 if get_option('debug') and not (d3d11_winapi_only_app and get_option('b_vscrt') == 'md')
143 ['d3d11sdklayers.h', 'ID3D11Debug', 'ID3D11InfoQueue', 'have_d3d11sdk_h'],
144 ['dxgidebug.h', 'IDXGIDebug', 'IDXGIInfoQueue', 'have_dxgidebug_h'],
147 foreach f : d3d11_debug_libs
155 int main(int arc, char ** argv) {
157 @2@ *info_queue = NULL;
159 }'''.format(header, debug_obj, info_obj)
160 if cc.compiles(compile_code, dependencies: [d3d11_lib, dxgi_lib], name: debug_obj)
161 set_variable(f.get(3), true)
165 message('Disable D3D11Debug and DXGIDebug layers')
168 # don't need to be defined in gstd3d11config.h since it's gstd3d11device internal
170 extra_comm_args += ['-DHAVE_D3D11SDKLAYERS_H']
174 extra_comm_args += ['-DHAVE_DXGIDEBUG_H']
177 # MinGW 32bits compiler seems to be complaining about redundant-decls
178 # when ComPtr is in use. Let's just disable the warning
179 if cc.get_id() != 'msvc'
180 extra_args = cc.get_supported_arguments([
181 '-Wno-redundant-decls',
184 extra_comm_args += extra_args
188 output: 'gstd3d11config.h',
189 configuration: d3d11_conf,
192 pkg_name = 'gstreamer-d3d11-' + api_version
193 gstd3d11 = library('gstd3d11-' + api_version,
195 c_args : gst_plugins_bad_args + extra_c_args + extra_comm_args,
196 cpp_args : gst_plugins_bad_args + extra_comm_args,
197 include_directories : [configinc, libsinc],
198 version : libversion,
199 soversion : soversion,
201 dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, d3d11_lib, dxgi_lib]
204 library_def = {'lib': gstd3d11}
205 libraries += [[pkg_name, library_def]]
207 # Still non-public api, should not install headers
208 gstd3d11_dep = declare_dependency(link_with : gstd3d11,
209 include_directories : [libsinc],
210 dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, d3d11_lib, dxgi_lib])