Commit 479e3672 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi: Add a IWineD3D field to dxgi_factory.

parent e2572c97
......@@ -34,6 +34,7 @@ dlls/ctl3dv2.dll16
dlls/ddeml.dll16
dlls/dispdib.dll16
dlls/display.drv16
dlls/dxgi/dxgi_private_interface.h
dlls/gdi.exe16
dlls/imm.dll16
dlls/jscript/jsglobal.tlb
......
......@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = dxgi.dll
IMPORTLIB = dxgi
IMPORTS = dxguid uuid kernel32
IMPORTS = dxguid uuid wined3d kernel32
C_SRCS = \
adapter.c \
......@@ -16,6 +16,8 @@ C_SRCS = \
RC_SRCS = version.rc
IDL_H_SRCS = dxgi_private_interface.idl
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
......@@ -20,11 +20,11 @@
#include "config.h"
#include "wine/port.h"
#define DXGI_INIT_GUID
#include "dxgi_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
static CRITICAL_SECTION dxgi_cs;
static CRITICAL_SECTION_DEBUG dxgi_cs_debug =
{
0, 0, &dxgi_cs,
......@@ -32,7 +32,7 @@ static CRITICAL_SECTION_DEBUG dxgi_cs_debug =
&dxgi_cs_debug.ProcessLocksList},
0, 0, {(DWORD_PTR)(__FILE__ ": dxgi_cs")}
};
static CRITICAL_SECTION dxgi_cs = {&dxgi_cs_debug, -1, 0, 0, 0, 0};
CRITICAL_SECTION dxgi_cs = {&dxgi_cs_debug, -1, 0, 0, 0, 0};
struct dxgi_main
{
......@@ -81,7 +81,7 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
struct dxgi_factory *object;
HRESULT hr;
FIXME("riid %s, factory %p partial stub!\n", debugstr_guid(riid), factory);
TRACE("riid %s, factory %p\n", debugstr_guid(riid), factory);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
......@@ -93,6 +93,10 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
object->vtbl = &dxgi_factory_vtbl;
object->refcount = 1;
EnterCriticalSection(&dxgi_cs);
object->wined3d = WineDirect3DCreate(10, (IUnknown *)object);
LeaveCriticalSection(&dxgi_cs);
TRACE("Created IDXGIFactory %p\n", object);
hr = IDXGIFactory_QueryInterface((IDXGIFactory *)object, riid, factory);
......
......@@ -23,20 +23,29 @@
#define COBJMACROS
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "dxgi.h"
#include "wine/wined3d_interface.h"
#ifdef DXGI_INIT_GUID
#include "initguid.h"
#endif
#include "dxgi_private_interface.h"
extern CRITICAL_SECTION dxgi_cs;
/* TRACE helper functions */
const char *debug_dxgi_format(DXGI_FORMAT format);
/* IDXGIFactory */
extern const struct IDXGIFactoryVtbl dxgi_factory_vtbl;
extern const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl;
struct dxgi_factory
{
const struct IDXGIFactoryVtbl *vtbl;
const struct IWineDXGIFactoryVtbl *vtbl;
LONG refcount;
IWineD3D *wined3d;
};
/* IDXGIDevice */
......
/*
* Copyright 2008 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
import "dxgi.idl";
[
object,
local,
uuid(a07ad9ab-fb01-4574-8bfb-0a70a7373f04)
]
interface IWineDXGIFactory : IDXGIFactory
{
struct IWineD3D *get_wined3d();
}
......@@ -26,13 +26,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IDXGIFactory *iface, REFIID riid, void **object)
static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *iface, REFIID riid, void **object)
{
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDXGIObject)
|| IsEqualGUID(riid, &IID_IDXGIFactory))
|| IsEqualGUID(riid, &IID_IDXGIFactory)
|| IsEqualGUID(riid, &IID_IWineDXGIFactory))
{
IUnknown_AddRef(iface);
*object = iface;
......@@ -45,7 +46,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IDXGIFactory *iface
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IDXGIFactory *iface)
static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IWineDXGIFactory *iface)
{
struct dxgi_factory *This = (struct dxgi_factory *)iface;
ULONG refcount = InterlockedIncrement(&This->refcount);
......@@ -55,7 +56,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IDXGIFactory *iface)
return refcount;
}
static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IDXGIFactory *iface)
static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
{
struct dxgi_factory *This = (struct dxgi_factory *)iface;
ULONG refcount = InterlockedDecrement(&This->refcount);
......@@ -64,6 +65,9 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IDXGIFactory *iface)
if (!refcount)
{
EnterCriticalSection(&dxgi_cs);
IWineD3D_Release(This->wined3d);
LeaveCriticalSection(&dxgi_cs);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -72,7 +76,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IDXGIFactory *iface)
/* IDXGIObject methods */
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IDXGIFactory *iface,
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IWineDXGIFactory *iface,
REFGUID guid, UINT data_size, const void *data)
{
FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
......@@ -80,7 +84,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IDXGIFactory *iface
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IDXGIFactory *iface,
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IWineDXGIFactory *iface,
REFGUID guid, const IUnknown *object)
{
FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
......@@ -88,7 +92,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IDXGIFacto
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IDXGIFactory *iface,
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IWineDXGIFactory *iface,
REFGUID guid, UINT *data_size, void *data)
{
FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
......@@ -96,7 +100,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IDXGIFactory *iface
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IDXGIFactory *iface, REFIID riid, void **parent)
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface, REFIID riid, void **parent)
{
FIXME("iface %p, riid %s, parent %p stub!\n", iface, debugstr_guid(riid), parent);
......@@ -105,28 +109,29 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IDXGIFactory *iface, REF
/* IDXGIFactory methods */
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IDXGIFactory *iface, UINT adapter_idx, IDXGIAdapter **adapter)
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface,
UINT adapter_idx, IDXGIAdapter **adapter)
{
FIXME("iface %p, adapter_idx %u, adapter %p stub!\n", iface, adapter_idx, adapter);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IDXGIFactory *iface, HWND window, UINT flags)
static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IWineDXGIFactory *iface, HWND window, UINT flags)
{
FIXME("iface %p, window %p, flags %#x stub!\n\n", iface, window, flags);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IDXGIFactory *iface, HWND *window)
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IWineDXGIFactory *iface, HWND *window)
{
FIXME("iface %p, window %p stub!\n", iface, window);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IDXGIFactory *iface,
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *iface,
IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
{
struct dxgi_swapchain *object;
......@@ -149,7 +154,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IDXGIFactory *ifac
return S_OK;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IDXGIFactory *iface,
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFactory *iface,
HMODULE swrast, IDXGIAdapter **adapter)
{
FIXME("iface %p, swrast %p, adapter %p stub!\n", iface, swrast, adapter);
......@@ -157,7 +162,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IDXGIFactory
return E_NOTIMPL;
}
const struct IDXGIFactoryVtbl dxgi_factory_vtbl =
/* IWineDXGIFactory methods */
static IWineD3D * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface)
{
struct dxgi_factory *This = (struct dxgi_factory *)iface;
TRACE("iface %p\n", iface);
EnterCriticalSection(&dxgi_cs);
IWineD3D_AddRef(This->wined3d);
LeaveCriticalSection(&dxgi_cs);
return This->wined3d;
}
const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =
{
/* IUnknown methods */
dxgi_factory_QueryInterface,
......@@ -174,4 +193,6 @@ const struct IDXGIFactoryVtbl dxgi_factory_vtbl =
dxgi_factory_GetWindowAssociation,
dxgi_factory_CreateSwapChain,
dxgi_factory_CreateSoftwareAdapter,
/* IWineDXGIFactory methods */
dxgi_factory_get_wined3d,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment