mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
d3d11: Remove unnecessary helper methods
We can query selected D3D_FEATURE_LEVEL and factory version by using native D3D11 API Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1906>
This commit is contained in:
parent
2ca298d459
commit
1138c798ff
4 changed files with 5 additions and 43 deletions
|
@ -82,8 +82,6 @@ struct _GstD3D11DevicePrivate
|
||||||
ID3D11DeviceContext *device_context;
|
ID3D11DeviceContext *device_context;
|
||||||
|
|
||||||
IDXGIFactory1 *factory;
|
IDXGIFactory1 *factory;
|
||||||
GstD3D11DXGIFactoryVersion factory_ver;
|
|
||||||
D3D_FEATURE_LEVEL feature_level;
|
|
||||||
GstD3D11Format format_table[GST_D3D11_N_FORMATS];
|
GstD3D11Format format_table[GST_D3D11_N_FORMATS];
|
||||||
|
|
||||||
GRecMutex extern_lock;
|
GRecMutex extern_lock;
|
||||||
|
@ -612,12 +610,9 @@ gst_d3d11_device_constructed (GObject * object)
|
||||||
|
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->factory_ver = GST_D3D11_DXGI_FACTORY_5;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!factory) {
|
if (!factory) {
|
||||||
priv->factory_ver = GST_D3D11_DXGI_FACTORY_1;
|
|
||||||
hr = CreateDXGIFactory1 (&IID_IDXGIFactory1, (void **) &factory);
|
hr = CreateDXGIFactory1 (&IID_IDXGIFactory1, (void **) &factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +669,6 @@ gst_d3d11_device_constructed (GObject * object)
|
||||||
hr = D3D11CreateDevice ((IDXGIAdapter *) adapter, D3D_DRIVER_TYPE_UNKNOWN,
|
hr = D3D11CreateDevice ((IDXGIAdapter *) adapter, D3D_DRIVER_TYPE_UNKNOWN,
|
||||||
NULL, d3d11_flags, feature_levels, G_N_ELEMENTS (feature_levels),
|
NULL, d3d11_flags, feature_levels, G_N_ELEMENTS (feature_levels),
|
||||||
D3D11_SDK_VERSION, &priv->device, &selected_level, &priv->device_context);
|
D3D11_SDK_VERSION, &priv->device, &selected_level, &priv->device_context);
|
||||||
priv->feature_level = selected_level;
|
|
||||||
|
|
||||||
if (!gst_d3d11_result (hr, NULL)) {
|
if (!gst_d3d11_result (hr, NULL)) {
|
||||||
/* Retry if the system could not recognize D3D_FEATURE_LEVEL_11_1 */
|
/* Retry if the system could not recognize D3D_FEATURE_LEVEL_11_1 */
|
||||||
|
@ -682,7 +676,6 @@ gst_d3d11_device_constructed (GObject * object)
|
||||||
NULL, d3d11_flags, &feature_levels[1],
|
NULL, d3d11_flags, &feature_levels[1],
|
||||||
G_N_ELEMENTS (feature_levels) - 1, D3D11_SDK_VERSION, &priv->device,
|
G_N_ELEMENTS (feature_levels) - 1, D3D11_SDK_VERSION, &priv->device,
|
||||||
&selected_level, &priv->device_context);
|
&selected_level, &priv->device_context);
|
||||||
priv->feature_level = selected_level;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if D3D11_CREATE_DEVICE_DEBUG was enabled but couldn't create device,
|
/* if D3D11_CREATE_DEVICE_DEBUG was enabled but couldn't create device,
|
||||||
|
@ -697,7 +690,6 @@ gst_d3d11_device_constructed (GObject * object)
|
||||||
NULL, d3d11_flags, feature_levels, G_N_ELEMENTS (feature_levels),
|
NULL, d3d11_flags, feature_levels, G_N_ELEMENTS (feature_levels),
|
||||||
D3D11_SDK_VERSION, &priv->device, &selected_level,
|
D3D11_SDK_VERSION, &priv->device, &selected_level,
|
||||||
&priv->device_context);
|
&priv->device_context);
|
||||||
priv->feature_level = selected_level;
|
|
||||||
|
|
||||||
if (!gst_d3d11_result (hr, NULL)) {
|
if (!gst_d3d11_result (hr, NULL)) {
|
||||||
/* Retry if the system could not recognize D3D_FEATURE_LEVEL_11_1 */
|
/* Retry if the system could not recognize D3D_FEATURE_LEVEL_11_1 */
|
||||||
|
@ -705,7 +697,6 @@ gst_d3d11_device_constructed (GObject * object)
|
||||||
NULL, d3d11_flags, &feature_levels[1],
|
NULL, d3d11_flags, &feature_levels[1],
|
||||||
G_N_ELEMENTS (feature_levels) - 1, D3D11_SDK_VERSION, &priv->device,
|
G_N_ELEMENTS (feature_levels) - 1, D3D11_SDK_VERSION, &priv->device,
|
||||||
&selected_level, &priv->device_context);
|
&selected_level, &priv->device_context);
|
||||||
priv->feature_level = selected_level;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,23 +953,6 @@ gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device)
|
||||||
return device->priv->factory;
|
return device->priv->factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstD3D11DXGIFactoryVersion
|
|
||||||
gst_d3d11_device_get_chosen_dxgi_factory_version (GstD3D11Device * device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GST_IS_D3D11_DEVICE (device),
|
|
||||||
GST_D3D11_DXGI_FACTORY_UNKNOWN);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_d3d11_device_lock (GstD3D11Device * device)
|
gst_d3d11_device_lock (GstD3D11Device * device)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,17 +37,6 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_D3D11_DEVICE_HANDLE_CONTEXT_TYPE "gst.d3d11.device.handle"
|
#define GST_D3D11_DEVICE_HANDLE_CONTEXT_TYPE "gst.d3d11.device.handle"
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GST_D3D11_DXGI_FACTORY_UNKNOWN = 0,
|
|
||||||
GST_D3D11_DXGI_FACTORY_1,
|
|
||||||
GST_D3D11_DXGI_FACTORY_2,
|
|
||||||
GST_D3D11_DXGI_FACTORY_3,
|
|
||||||
GST_D3D11_DXGI_FACTORY_4,
|
|
||||||
GST_D3D11_DXGI_FACTORY_5,
|
|
||||||
} GstD3D11DXGIFactoryVersion;
|
|
||||||
|
|
||||||
|
|
||||||
struct _GstD3D11Device
|
struct _GstD3D11Device
|
||||||
{
|
{
|
||||||
GstObject parent;
|
GstObject parent;
|
||||||
|
@ -77,10 +66,6 @@ ID3D11DeviceContext * gst_d3d11_device_get_device_context_handle (GstD3D11Device
|
||||||
|
|
||||||
IDXGIFactory1 * gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device);
|
IDXGIFactory1 * gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device);
|
||||||
|
|
||||||
GstD3D11DXGIFactoryVersion gst_d3d11_device_get_chosen_dxgi_factory_version (GstD3D11Device * device);
|
|
||||||
|
|
||||||
D3D_FEATURE_LEVEL gst_d3d11_device_get_chosen_feature_level (GstD3D11Device * device);
|
|
||||||
|
|
||||||
void gst_d3d11_device_lock (GstD3D11Device * device);
|
void gst_d3d11_device_lock (GstD3D11Device * device);
|
||||||
|
|
||||||
void gst_d3d11_device_unlock (GstD3D11Device * device);
|
void gst_d3d11_device_unlock (GstD3D11Device * device);
|
||||||
|
|
|
@ -88,13 +88,15 @@ compile_shader (GstD3D11Device * device, const gchar * shader_source,
|
||||||
const gchar *shader_target;
|
const gchar *shader_target;
|
||||||
D3D_FEATURE_LEVEL feature_level;
|
D3D_FEATURE_LEVEL feature_level;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
ID3D11Device *device_handle;
|
||||||
|
|
||||||
if (!gst_d3d11_shader_init ()) {
|
if (!gst_d3d11_shader_init ()) {
|
||||||
GST_ERROR ("D3DCompiler is unavailable");
|
GST_ERROR ("D3DCompiler is unavailable");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
feature_level = gst_d3d11_device_get_chosen_feature_level (device);
|
device_handle = gst_d3d11_device_get_device_handle (device);
|
||||||
|
feature_level = ID3D11Device_GetFeatureLevel (device_handle);
|
||||||
|
|
||||||
if (is_pixel_shader) {
|
if (is_pixel_shader) {
|
||||||
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
|
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
|
||||||
|
|
|
@ -140,8 +140,9 @@ plugin_init (GstPlugin * plugin)
|
||||||
*/
|
*/
|
||||||
if (device) {
|
if (device) {
|
||||||
D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
|
D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
|
||||||
|
ID3D11Device *device_handle = gst_d3d11_device_get_device_handle (device);
|
||||||
|
|
||||||
feature_level = gst_d3d11_device_get_chosen_feature_level (device);
|
feature_level = ID3D11Device_GetFeatureLevel (device_handle);
|
||||||
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
|
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
|
||||||
video_sink_rank = GST_RANK_PRIMARY;
|
video_sink_rank = GST_RANK_PRIMARY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue