#define __GST_D3D11_FWD_H__
#include <gst/gst.h>
-
-/* define COBJMACROS to use d3d11 C APIs */
-#ifndef COBJMACROS
-#define COBJMACROS
-#endif
+#include "d3d11config.h"
#ifndef INITGUID
#include <initguid.h>
#endif
#include <d3d11.h>
-#ifdef HAVE_DXGI_1_5_H
+
+#if (DXGI_HEADER_VERSION >= 6)
+#include <dxgi1_6.h>
+#elif (DXGI_HEADER_VERSION >= 5)
#include <dxgi1_5.h>
+#elif (DXGI_HEADER_VERSION >= 4)
+#include <dxgi1_4.h>
+#elif (DXGI_HEADER_VERSION >= 3)
+#include <dxgi1_3.h>
+#elif (DXGI_HEADER_VERSION >= 2)
+#include <dxgi1_2.h>
#else
#include <dxgi.h>
#endif
#include "config.h"
#endif
+#include "d3d11config.h"
+
#include "gstd3d11device.h"
#include "gstd3d11utils.h"
#include "gmodule.h"
};
D3D_FEATURE_LEVEL selected_level;
-#ifdef HAVE_DXGI_1_5_H
+ GST_DEBUG_OBJECT (self,
+ "Built with DXGI header version %d", DXGI_HEADER_VERSION);
+
+#if (DXGI_HEADER_VERSION >= 5)
hr = CreateDXGIFactory1 (&IID_IDXGIFactory5, (void **) &factory);
if (!gst_d3d11_result (hr)) {
GST_INFO_OBJECT (self, "IDXGIFactory5 was unavailable");
#include "config.h"
#endif
+#include "d3d11config.h"
+
#include "gstd3d11window.h"
#include "gstd3d11device.h"
#include "gstd3d11memory.h"
return window;
}
-#ifdef HAVE_DXGI_1_5_H
+#if (DXGI_HEADER_VERSION >= 5)
static inline UINT16
fraction_to_uint (guint num, guint den, guint scale)
{
GstCaps *render_caps;
MakeWindowAssociationData mwa_data = { 0, };
UINT swapchain_flags = 0;
-#if defined(HAVE_DXGI_1_5_H)
+#if (DXGI_HEADER_VERSION >= 5)
gboolean have_cll = FALSE;
gboolean have_mastering = FALSE;
gboolean swapchain4_available = FALSE;
}
window->allow_tearing = FALSE;
-#if defined(HAVE_DXGI_1_5_H)
+#if (DXGI_HEADER_VERSION >= 5)
if (!gst_video_content_light_level_from_caps (&window->content_light_level,
caps)) {
gst_video_content_light_level_init (&window->content_light_level);
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.BufferCount = 2;
desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-#if defined(HAVE_DXGI_1_5_H)
+#if (DXGI_HEADER_VERSION >= 5)
/* For non-DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 color space support,
* DXGI_SWAP_EFFECT_FLIP_DISCARD instead of DXGI_SWAP_EFFECT_DISCARD */
if (swapchain4_available)
gst_d3d11_device_thread_add (window->device,
(GstD3D11DeviceThreadFunc) gst_d3d11_window_disable_alt_enter, &mwa_data);
-#if defined(HAVE_DXGI_1_5_H)
+#if (DXGI_HEADER_VERSION >= 5)
if (swapchain4_available) {
HRESULT hr;
GST_DXGI_COLOR_SPACE_TYPE ctype;
gst_d3d11_color_converter_update_rect (self->converter, &rect);
gst_d3d11_color_converter_convert (self->converter, srv, &self->rtv);
}
-#ifdef HAVE_DXGI_1_5_H
+#if (DXGI_HEADER_VERSION >= 5)
if (self->allow_tearing) {
present_flags |= DXGI_PRESENT_ALLOW_TEARING;
}
'gstd3d11colorconverter.c',
]
+dxgi_headers = [
+ ['dxgi1_6.h', 6],
+ ['dxgi1_5.h', 5],
+ ['dxgi1_4.h', 4],
+ ['dxgi1_3.h', 3],
+ ['dxgi1_2.h', 2],
+ ['dxgi.h', 1]
+]
+
have_d3d11 = false
-extra_c_args = []
+extra_c_args = ['-DCOBJMACROS']
+have_dxgi_header = false
extra_dep = []
+d3d11_conf = configuration_data()
d3d11_option = get_option('d3d11')
if host_system != 'windows' or d3d11_option.disabled()
dxgi_lib = cc.find_library('dxgi', required : d3d11_option)
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
-have_d3d11 = d3d11_lib.found() and dxgi_lib.found() and cc.has_header('d3d11.h') and cc.has_header('dxgi.h') and cc.has_header('d3dcompiler.h')
+foreach dxgi_h: dxgi_headers
+ if not have_dxgi_header and cc.has_header(dxgi_h[0])
+ d3d11_conf.set('DXGI_HEADER_VERSION', dxgi_h[1])
+ have_dxgi_header = true
+ endif
+endforeach
+
+have_d3d11 = d3d11_lib.found() and dxgi_lib.found() and cc.has_header('d3d11.h') and have_dxgi_header and cc.has_header('d3dcompiler.h')
if not have_d3d11
if d3d11_option.enabled()
error('The d3d11 plugin was enabled explicitly, but required dependencies were not found.')
subdir_done()
endif
-# required for HDR metadata
-if cc.has_header('dxgi1_5.h')
- extra_c_args += ['-DHAVE_DXGI_1_5_H']
-endif
-
# for enabling debug layer
if cc.has_header('d3d11sdklayers.h')
- extra_c_args += ['-DHAVE_D3D11SDKLAYER_H']
+ d3d11_conf.set('HAVE_D3D11SDKLAYER_H', 1)
extra_dep += [gmodule_dep]
endif
+configure_file(
+ output: 'd3d11config.h',
+ configuration: d3d11_conf,
+)
+
gstd3d11 = library('gstd3d11',
d3d11_sources,
c_args : gst_plugins_bad_args + extra_c_args,