=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi: Allow wrapping factory objects.

Alexandre Julliard julliard at winehq.org
Mon Jan 29 14:48:17 CST 2018


Module: wine
Branch: master
Commit: c1f5d396040e30934a6bf0a42f2149195330ff6c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c1f5d396040e30934a6bf0a42f2149195330ff6c

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Jan 26 22:09:05 2018 +0100

dxgi: Allow wrapping factory objects.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 9089398..c286e76 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 8d24078..3f8816b 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 983cdba..c3564d5 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
+{
+}




More information about the wine-cvs mailing list