From c1f5d396040e30934a6bf0a42f2149195330ff6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 26 Jan 2018 22:09:05 +0100 Subject: [PATCH] dxgi: Allow wrapping factory objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/d3d11_private.h | 2 +- dlls/dxgi/factory.c | 18 +++++++++++++++--- include/wine/winedxgi.idl | 11 ++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index 9089398e5df..c286e768d9c 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -29,7 +29,7 @@ #include "winuser.h" #include "objbase.h" -#include "d3d11_1.h" +#include "d3d11_4.h" #ifdef D3D11_INIT_GUID #include "initguid.h" #endif diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index 8d240789502..3f8816b3c23 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -35,7 +35,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IDXGIFactory4 *ifac TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); - if (IsEqualGUID(iid, &IID_IDXGIFactory4) + if (IsEqualGUID(iid, &IID_IWineDXGIFactory) + || IsEqualGUID(iid, &IID_IDXGIFactory4) || IsEqualGUID(iid, &IID_IDXGIFactory3) || IsEqualGUID(iid, &IID_IDXGIFactory2) || (factory->extended && IsEqualGUID(iid, &IID_IDXGIFactory1)) @@ -504,10 +505,21 @@ static const struct IDXGIFactory4Vtbl dxgi_factory_vtbl = struct dxgi_factory *unsafe_impl_from_IDXGIFactory4(IDXGIFactory4 *iface) { + IWineDXGIFactory *wine_factory; + struct dxgi_factory *factory; + HRESULT hr; + if (!iface) return NULL; - assert(iface->lpVtbl == &dxgi_factory_vtbl); - return CONTAINING_RECORD(iface, struct dxgi_factory, IDXGIFactory4_iface); + if (FAILED(hr = IDXGIFactory4_QueryInterface(iface, &IID_IWineDXGIFactory, (void **)&wine_factory))) + { + ERR("Failed to get IWineDXGIFactory interface, hr %#x.\n", hr); + return NULL; + } + assert(wine_factory->lpVtbl == (void *)&dxgi_factory_vtbl); + factory = CONTAINING_RECORD(wine_factory, struct dxgi_factory, IDXGIFactory4_iface); + IWineDXGIFactory_Release(wine_factory); + return factory; } static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended) diff --git a/include/wine/winedxgi.idl b/include/wine/winedxgi.idl index 983cdba68d1..c3564d50800 100644 --- a/include/wine/winedxgi.idl +++ b/include/wine/winedxgi.idl @@ -18,7 +18,7 @@ #pragma makedep header -import "dxgi.idl"; +import "dxgi1_5.idl"; [ object, @@ -59,3 +59,12 @@ interface IWineDXGIDeviceParent : IUnknown interface IWineDXGIAdapter : IDXGIAdapter1 { } + +[ + object, + local, + uuid(ea02a0d1-4c95-488a-a82c-6034621e8c4f) +] +interface IWineDXGIFactory : IDXGIFactory4 +{ +}