dxgi: Allow wrapping factory objects.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-26 22:09:05 +01:00 committed by Alexandre Julliard
parent de28d86057
commit c1f5d39604
3 changed files with 26 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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
{
}