mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
d3d11: Use configuration file for dxgi header version check
This commit is contained in:
parent
23b47a7ec1
commit
9fd0b62f2d
4 changed files with 51 additions and 21 deletions
|
@ -21,19 +21,24 @@
|
|||
#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
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "d3d11config.h"
|
||||
|
||||
#include "gstd3d11device.h"
|
||||
#include "gstd3d11utils.h"
|
||||
#include "gmodule.h"
|
||||
|
@ -234,7 +236,10 @@ gst_d3d11_device_constructed (GObject * object)
|
|||
};
|
||||
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");
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "d3d11config.h"
|
||||
|
||||
#include "gstd3d11window.h"
|
||||
#include "gstd3d11device.h"
|
||||
#include "gstd3d11memory.h"
|
||||
|
@ -806,7 +808,7 @@ gst_d3d11_window_new (GstD3D11Device * device)
|
|||
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)
|
||||
{
|
||||
|
@ -1008,7 +1010,7 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint width, guint height,
|
|||
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;
|
||||
|
@ -1075,7 +1077,7 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint width, guint height,
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -1147,7 +1149,7 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint width, guint height,
|
|||
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)
|
||||
|
@ -1175,7 +1177,7 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint width, guint height,
|
|||
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;
|
||||
|
@ -1346,7 +1348,7 @@ _present_on_device_thread (GstD3D11Device * device, FramePresentData * data)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,20 @@ d3d11_sources = [
|
|||
'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()
|
||||
|
@ -29,7 +40,14 @@ d3d11_lib = cc.find_library('d3d11', required : d3d11_option)
|
|||
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.')
|
||||
|
@ -37,17 +55,17 @@ if not have_d3d11
|
|||
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,
|
||||
|
|
Loading…
Reference in a new issue