[PATCH v7 0/1] MR11398: d3d11: Fail D3D11_CREATE_DEVICE_VIDEO_SUPPORT until support (bug #50277)
Fix for UnityPlayer.dll calls to D3D11_CREATE_DEVICE_VIDEO_SUPPORT until supported. Forces UnityPlayer.dll software video decoding which skips all the cross-device multi-thread calls involving dxgi_resource_GetSharedHandle and d3d11_device_OpenSharedResource. https://bugs.winehq.org/show_bug.cgi?id=50277#c46 -- v7: d3d11: Fail for D3D11_CREATE_DEVICE_VIDEO_SUPPORT until supported for bug #50277 https://gitlab.winehq.org/wine/wine/-/merge_requests/11398
From: Stian Low <wineryyyyy@gmail.com> --- dlls/d3d11/d3d11_main.c | 10 ++++++++++ dlls/wined3d/directx.c | 5 +++++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_main.c | 3 +++ dlls/wined3d/wined3d_private.h | 1 + include/wine/wined3d.h | 1 + 6 files changed, 21 insertions(+) diff --git a/dlls/d3d11/d3d11_main.c b/dlls/d3d11/d3d11_main.c index 75986318693..78a046f2074 100644 --- a/dlls/d3d11/d3d11_main.c +++ b/dlls/d3d11/d3d11_main.c @@ -164,6 +164,16 @@ static HRESULT d3d11_create_device(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver adapter, debug_d3d_driver_type(driver_type), swrast, flags, feature_levels, levels, sdk_version, device_out, obtained_feature_level, immediate_context); + /* Support forcing unsupported d3d device creation flags to allow + * UnityPlayer.dll to fallback to software video decoding until support for + * resource sharing needed otherwise for D3D11_CREATE_DEVICE_VIDEO_SUPPORT: + * https://bugs.winehq.org/buglist.cgi?quicksearch=%2211398%22 */ + if (flags != (flags & ~wined3d_device_create_flags_forced_unsupported())) + { + FIXME("Failing due to d3d device creation flags 0x%x forced unsupported.\n", wined3d_device_create_flags_forced_unsupported()); + return E_FAIL; + } + if (device_out) *device_out = NULL; if (obtained_feature_level) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e75c3cf625e..538289c5a6b 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1862,6 +1862,11 @@ HRESULT CDECL wined3d_output_get_raster_status(const struct wined3d_output *outp return WINED3D_OK; } +unsigned int CDECL wined3d_device_create_flags_forced_unsupported(void) +{ + return wined3d_settings.no_create_flags; +} + HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id) diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index da7db0c2184..ea6b0430367 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -2,6 +2,7 @@ @ stdcall wined3d_mutex_unlock() @ cdecl wined3d_calculate_format_pitch(ptr long long) +@ cdecl wined3d_device_create_flags_forced_unsupported() @ cdecl wined3d_check_depth_stencil_match(ptr long long long long) @ cdecl wined3d_check_device_format(ptr ptr long long long long long long) @ cdecl wined3d_check_device_format_conversion(ptr long long long) diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 91d8dd567ff..dc07d962dff 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -129,6 +129,7 @@ struct wined3d_settings wined3d_settings = .max_sm_cs = UINT_MAX, .renderer = WINED3D_RENDERER_AUTO, .shader_backend = WINED3D_SHADER_BACKEND_AUTO, + .no_create_flags = 0, }; enum wined3d_renderer CDECL wined3d_get_renderer(void) @@ -344,6 +345,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) { if (!get_config_key_dword(hkey, appkey, env, "csmt", &wined3d_settings.cs_multithreaded)) ERR_(winediag)("Setting multithreaded command stream to %#x.\n", wined3d_settings.cs_multithreaded); + if (!get_config_key_dword(hkey, appkey, env, "no_create_flags", &wined3d_settings.no_create_flags)) + ERR_(winediag)("Force D3D device creation without support for flags %#x.\n", wined3d_settings.no_create_flags); if (!get_config_key_dword(hkey, appkey, env, "MaxVersionGL", &tmpvalue)) { ERR_(winediag)("Setting maximum allowed wined3d GL version to %u.%u.\n", diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 9537670f7c5..8f6d777168c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -466,6 +466,7 @@ struct wined3d_settings { unsigned int cs_multithreaded; unsigned int max_gl_version; + unsigned int no_create_flags; unsigned short pci_vendor_id; unsigned short pci_device_id; /* Memory tracking and object counting. */ diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 49c6672fa3f..3f042a9dc50 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2335,6 +2335,7 @@ void __stdcall wined3d_mutex_unlock(void); unsigned int __cdecl wined3d_calculate_format_pitch(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id, unsigned int width); +unsigned int __cdecl wined3d_device_create_flags_forced_unsupported(void); HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11398
participants (2)
-
Stian Low -
Stian Low (@stianlow)