[PATCH v9 0/1] MR11404: dxgi: Support GetSharedHandle() for UnityPlayer.dll
Starting point for work-in-process to support WINE_D3D_CONFIG=csmt=0x1 cross-device multi-thread safety for UnityPlayer.dll that fixes video playback for some games. WINE_D3D_CONFIG=csmt=0x2,renderer=vulkan is required for starting point patch which minimally supports Get/OpenSharedResource() for D3D11_CREATE_DEVICE_VIDEO_SUPPORT for UnityPlayer.dll and allows videos to play. https://bugs.winehq.org/show_bug.cgi?id=50277#c42 renderer=gl crashes regardless of Get/OpenSharedResource() so context sharing across devices for gl may need fixes in addition to wined3d multi-thread safety to support WINE_D3D_CONFIG=csmt=0x1. MR-11398 should be overridden by this merge request when ready which may be much less immediate: https://gitlab.winehq.org/wine/wine/-/merge_requests/11398 -- v9: dxgi: Support GetSharedHandle() for UnityPlayer.dll https://gitlab.winehq.org/wine/wine/-/merge_requests/11404
From: Stian Low <wineryyyyy@gmail.com> --- dlls/d3d11/device.c | 14 ++++++++++++-- dlls/dxgi/resource.c | 18 +++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index e1a846698e6..d4a42471be6 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -4594,8 +4594,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device static HRESULT STDMETHODCALLTYPE d3d11_device_OpenSharedResource(ID3D11Device5 *iface, HANDLE resource, REFIID iid, void **out) { - FIXME("iface %p, resource %p, iid %s, out %p stub!\n", iface, resource, debugstr_guid(iid), out); - + TRACE("iface %p, resource %p, iid %s, out %p stub!\n", iface, resource, debugstr_guid(iid), out); +#if 000 + if (IsEqualGUID(iid, &IID_ID3D11Texture2D)) + { + return ID3D11Texture2D_QueryInterface(resource, iid, out); + } + else if (IsEqualGUID(iid, &IID_IDXGIResource)) + { + return ID3D11ShaderResourceView_QueryInterface(resource, iid, out); + } +#endif + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); return E_NOTIMPL; } diff --git a/dlls/dxgi/resource.c b/dlls/dxgi/resource.c index 67921de005b..884ea237cb5 100644 --- a/dlls/dxgi/resource.c +++ b/dlls/dxgi/resource.c @@ -385,9 +385,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_resource_GetDevice(IDXGIResource1 *iface, /* IDXGIResource methods */ static HRESULT STDMETHODCALLTYPE dxgi_resource_GetSharedHandle(IDXGIResource1 *iface, HANDLE *shared_handle) { +#if 0001 FIXME("iface %p, shared_handle %p stub!\n", iface, shared_handle); - return E_NOTIMPL; +#elif 001 + DWORD access_rights = DXGI_SHARED_RESOURCE_READ | DXGI_SHARED_RESOURCE_WRITE; + TRACE("iface %p, shared_handle %p stub!\n", iface, shared_handle); + return IDXGIResource1_CreateSharedHandle(iface, NULL, access_rights, NULL, shared_handle); +#endif } static HRESULT STDMETHODCALLTYPE dxgi_resource_GetUsage(IDXGIResource1 *iface, DXGI_USAGE *usage) @@ -478,10 +483,17 @@ static HRESULT STDMETHODCALLTYPE dxgi_resource_CreateSubresourceSurface(IDXGIRes static HRESULT STDMETHODCALLTYPE dxgi_resource_CreateSharedHandle(IDXGIResource1 *iface, const SECURITY_ATTRIBUTES *attributes, DWORD access, const WCHAR *name, HANDLE *handle) { +#if 001 FIXME("iface %p, attributes %p, access %#lx, name %s, handle %p stub!\n", iface, attributes, - access, wine_dbgstr_w(name), handle); - + access, wine_dbgstr_w(name), handle); return E_NOTIMPL; +#elif 001 + struct dxgi_resource *resource = impl_from_IDXGIResource1(iface); + FIXME("iface %p, attributes %p, access %#lx, name %s, handle %p stub!\n", iface, attributes, + access, wine_dbgstr_w(name), handle); + *handle = resource->outer_unknown; + return S_OK; +#endif } static const struct IDXGIResource1Vtbl dxgi_resource_vtbl = -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11404
Confirming redundant effort: - https://gitlab.winehq.org/wine/wine/-/merge_requests/11707 Probably best I do not finish implementation based on DXVK to reduce risk of being rejected by wined3d maintainers. They seem to have the advantage of getting commits in much easier with much less scrutiny. Thanks for DXVK reference anyway. At least users wined3d bugs will be fixed after 8 years one way or another. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11404#note_149317
participants (2)
-
Stian Low -
Stian Low (@stianlow)