Commit 36d4268e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove COM from IWineD3D.

parent 1fd7c96a
...@@ -45,7 +45,7 @@ IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) { ...@@ -45,7 +45,7 @@ IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) {
object->IDirect3D8_iface.lpVtbl = &Direct3D8_Vtbl; object->IDirect3D8_iface.lpVtbl = &Direct3D8_Vtbl;
object->ref = 1; object->ref = 1;
object->WineD3D = WineDirect3DCreate(8, (IUnknown *)&object->IDirect3D8_iface); object->WineD3D = wined3d_create(8, &object->IDirect3D8_iface);
TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D); TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
......
...@@ -133,9 +133,7 @@ struct IDirect3D8Impl ...@@ -133,9 +133,7 @@ struct IDirect3D8Impl
{ {
IDirect3D8 IDirect3D8_iface; IDirect3D8 IDirect3D8_iface;
LONG ref; LONG ref;
struct wined3d *WineD3D;
/* The WineD3D device */
IWineD3D *WineD3D;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -191,7 +189,7 @@ struct IDirect3DDevice8Impl ...@@ -191,7 +189,7 @@ struct IDirect3DDevice8Impl
BOOL inDestruction; BOOL inDestruction;
}; };
HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapter, HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT adapter,
D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN; D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN;
/* ---------------- */ /* ---------------- */
......
...@@ -382,7 +382,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(IDirect3D ...@@ -382,7 +382,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(IDirect3D
static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **ppD3D8) static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **ppD3D8)
{ {
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IWineD3D *pWineD3D; struct wined3d *wined3d;
HRESULT hr; HRESULT hr;
TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8); TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8);
...@@ -392,12 +392,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, ...@@ -392,12 +392,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface,
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &wined3d);
if (SUCCEEDED(hr) && pWineD3D) if (SUCCEEDED(hr) && wined3d)
{ {
*ppD3D8 = IWineD3D_GetParent(pWineD3D); *ppD3D8 = wined3d_get_parent(wined3d);
IDirect3D8_AddRef(*ppD3D8); IDirect3D8_AddRef(*ppD3D8);
IWineD3D_Release(pWineD3D); wined3d_decref(wined3d);
} }
else else
{ {
...@@ -2966,7 +2966,7 @@ static void setup_fpu(void) ...@@ -2966,7 +2966,7 @@ static void setup_fpu(void)
#endif #endif
} }
HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapter, HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT adapter,
D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters)
{ {
WINED3DPRESENT_PARAMETERS wined3d_parameters; WINED3DPRESENT_PARAMETERS wined3d_parameters;
...@@ -2987,7 +2987,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte ...@@ -2987,7 +2987,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu(); if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
&device->IWineD3DDeviceParent_iface, &device->WineD3DDevice); &device->IWineD3DDeviceParent_iface, &device->WineD3DDevice);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -81,7 +81,7 @@ static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) ...@@ -81,7 +81,7 @@ static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface)
TRACE("Releasing wined3d %p\n", This->WineD3D); TRACE("Releasing wined3d %p\n", This->WineD3D);
wined3d_mutex_lock(); wined3d_mutex_lock();
IWineD3D_Release(This->WineD3D); wined3d_decref(This->WineD3D);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
...@@ -99,7 +99,7 @@ static HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice(LPDIRECT3D8 iface, ...@@ -99,7 +99,7 @@ static HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice(LPDIRECT3D8 iface,
TRACE("iface %p, init_function %p.\n", iface, pInitializeFunction); TRACE("iface %p, init_function %p.\n", iface, pInitializeFunction);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); hr = wined3d_register_software_device(This->WineD3D, pInitializeFunction);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -113,7 +113,7 @@ static UINT WINAPI IDirect3D8Impl_GetAdapterCount(LPDIRECT3D8 iface) ...@@ -113,7 +113,7 @@ static UINT WINAPI IDirect3D8Impl_GetAdapterCount(LPDIRECT3D8 iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterCount(This->WineD3D); hr = wined3d_get_adapter_count(This->WineD3D);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -137,7 +137,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, UIN ...@@ -137,7 +137,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, UIN
adapter_id.device_name_size = 0; /* d3d9 only */ adapter_id.device_name_size = 0; /* d3d9 only */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); hr = wined3d_get_adapter_identifier(This->WineD3D, Adapter, Flags, &adapter_id);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
pIdentifier->DriverVersion = adapter_id.driver_version; pIdentifier->DriverVersion = adapter_id.driver_version;
...@@ -159,7 +159,7 @@ static UINT WINAPI IDirect3D8Impl_GetAdapterModeCount(LPDIRECT3D8 iface,UINT Ada ...@@ -159,7 +159,7 @@ static UINT WINAPI IDirect3D8Impl_GetAdapterModeCount(LPDIRECT3D8 iface,UINT Ada
TRACE("iface %p, adapter %u.\n", iface, Adapter); TRACE("iface %p, adapter %u.\n", iface, Adapter);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, 0 /* format */); hr = wined3d_get_adapter_mode_count(This->WineD3D, Adapter, 0);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -175,7 +175,7 @@ static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes(LPDIRECT3D8 iface, UINT Ad ...@@ -175,7 +175,7 @@ static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes(LPDIRECT3D8 iface, UINT Ad
iface, Adapter, Mode, pMode); iface, Adapter, Mode, pMode);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, WINED3DFMT_UNKNOWN, Mode, (WINED3DDISPLAYMODE *) pMode); hr = wined3d_enum_adapter_modes(This->WineD3D, Adapter, WINED3DFMT_UNKNOWN, Mode, (WINED3DDISPLAYMODE *)pMode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
...@@ -193,7 +193,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode(LPDIRECT3D8 iface, UI ...@@ -193,7 +193,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode(LPDIRECT3D8 iface, UI
iface, Adapter, pMode); iface, Adapter, pMode);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); hr = wined3d_get_adapter_display_mode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *)pMode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
...@@ -211,7 +211,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType(LPDIRECT3D8 iface, UINT Ada ...@@ -211,7 +211,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType(LPDIRECT3D8 iface, UINT Ada
iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed); iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), hr = wined3d_check_device_type(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
wined3dformat_from_d3dformat(BackBufferFormat), Windowed); wined3dformat_from_d3dformat(BackBufferFormat), Windowed);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -249,7 +249,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat(LPDIRECT3D8 iface, UINT A ...@@ -249,7 +249,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat(LPDIRECT3D8 iface, UINT A
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), hr = wined3d_check_device_format(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat),
Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -267,8 +267,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(IDirect3D8 *ifac ...@@ -267,8 +267,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(IDirect3D8 *ifac
iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType); iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, hr = wined3d_check_device_multisample_type(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SurfaceFormat), Windowed, (WINED3DMULTISAMPLE_TYPE) MultiSampleType, NULL); wined3dformat_from_d3dformat(SurfaceFormat), Windowed, (WINED3DMULTISAMPLE_TYPE)MultiSampleType, NULL);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -285,7 +285,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, U ...@@ -285,7 +285,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, U
iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, hr = wined3d_check_depth_stencil_match(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat),
wined3dformat_from_d3dformat(DepthStencilFormat)); wined3dformat_from_d3dformat(DepthStencilFormat));
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -325,7 +325,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada ...@@ -325,7 +325,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
fixup_caps(pWineCaps); fixup_caps(pWineCaps);
...@@ -344,7 +344,7 @@ static HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT ...@@ -344,7 +344,7 @@ static HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT
TRACE("iface %p, adapter %u.\n", iface, Adapter); TRACE("iface %p, adapter %u.\n", iface, Adapter);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); ret = wined3d_get_adapter_monitor(This->WineD3D, Adapter);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
......
...@@ -40,7 +40,7 @@ IDirect3D9* WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT SDKVersion) { ...@@ -40,7 +40,7 @@ IDirect3D9* WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT SDKVersion) {
object->ref = 1; object->ref = 1;
wined3d_mutex_lock(); wined3d_mutex_lock();
object->WineD3D = WineDirect3DCreate(9, (IUnknown *)object); object->WineD3D = wined3d_create(9, object);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D); TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
......
...@@ -149,8 +149,7 @@ typedef struct IDirect3D9Impl ...@@ -149,8 +149,7 @@ typedef struct IDirect3D9Impl
const IDirect3D9ExVtbl *lpVtbl; const IDirect3D9ExVtbl *lpVtbl;
LONG ref; LONG ref;
/* The WineD3D device */ struct wined3d *WineD3D;
IWineD3D *WineD3D;
/* Created via Direct3DCreate9Ex? Can QI extended interfaces */ /* Created via Direct3DCreate9Ex? Can QI extended interfaces */
BOOL extended; BOOL extended;
...@@ -180,7 +179,7 @@ typedef struct IDirect3DDevice9Impl ...@@ -180,7 +179,7 @@ typedef struct IDirect3DDevice9Impl
BOOL notreset; BOOL notreset;
} IDirect3DDevice9Impl; } IDirect3DDevice9Impl;
HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type, HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type,
HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN; HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
......
...@@ -323,10 +323,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEV ...@@ -323,10 +323,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEV
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface, IDirect3D9** ppD3D9) { static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(IDirect3DDevice9Ex *iface, IDirect3D9 **ppD3D9)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
struct wined3d *wined3d;
HRESULT hr = D3D_OK; HRESULT hr = D3D_OK;
IWineD3D* pWineD3D;
TRACE("iface %p, d3d9 %p.\n", iface, ppD3D9); TRACE("iface %p, d3d9 %p.\n", iface, ppD3D9);
...@@ -335,13 +336,15 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface ...@@ -335,13 +336,15 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &wined3d);
if (hr == D3D_OK && pWineD3D != NULL) if (hr == D3D_OK && wined3d)
{ {
*ppD3D9 = IWineD3D_GetParent(pWineD3D); *ppD3D9 = wined3d_get_parent(wined3d);
IDirect3D9_AddRef(*ppD3D9); IDirect3D9_AddRef(*ppD3D9);
IWineD3D_Release(pWineD3D); wined3d_decref(wined3d);
} else { }
else
{
FIXME("Call to IWineD3DDevice_GetDirect3D failed\n"); FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
*ppD3D9 = NULL; *ppD3D9 = NULL;
} }
...@@ -3251,7 +3254,7 @@ static void setup_fpu(void) ...@@ -3251,7 +3254,7 @@ static void setup_fpu(void)
#endif #endif
} }
HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type, HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type,
HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode)
{ {
WINED3DPRESENT_PARAMETERS *wined3d_parameters; WINED3DPRESENT_PARAMETERS *wined3d_parameters;
...@@ -3268,7 +3271,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte ...@@ -3268,7 +3271,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu(); if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
(IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice); (IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -3281,7 +3284,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte ...@@ -3281,7 +3284,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte
{ {
WINED3DCAPS caps; WINED3DCAPS caps;
IWineD3D_GetDeviceCaps(wined3d, adapter, device_type, &caps); wined3d_get_device_caps(wined3d, adapter, device_type, &caps);
count = caps.NumberOfAdaptersInGroup; count = caps.NumberOfAdaptersInGroup;
} }
......
...@@ -72,7 +72,7 @@ static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9EX iface) { ...@@ -72,7 +72,7 @@ static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9EX iface) {
if (ref == 0) { if (ref == 0) {
wined3d_mutex_lock(); wined3d_mutex_lock();
IWineD3D_Release(This->WineD3D); wined3d_decref(This->WineD3D);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
...@@ -89,7 +89,7 @@ static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9EX ifac ...@@ -89,7 +89,7 @@ static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9EX ifac
TRACE("iface %p, init_function %p.\n", iface, pInitializeFunction); TRACE("iface %p, init_function %p.\n", iface, pInitializeFunction);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); hr = wined3d_register_software_device(This->WineD3D, pInitializeFunction);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -102,7 +102,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9EX iface) { ...@@ -102,7 +102,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9EX iface) {
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterCount(This->WineD3D); hr = wined3d_get_adapter_count(This->WineD3D);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -124,7 +124,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, U ...@@ -124,7 +124,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, U
adapter_id.device_name_size = sizeof(pIdentifier->DeviceName); adapter_id.device_name_size = sizeof(pIdentifier->DeviceName);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); hr = wined3d_get_adapter_identifier(This->WineD3D, Adapter, Flags, &adapter_id);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
pIdentifier->DriverVersion = adapter_id.driver_version; pIdentifier->DriverVersion = adapter_id.driver_version;
...@@ -150,7 +150,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT ...@@ -150,7 +150,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format)); hr = wined3d_get_adapter_mode_count(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format));
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -169,7 +169,7 @@ static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT ...@@ -169,7 +169,7 @@ static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format), hr = wined3d_enum_adapter_modes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format),
Mode, (WINED3DDISPLAYMODE *) pMode); Mode, (WINED3DDISPLAYMODE *) pMode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -185,7 +185,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, ...@@ -185,7 +185,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface,
TRACE("iface %p, adapter %u, mode %p.\n", iface, Adapter, pMode); TRACE("iface %p, adapter %u, mode %p.\n", iface, Adapter, pMode);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); hr = wined3d_get_adapter_display_mode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *)pMode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
...@@ -203,7 +203,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex *iface, UINT A ...@@ -203,7 +203,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex *iface, UINT A
iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed); iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), hr = wined3d_check_device_type(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
wined3dformat_from_d3dformat(BackBufferFormat), Windowed); wined3dformat_from_d3dformat(BackBufferFormat), Windowed);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -244,7 +244,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT ...@@ -244,7 +244,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), hr = wined3d_check_device_format(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat),
Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -262,7 +262,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *if ...@@ -262,7 +262,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *if
iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels); iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, hr = wined3d_check_device_multisample_type(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels); wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -279,7 +279,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface, ...@@ -279,7 +279,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface,
iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, hr = wined3d_check_depth_stencil_match(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat),
wined3dformat_from_d3dformat(DepthStencilFormat)); wined3dformat_from_d3dformat(DepthStencilFormat));
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -295,7 +295,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX i ...@@ -295,7 +295,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX i
iface, Adapter, DeviceType, SourceFormat, TargetFormat); iface, Adapter, DeviceType, SourceFormat, TargetFormat);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType, hr = wined3d_check_device_format_conversion(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat)); wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat));
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -379,7 +379,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Ada ...@@ -379,7 +379,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Ada
memset(pCaps, 0, sizeof(*pCaps)); memset(pCaps, 0, sizeof(*pCaps));
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WINECAPSTOD3D9CAPS(pCaps, pWineCaps) WINECAPSTOD3D9CAPS(pCaps, pWineCaps)
...@@ -401,7 +401,7 @@ static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface, UIN ...@@ -401,7 +401,7 @@ static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface, UIN
TRACE("iface %p, adapter %u.\n", iface, Adapter); TRACE("iface %p, adapter %u.\n", iface, Adapter);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); ret = wined3d_get_adapter_monitor(This->WineD3D, Adapter);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
...@@ -510,7 +510,7 @@ static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT ...@@ -510,7 +510,7 @@ static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT
adapter_id.device_name_size = 0; adapter_id.device_name_size = 0;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, adapter, 0, &adapter_id); hr = wined3d_get_adapter_identifier(This->WineD3D, adapter, 0, &adapter_id);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid)); memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid));
......
...@@ -454,7 +454,7 @@ static void ddraw_destroy(IDirectDrawImpl *This) ...@@ -454,7 +454,7 @@ static void ddraw_destroy(IDirectDrawImpl *This)
/* Release the attached WineD3D stuff */ /* Release the attached WineD3D stuff */
IWineD3DDevice_Release(This->wineD3DDevice); IWineD3DDevice_Release(This->wineD3DDevice);
IWineD3D_Release(This->wineD3D); wined3d_decref(This->wineD3D);
/* Now free the object */ /* Now free the object */
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
...@@ -714,7 +714,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, ...@@ -714,7 +714,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
{ {
WINED3DDISPLAYMODE display_mode; WINED3DDISPLAYMODE display_mode;
IWineD3D_GetAdapterDisplayMode(This->wineD3D, WINED3DADAPTER_DEFAULT, &display_mode); wined3d_get_adapter_display_mode(This->wineD3D, WINED3DADAPTER_DEFAULT, &display_mode);
IWineD3DDevice_SetupFullscreenWindow(This->wineD3DDevice, hwnd, display_mode.Width, display_mode.Height); IWineD3DDevice_SetupFullscreenWindow(This->wineD3DDevice, hwnd, display_mode.Width, display_mode.Height);
} }
} }
...@@ -1364,20 +1364,15 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes ...@@ -1364,20 +1364,15 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
if(type == SURFACE_UNKNOWN) type = SURFACE_GDI; if(type == SURFACE_UNKNOWN) type = SURFACE_GDI;
for(i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i)
hr = IWineD3D_CheckDeviceFormat(This->wineD3D, {
WINED3DADAPTER_DEFAULT, hr = wined3d_check_device_format(This->wineD3D, WINED3DADAPTER_DEFAULT, WINED3DDEVTYPE_HAL,
WINED3DDEVTYPE_HAL, d3ddm.Format, 0, WINED3DRTYPE_SURFACE, formats[i], type);
d3ddm.Format /* AdapterFormat */, if (SUCCEEDED(hr))
0 /* usage */, {
WINED3DRTYPE_SURFACE, if (count < outsize)
formats[i],
type);
if(SUCCEEDED(hr)) {
if(count < outsize) {
Codes[count] = formats[i]; Codes[count] = formats[i];
} ++count;
count++;
} }
} }
if(NumCodes) { if(NumCodes) {
...@@ -2145,11 +2140,8 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, ...@@ -2145,11 +2140,8 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
} }
modenum = 0; modenum = 0;
while(IWineD3D_EnumAdapterModes(This->wineD3D, while (wined3d_enum_adapter_modes(This->wineD3D, WINED3DADAPTER_DEFAULT,
WINED3DADAPTER_DEFAULT, checkFormatList[fmt], modenum++, &mode) == WINED3D_OK)
checkFormatList[fmt],
modenum++,
&mode) == WINED3D_OK)
{ {
if(DDSD) if(DDSD)
{ {
...@@ -5027,7 +5019,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device ...@@ -5027,7 +5019,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i) for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i)
{ {
hr = IWineD3D_CheckDeviceFormat(This->wineD3D, WINED3DADAPTER_DEFAULT, type, d3ddm.Format, hr = wined3d_check_device_format(This->wineD3D, WINED3DADAPTER_DEFAULT, type, d3ddm.Format,
WINED3DUSAGE_DEPTHSTENCIL, WINED3DRTYPE_SURFACE, formats[i], SURFACE_OPENGL); WINED3DUSAGE_DEPTHSTENCIL, WINED3DRTYPE_SURFACE, formats[i], SURFACE_OPENGL);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -5111,7 +5103,7 @@ static HRESULT WINAPI d3d3_EvictManagedTextures(IDirect3D3 *iface) ...@@ -5111,7 +5103,7 @@ static HRESULT WINAPI d3d3_EvictManagedTextures(IDirect3D3 *iface)
* D3D_OK on success, or the return value of IWineD3D::GetCaps * D3D_OK on success, or the return value of IWineD3D::GetCaps
* *
*****************************************************************************/ *****************************************************************************/
HRESULT IDirect3DImpl_GetCaps(IWineD3D *wined3d, D3DDEVICEDESC *desc1, D3DDEVICEDESC7 *desc7) HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d, D3DDEVICEDESC *desc1, D3DDEVICEDESC7 *desc7)
{ {
WINED3DCAPS wined3d_caps; WINED3DCAPS wined3d_caps;
HRESULT hr; HRESULT hr;
...@@ -5121,7 +5113,7 @@ HRESULT IDirect3DImpl_GetCaps(IWineD3D *wined3d, D3DDEVICEDESC *desc1, D3DDEVICE ...@@ -5121,7 +5113,7 @@ HRESULT IDirect3DImpl_GetCaps(IWineD3D *wined3d, D3DDEVICEDESC *desc1, D3DDEVICE
memset(&wined3d_caps, 0, sizeof(wined3d_caps)); memset(&wined3d_caps, 0, sizeof(wined3d_caps));
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
hr = IWineD3D_GetDeviceCaps(wined3d, 0, WINED3DDEVTYPE_HAL, &wined3d_caps); hr = wined3d_get_device_caps(wined3d, 0, WINED3DDEVTYPE_HAL, &wined3d_caps);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -6010,19 +6002,19 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type) ...@@ -6010,19 +6002,19 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
ddraw->orig_width = GetSystemMetrics(SM_CXSCREEN); ddraw->orig_width = GetSystemMetrics(SM_CXSCREEN);
ddraw->orig_height = GetSystemMetrics(SM_CYSCREEN); ddraw->orig_height = GetSystemMetrics(SM_CYSCREEN);
ddraw->wineD3D = WineDirect3DCreate(7, &ddraw->IDirectDraw7_iface); ddraw->wineD3D = wined3d_create(7, &ddraw->IDirectDraw7_iface);
if (!ddraw->wineD3D) if (!ddraw->wineD3D)
{ {
WARN("Failed to create a wined3d object.\n"); WARN("Failed to create a wined3d object.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hr = IWineD3D_CreateDevice(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0, hr = wined3d_device_create(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0,
(IWineD3DDeviceParent *)&ddraw->device_parent_vtbl, &ddraw->wineD3DDevice); (IWineD3DDeviceParent *)&ddraw->device_parent_vtbl, &ddraw->wineD3DDevice);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create a wined3d device, hr %#x.\n", hr); WARN("Failed to create a wined3d device, hr %#x.\n", hr);
IWineD3D_Release(ddraw->wineD3D); wined3d_decref(ddraw->wineD3D);
return hr; return hr;
} }
......
...@@ -111,7 +111,7 @@ struct IDirectDrawImpl ...@@ -111,7 +111,7 @@ struct IDirectDrawImpl
LONG ref7, ref4, ref2, ref3, ref1, numIfaces; LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
/* WineD3D linkage */ /* WineD3D linkage */
IWineD3D *wineD3D; struct wined3d *wineD3D;
IWineD3DDevice *wineD3DDevice; IWineD3DDevice *wineD3DDevice;
BOOL d3d_initialized; BOOL d3d_initialized;
...@@ -368,7 +368,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, ...@@ -368,7 +368,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw,
extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN; extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN;
/* Helper functions */ /* Helper functions */
HRESULT IDirect3DImpl_GetCaps(IWineD3D *WineD3D, D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7) DECLSPEC_HIDDEN; HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d,
D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7) DECLSPEC_HIDDEN;
WINED3DZBUFFERTYPE IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This) DECLSPEC_HIDDEN; WINED3DZBUFFERTYPE IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This) DECLSPEC_HIDDEN;
static inline IDirect3DDeviceImpl *device_from_device1(IDirect3DDevice *iface) static inline IDirect3DDeviceImpl *device_from_device1(IDirect3DDevice *iface)
......
...@@ -1114,15 +1114,9 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface, ...@@ -1114,15 +1114,9 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface,
for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i) for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i)
{ {
hr = IWineD3D_CheckDeviceFormat(This->ddraw->wineD3D, hr = wined3d_check_device_format(This->ddraw->wineD3D, WINED3DADAPTER_DEFAULT, WINED3DDEVTYPE_HAL,
WINED3DADAPTER_DEFAULT, mode.Format, 0, WINED3DRTYPE_TEXTURE, FormatList[i], SURFACE_OPENGL);
WINED3DDEVTYPE_HAL, if (hr == D3D_OK)
mode.Format,
0 /* Usage */,
WINED3DRTYPE_TEXTURE,
FormatList[i],
SURFACE_OPENGL);
if(hr == D3D_OK)
{ {
DDPIXELFORMAT pformat; DDPIXELFORMAT pformat;
...@@ -1143,15 +1137,10 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface, ...@@ -1143,15 +1137,10 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface,
for (i = 0; i < sizeof(BumpFormatList) / sizeof(*BumpFormatList); ++i) for (i = 0; i < sizeof(BumpFormatList) / sizeof(*BumpFormatList); ++i)
{ {
hr = IWineD3D_CheckDeviceFormat(This->ddraw->wineD3D, hr = wined3d_check_device_format(This->ddraw->wineD3D, WINED3DADAPTER_DEFAULT,
WINED3DADAPTER_DEFAULT, WINED3DDEVTYPE_HAL, mode.Format, WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
WINED3DDEVTYPE_HAL, WINED3DRTYPE_TEXTURE, BumpFormatList[i], SURFACE_OPENGL);
mode.Format, if (hr == D3D_OK)
WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
WINED3DRTYPE_TEXTURE,
BumpFormatList[i],
SURFACE_OPENGL);
if(hr == D3D_OK)
{ {
DDPIXELFORMAT pformat; DDPIXELFORMAT pformat;
...@@ -1264,15 +1253,9 @@ IDirect3DDeviceImpl_2_EnumTextureFormats(IDirect3DDevice2 *iface, ...@@ -1264,15 +1253,9 @@ IDirect3DDeviceImpl_2_EnumTextureFormats(IDirect3DDevice2 *iface,
for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i) for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i)
{ {
hr = IWineD3D_CheckDeviceFormat(This->ddraw->wineD3D, hr = wined3d_check_device_format(This->ddraw->wineD3D, 0, WINED3DDEVTYPE_HAL,
0 /* Adapter */, mode.Format, 0, WINED3DRTYPE_TEXTURE, FormatList[i], SURFACE_OPENGL);
WINED3DDEVTYPE_HAL, if (hr == D3D_OK)
mode.Format,
0 /* Usage */,
WINED3DRTYPE_TEXTURE,
FormatList[i],
SURFACE_OPENGL);
if(hr == D3D_OK)
{ {
DDSURFACEDESC sdesc; DDSURFACEDESC sdesc;
......
...@@ -135,7 +135,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D ...@@ -135,7 +135,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
struct dxgi_adapter *This = (struct dxgi_adapter *)iface; struct dxgi_adapter *This = (struct dxgi_adapter *)iface;
WINED3DADAPTER_IDENTIFIER adapter_id; WINED3DADAPTER_IDENTIFIER adapter_id;
char description[128]; char description[128];
IWineD3D *wined3d; struct wined3d *wined3d;
HRESULT hr; HRESULT hr;
TRACE("iface %p, desc %p.\n", iface, desc); TRACE("iface %p, desc %p.\n", iface, desc);
...@@ -149,8 +149,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D ...@@ -149,8 +149,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
adapter_id.device_name_size = 0; adapter_id.device_name_size = 0;
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
hr = IWineD3D_GetAdapterIdentifier(wined3d, This->ordinal, 0, &adapter_id); hr = wined3d_get_adapter_identifier(wined3d, This->ordinal, 0, &adapter_id);
IWineD3D_Release(wined3d); wined3d_decref(wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
......
...@@ -340,7 +340,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l ...@@ -340,7 +340,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
IWineD3DDeviceParent *wined3d_device_parent; IWineD3DDeviceParent *wined3d_device_parent;
IWineDXGIAdapter *wine_adapter; IWineDXGIAdapter *wine_adapter;
UINT adapter_ordinal; UINT adapter_ordinal;
IWineD3D *wined3d; struct wined3d *wined3d;
void *layer_base; void *layer_base;
HRESULT hr; HRESULT hr;
...@@ -370,7 +370,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l ...@@ -370,7 +370,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
{ {
WARN("This is not the adapter we're looking for, returning %#x.\n", hr); WARN("This is not the adapter we're looking for, returning %#x.\n", hr);
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
IWineD3D_Release(wined3d); wined3d_decref(wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
goto fail; goto fail;
} }
...@@ -386,10 +386,10 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l ...@@ -386,10 +386,10 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
FIXME("Ignoring adapter type.\n"); FIXME("Ignoring adapter type.\n");
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
hr = IWineD3D_CreateDevice(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0, hr = wined3d_device_create(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0,
wined3d_device_parent, &device->wined3d_device); wined3d_device_parent, &device->wined3d_device);
IWineD3DDeviceParent_Release(wined3d_device_parent); IWineD3DDeviceParent_Release(wined3d_device_parent);
IWineD3D_Release(wined3d); wined3d_decref(wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -79,7 +79,7 @@ struct dxgi_factory ...@@ -79,7 +79,7 @@ struct dxgi_factory
{ {
const struct IWineDXGIFactoryVtbl *vtbl; const struct IWineDXGIFactoryVtbl *vtbl;
LONG refcount; LONG refcount;
IWineD3D *wined3d; struct wined3d *wined3d;
UINT adapter_count; UINT adapter_count;
IDXGIAdapter **adapters; IDXGIAdapter **adapters;
}; };
......
...@@ -74,7 +74,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface) ...@@ -74,7 +74,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
HeapFree(GetProcessHeap(), 0, This->adapters); HeapFree(GetProcessHeap(), 0, This->adapters);
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
IWineD3D_Release(This->wined3d); wined3d_decref(This->wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
...@@ -256,14 +256,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac ...@@ -256,14 +256,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac
/* IWineDXGIFactory methods */ /* IWineDXGIFactory methods */
static IWineD3D * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface) static struct wined3d * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface)
{ {
struct dxgi_factory *This = (struct dxgi_factory *)iface; struct dxgi_factory *This = (struct dxgi_factory *)iface;
TRACE("iface %p\n", iface); TRACE("iface %p\n", iface);
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
IWineD3D_AddRef(This->wined3d); wined3d_incref(This->wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
return This->wined3d; return This->wined3d;
} }
...@@ -298,14 +298,14 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) ...@@ -298,14 +298,14 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
factory->refcount = 1; factory->refcount = 1;
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
factory->wined3d = WineDirect3DCreate(10, (IUnknown *)factory); factory->wined3d = wined3d_create(10, factory);
if (!factory->wined3d) if (!factory->wined3d)
{ {
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
return DXGI_ERROR_UNSUPPORTED; return DXGI_ERROR_UNSUPPORTED;
} }
factory->adapter_count = IWineD3D_GetAdapterCount(factory->wined3d); factory->adapter_count = wined3d_get_adapter_count(factory->wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
factory->adapters = HeapAlloc(GetProcessHeap(), 0, factory->adapter_count * sizeof(*factory->adapters)); factory->adapters = HeapAlloc(GetProcessHeap(), 0, factory->adapter_count * sizeof(*factory->adapters));
if (!factory->adapters) if (!factory->adapters)
...@@ -355,7 +355,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) ...@@ -355,7 +355,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
fail: fail:
HeapFree(GetProcessHeap(), 0, factory->adapters); HeapFree(GetProcessHeap(), 0, factory->adapters);
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
IWineD3D_Release(factory->wined3d); wined3d_decref(factory->wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
return hr; return hr;
} }
...@@ -119,7 +119,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -119,7 +119,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
{ {
struct dxgi_output *This = (struct dxgi_output *)iface; struct dxgi_output *This = (struct dxgi_output *)iface;
enum wined3d_format_id wined3d_format; enum wined3d_format_id wined3d_format;
IWineD3D *wined3d; struct wined3d *wined3d;
UINT i; UINT i;
TRACE("iface %p, format %s, flags %#x, mode_count %p, desc %p.\n", TRACE("iface %p, format %s, flags %#x, mode_count %p, desc %p.\n",
...@@ -131,8 +131,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -131,8 +131,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
if (!desc) if (!desc)
{ {
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
*mode_count = IWineD3D_GetAdapterModeCount(wined3d, This->adapter->ordinal, wined3d_format); *mode_count = wined3d_get_adapter_mode_count(wined3d, This->adapter->ordinal, wined3d_format);
IWineD3D_Release(wined3d); wined3d_decref(wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
return S_OK; return S_OK;
...@@ -144,11 +144,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -144,11 +144,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
WINED3DDISPLAYMODE mode; WINED3DDISPLAYMODE mode;
HRESULT hr; HRESULT hr;
hr = IWineD3D_EnumAdapterModes(wined3d, This->adapter->ordinal, wined3d_format, i, &mode); hr = wined3d_enum_adapter_modes(wined3d, This->adapter->ordinal, wined3d_format, i, &mode);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("EnumAdapterModes failed, hr %#x.\n", hr); WARN("EnumAdapterModes failed, hr %#x.\n", hr);
IWineD3D_Release(wined3d); wined3d_decref(wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
return hr; return hr;
} }
...@@ -161,7 +161,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -161,7 +161,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
desc[i].ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; /* FIXME */ desc[i].ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; /* FIXME */
desc[i].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */ desc[i].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
} }
IWineD3D_Release(wined3d); wined3d_decref(wined3d);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
return S_OK; return S_OK;
......
...@@ -882,7 +882,7 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) { ...@@ -882,7 +882,7 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
if (This->hardwareCursor) DestroyCursor(This->hardwareCursor); if (This->hardwareCursor) DestroyCursor(This->hardwareCursor);
This->haveHardwareCursor = FALSE; This->haveHardwareCursor = FALSE;
IWineD3D_Release(This->wined3d); wined3d_decref(This->wined3d);
This->wined3d = NULL; This->wined3d = NULL;
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
TRACE("Freed device %p\n", This); TRACE("Freed device %p\n", This);
...@@ -2359,12 +2359,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U ...@@ -2359,12 +2359,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice *iface, IWineD3D **ppD3D) { static HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice *iface, struct wined3d **wined3d)
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; {
*ppD3D = This->wined3d; IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
TRACE("Returning %p.\n", *ppD3D);
IWineD3D_AddRef(*ppD3D); TRACE("iface %p, wined3d %p.\n", iface, wined3d);
return WINED3D_OK;
*wined3d = device->wined3d;
wined3d_incref(*wined3d);
TRACE("Returning %p.\n", *wined3d);
return WINED3D_OK;
} }
static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) { static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) {
...@@ -4596,10 +4602,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UI ...@@ -4596,10 +4602,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UI
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DDeviceImpl_GetDeviceCaps(IWineD3DDevice *iface, WINED3DCAPS* pCaps) { static HRESULT WINAPI IWineD3DDeviceImpl_GetDeviceCaps(IWineD3DDevice *iface, WINED3DCAPS *caps)
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; {
WARN("(%p) : stub, calling idirect3d for now\n", This); IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
return IWineD3D_GetDeviceCaps(This->wined3d, This->adapter->ordinal, This->devType, pCaps);
TRACE("iface %p, caps %p.\n", iface, caps);
return wined3d_get_device_caps(device->wined3d, device->adapter->ordinal, device->devType, caps);
} }
static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) { static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) {
...@@ -6180,17 +6189,16 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE ...@@ -6180,17 +6189,16 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE
if(!pp->BackBufferWidth) return TRUE; if(!pp->BackBufferWidth) return TRUE;
if(!pp->BackBufferHeight) return TRUE; if(!pp->BackBufferHeight) return TRUE;
count = IWineD3D_GetAdapterModeCount(This->wined3d, This->adapter->ordinal, WINED3DFMT_UNKNOWN); count = wined3d_get_adapter_mode_count(This->wined3d, This->adapter->ordinal, WINED3DFMT_UNKNOWN);
for(i = 0; i < count; i++) { for (i = 0; i < count; ++i)
{
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
hr = IWineD3D_EnumAdapterModes(This->wined3d, This->adapter->ordinal, WINED3DFMT_UNKNOWN, i, &m); hr = wined3d_enum_adapter_modes(This->wined3d, This->adapter->ordinal, WINED3DFMT_UNKNOWN, i, &m);
if(FAILED(hr)) { if (FAILED(hr))
ERR("EnumAdapterModes failed\n"); ERR("Failed to enumerate adapter mode.\n");
} if (m.Width == pp->BackBufferWidth && m.Height == pp->BackBufferHeight)
if(m.Width == pp->BackBufferWidth && m.Height == pp->BackBufferHeight) { /* Mode found, it is supported. */
/* Mode found, it is supported */
return TRUE; return TRUE;
}
} }
/* Mode not found -> not supported */ /* Mode not found -> not supported */
return FALSE; return FALSE;
...@@ -6935,7 +6943,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, ...@@ -6935,7 +6943,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
device->lpVtbl = &IWineD3DDevice_Vtbl; device->lpVtbl = &IWineD3DDevice_Vtbl;
device->ref = 1; device->ref = 1;
device->wined3d = (IWineD3D *)wined3d; device->wined3d = (IWineD3D *)wined3d;
IWineD3D_AddRef(device->wined3d); wined3d_incref(device->wined3d);
device->adapter = wined3d->adapter_count ? adapter : NULL; device->adapter = wined3d->adapter_count ? adapter : NULL;
device->device_parent = device_parent; device->device_parent = device_parent;
list_init(&device->resources); list_init(&device->resources);
...@@ -6944,11 +6952,11 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, ...@@ -6944,11 +6952,11 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
device->surface_alignment = wined3d->dxVersion == 7 ? DDRAW_PITCH_ALIGNMENT : D3D8_PITCH_ALIGNMENT; device->surface_alignment = wined3d->dxVersion == 7 ? DDRAW_PITCH_ALIGNMENT : D3D8_PITCH_ALIGNMENT;
/* Get the initial screen setup for ddraw. */ /* Get the initial screen setup for ddraw. */
hr = IWineD3D_GetAdapterDisplayMode((IWineD3D *)wined3d, adapter_idx, &mode); hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &mode);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Failed to get the adapter's display mode, hr %#x.\n", hr); ERR("Failed to get the adapter's display mode, hr %#x.\n", hr);
IWineD3D_Release(device->wined3d); wined3d_decref(device->wined3d);
return hr; return hr;
} }
device->ddraw_width = mode.Width; device->ddraw_width = mode.Width;
...@@ -6986,7 +6994,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, ...@@ -6986,7 +6994,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Failed to compile state table, hr %#x.\n", hr); ERR("Failed to compile state table, hr %#x.\n", hr);
IWineD3D_Release(device->wined3d); wined3d_decref(device->wined3d);
return hr; return hr;
} }
} }
......
...@@ -540,7 +540,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface ...@@ -540,7 +540,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
swapchain->win_handle = window; swapchain->win_handle = window;
swapchain->device_window = window; swapchain->device_window = window;
IWineD3D_GetAdapterDisplayMode(device->wined3d, adapter->ordinal, &mode); wined3d_get_adapter_display_mode(device->wined3d, adapter->ordinal, &mode);
swapchain->orig_width = mode.Width; swapchain->orig_width = mode.Width;
swapchain->orig_height = mode.Height; swapchain->orig_height = mode.Height;
swapchain->orig_fmt = mode.Format; swapchain->orig_fmt = mode.Format;
......
...@@ -142,7 +142,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface ...@@ -142,7 +142,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%p): Calling GetAdapterDisplayMode\n", This, pMode); TRACE("(%p)->(%p): Calling GetAdapterDisplayMode\n", This, pMode);
hr = IWineD3D_GetAdapterDisplayMode(This->device->wined3d, This->device->adapter->ordinal, pMode); hr = wined3d_get_adapter_display_mode(This->device->wined3d, This->device->adapter->ordinal, pMode);
TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate, TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate,
pMode->Format, debug_d3dformat(pMode->Format)); pMode->Format, debug_d3dformat(pMode->Format));
......
@ stdcall WineDirect3DCreate(long ptr)
@ stdcall WineDirect3DCreateClipper() @ stdcall WineDirect3DCreateClipper()
@ stdcall wined3d_mutex_lock() @ stdcall wined3d_mutex_lock()
@ stdcall wined3d_mutex_unlock() @ stdcall wined3d_mutex_unlock()
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long long)
@ cdecl wined3d_check_device_format(ptr long long long long long long long)
@ cdecl wined3d_check_device_format_conversion(ptr long long long long)
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
@ cdecl wined3d_check_device_type(ptr long long long long long)
@ cdecl wined3d_create(long ptr)
@ cdecl wined3d_decref(ptr)
@ cdecl wined3d_enum_adapter_modes(ptr long long long ptr)
@ cdecl wined3d_get_adapter_count(ptr)
@ cdecl wined3d_get_adapter_display_mode(ptr long ptr)
@ cdecl wined3d_get_adapter_identifier(ptr long long ptr)
@ cdecl wined3d_get_adapter_mode_count(ptr long long)
@ cdecl wined3d_get_adapter_monitor(ptr long)
@ cdecl wined3d_get_device_caps(ptr long long ptr)
@ cdecl wined3d_get_parent(ptr)
@ cdecl wined3d_incref(ptr)
@ cdecl wined3d_register_software_device(ptr ptr);
@ cdecl wined3d_device_create(ptr long long ptr long ptr ptr);
@ cdecl wined3d_stateblock_apply(ptr) @ cdecl wined3d_stateblock_apply(ptr)
@ cdecl wined3d_stateblock_capture(ptr) @ cdecl wined3d_stateblock_capture(ptr)
@ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_decref(ptr)
......
...@@ -78,7 +78,7 @@ wined3d_settings_t wined3d_settings = ...@@ -78,7 +78,7 @@ wined3d_settings_t wined3d_settings =
}; };
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent) struct wined3d * CDECL wined3d_create(UINT version, void *parent)
{ {
IWineD3DImpl *object; IWineD3DImpl *object;
HRESULT hr; HRESULT hr;
......
...@@ -59,6 +59,8 @@ typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl; ...@@ -59,6 +59,8 @@ typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl;
struct IWineD3DBaseShaderImpl; struct IWineD3DBaseShaderImpl;
struct IWineD3DBaseTextureImpl; struct IWineD3DBaseTextureImpl;
struct IWineD3DResourceImpl; struct IWineD3DResourceImpl;
typedef struct wined3d IWineD3DImpl;
typedef struct wined3d IWineD3D;
/* Texture format fixups */ /* Texture format fixups */
...@@ -1611,22 +1613,14 @@ const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *frag ...@@ -1611,22 +1613,14 @@ const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *frag
const struct ffp_frag_settings *settings) DECLSPEC_HIDDEN; const struct ffp_frag_settings *settings) DECLSPEC_HIDDEN;
void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc) DECLSPEC_HIDDEN; void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc) DECLSPEC_HIDDEN;
/***************************************************************************** struct wined3d
* IWineD3D implementation structure
*/
typedef struct IWineD3DImpl
{ {
/* IUnknown fields */ LONG ref;
const IWineD3DVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
/* WineD3D Information */
void *parent; void *parent;
UINT dxVersion; UINT dxVersion;
UINT adapter_count; UINT adapter_count;
struct wined3d_adapter adapters[1]; struct wined3d_adapter adapters[1];
} IWineD3DImpl; };
HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN; HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN;
BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
......
...@@ -2110,6 +2110,7 @@ interface IWineD3DSurface; ...@@ -2110,6 +2110,7 @@ interface IWineD3DSurface;
interface IWineD3DVolume; interface IWineD3DVolume;
interface IWineD3DSwapChain; interface IWineD3DSwapChain;
interface IWineD3DDevice; interface IWineD3DDevice;
struct wined3d;
struct wined3d_stateblock; struct wined3d_stateblock;
[ [
...@@ -2189,92 +2190,6 @@ interface IWineD3DBase : IUnknown ...@@ -2189,92 +2190,6 @@ interface IWineD3DBase : IUnknown
[ [
object, object,
local, local,
uuid(108f9c44-6f30-11d9-c687-00046142c14f)
]
interface IWineD3D : IWineD3DBase
{
UINT GetAdapterCount(
);
HRESULT RegisterSoftwareDevice(
[in] void *pInitializeFunction
);
HMONITOR GetAdapterMonitor(
[in] UINT adapter_idx
);
UINT GetAdapterModeCount(
[in] UINT adapter_idx,
[in] enum wined3d_format_id format_id
);
HRESULT EnumAdapterModes(
[in] UINT adapter_idx,
[in] enum wined3d_format_id format_id,
[in] UINT mode_idx,
[out] WINED3DDISPLAYMODE *mode
);
HRESULT GetAdapterDisplayMode(
[in] UINT adapter_idx,
[out] WINED3DDISPLAYMODE *mode
);
HRESULT GetAdapterIdentifier(
[in] UINT adapter_idx,
[in] DWORD flags,
[out] WINED3DADAPTER_IDENTIFIER *identifier
);
HRESULT CheckDeviceMultiSampleType(
[in] UINT adapter_idx,
[in] WINED3DDEVTYPE device_type,
[in] enum wined3d_format_id surface_format_id,
[in] BOOL windowed,
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
[out] DWORD *quality_levels
);
HRESULT CheckDepthStencilMatch(
[in] UINT adapter_idx,
[in] WINED3DDEVTYPE device_type,
[in] enum wined3d_format_id adapter_format_id,
[in] enum wined3d_format_id render_target_format_id,
[in] enum wined3d_format_id depth_stencil_format_id
);
HRESULT CheckDeviceType(
[in] UINT adapter_idx,
[in] WINED3DDEVTYPE device_type,
[in] enum wined3d_format_id display_format_id,
[in] enum wined3d_format_id backbuffer_format_id,
[in] BOOL windowed
);
HRESULT CheckDeviceFormat(
[in] UINT adaper_idx,
[in] WINED3DDEVTYPE device_type,
[in] enum wined3d_format_id adapter_format_id,
[in] DWORD usage,
[in] WINED3DRESOURCETYPE resource_type,
[in] enum wined3d_format_id check_format,
[in] WINED3DSURFTYPE surface_type
);
HRESULT CheckDeviceFormatConversion(
[in] UINT adapter_idx,
[in] WINED3DDEVTYPE device_type,
[in] enum wined3d_format_id source_format_id,
[in] enum wined3d_format_id target_format_id
);
HRESULT GetDeviceCaps(
[in] UINT adapter_idx,
[in] WINED3DDEVTYPE device_type,
[out] WINED3DCAPS *caps
);
HRESULT CreateDevice(
[in] UINT adapter_idx,
[in] WINED3DDEVTYPE device_type,
[in] HWND focus_window,
[in] DWORD behaviour_flags,
[in] IWineD3DDeviceParent *device_parent,
[out] IWineD3DDevice **device
);
}
[
object,
local,
uuid(1f3bfb34-6f30-11d9-c687-00046142c14f) uuid(1f3bfb34-6f30-11d9-c687-00046142c14f)
] ]
interface IWineD3DResource : IWineD3DBase interface IWineD3DResource : IWineD3DBase
...@@ -2926,7 +2841,7 @@ interface IWineD3DDevice : IUnknown ...@@ -2926,7 +2841,7 @@ interface IWineD3DDevice : IUnknown
[out] WINED3DCAPS *caps [out] WINED3DCAPS *caps
); );
HRESULT GetDirect3D( HRESULT GetDirect3D(
[out] IWineD3D** d3d [out] struct wined3d **d3d
); );
HRESULT GetDisplayMode( HRESULT GetDisplayMode(
[in] UINT swapchain_idx, [in] UINT swapchain_idx,
...@@ -3349,11 +3264,48 @@ interface IWineD3DDevice : IUnknown ...@@ -3349,11 +3264,48 @@ interface IWineD3DDevice : IUnknown
); );
} }
IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, void *parent);
IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void); IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void);
void __stdcall wined3d_mutex_lock(void); void __stdcall wined3d_mutex_lock(void);
void __stdcall wined3d_mutex_unlock(void); void __stdcall wined3d_mutex_unlock(void);
HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d, UINT adapter_idx,
WINED3DDEVTYPE device_type, enum wined3d_format_id adapter_format_id,
enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id);
HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx,
WINED3DDEVTYPE device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
WINED3DRESOURCETYPE resource_type, enum wined3d_format_id check_format_id,
WINED3DSURFTYPE surface_type);
HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx,
WINED3DDEVTYPE device_type, enum wined3d_format_id source_format_id,
enum wined3d_format_id target_format_id);
HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx,
WINED3DDEVTYPE device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD *quality_levels);
HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx,
WINED3DDEVTYPE device_type, enum wined3d_format_id display_format_id,
enum wined3d_format_id backbuffer_format_id, BOOL windowed);
struct wined3d * __cdecl wined3d_create(UINT dxVersion, void *parent);
ULONG __cdecl wined3d_decref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_format_id format_id, UINT mode_idx, WINED3DDISPLAYMODE *mode);
UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d);
HRESULT __cdecl wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx,
WINED3DDISPLAYMODE *mode);
HRESULT __cdecl wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx,
DWORD flags, WINED3DADAPTER_IDENTIFIER *identifier);
UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d,
UINT adapter_idx, enum wined3d_format_id format_id);
HMONITOR __cdecl wined3d_get_adapter_monitor(const struct wined3d *wined3d, UINT adapter_idx);
HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx,
WINED3DDEVTYPE device_type, WINED3DCAPS *caps);
void * __cdecl wined3d_get_parent(const struct wined3d *wined3d);
ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function);
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags,
IWineD3DDeviceParent *device_parent, IWineD3DDevice **device);
HRESULT __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock); HRESULT __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock);
HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock); HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
......
...@@ -25,7 +25,7 @@ import "dxgi.idl"; ...@@ -25,7 +25,7 @@ import "dxgi.idl";
] ]
interface IWineDXGIFactory : IDXGIFactory interface IWineDXGIFactory : IDXGIFactory
{ {
struct IWineD3D *get_wined3d(); struct wined3d *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