d3d11device: Store selected d3d feature level

Depending on selected feature level, d3d11 API usage can be different.
Instead of querying the selected feature level by user whenever required,
store it once by d3d11device.
This commit is contained in:
Seungha Yang 2019-09-25 20:34:10 +09:00 committed by GStreamer Merge Bot
parent 4ff0e62b72
commit 8da5237e22
2 changed files with 13 additions and 0 deletions

View file

@ -61,6 +61,7 @@ struct _GstD3D11DevicePrivate
IDXGIFactory1 *factory;
GstD3D11DXGIFactoryVersion factory_ver;
D3D_FEATURE_LEVEL feature_level;
ID3D11VideoDevice *video_device;
ID3D11VideoContext *video_context;
@ -283,6 +284,7 @@ gst_d3d11_device_constructed (GObject * object)
hr = D3D11CreateDevice ((IDXGIAdapter *) adapter, D3D_DRIVER_TYPE_UNKNOWN,
NULL, d3d11_flags, feature_levels, G_N_ELEMENTS (feature_levels),
D3D11_SDK_VERSION, &priv->device, &selected_level, &priv->device_context);
priv->feature_level = selected_level;
if (FAILED (hr)) {
/* Retry if the system could not recognize D3D_FEATURE_LEVEL_11_1 */
@ -290,6 +292,7 @@ gst_d3d11_device_constructed (GObject * object)
NULL, d3d11_flags, &feature_levels[1],
G_N_ELEMENTS (feature_levels) - 1, D3D11_SDK_VERSION, &priv->device,
&selected_level, &priv->device_context);
priv->feature_level = selected_level;
}
if (SUCCEEDED (hr)) {
@ -603,6 +606,14 @@ gst_d3d11_device_get_chosen_dxgi_factory_version (GstD3D11Device * device)
return device->priv->factory_ver;
}
D3D_FEATURE_LEVEL
gst_d3d11_device_get_chosen_feature_level (GstD3D11Device * device)
{
g_return_val_if_fail (GST_IS_D3D11_DEVICE (device), 0);
return device->priv->feature_level;
}
typedef struct
{
GstD3D11Device *device;

View file

@ -85,6 +85,8 @@ ID3D11DeviceContext * gst_d3d11_device_get_device_context_handle (GstD3D11Device
GstD3D11DXGIFactoryVersion gst_d3d11_device_get_chosen_dxgi_factory_version (GstD3D11Device * device);
D3D_FEATURE_LEVEL gst_d3d11_device_get_chosen_feature_level (GstD3D11Device * device);
IDXGISwapChain * gst_d3d11_device_create_swap_chain (GstD3D11Device * device,
const DXGI_SWAP_CHAIN_DESC * desc);