[PATCH 5/5] wined3d: Remove the effetively unused "state" field from the device.
Henri Verbeet
hverbeet at codeweavers.com
Wed Nov 18 03:45:54 CST 2009
---
dlls/d3d8/device.c | 12 ++-------
dlls/d3d9/device.c | 17 ++++++--------
dlls/ddraw/ddraw.c | 47 +---------------------------------------
dlls/wined3d/device.c | 32 ---------------------------
dlls/wined3d/wined3d_private.h | 3 --
include/wine/wined3d.idl | 2 -
6 files changed, 11 insertions(+), 102 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index eb26d73..450a5ff 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -334,17 +334,11 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
}
/* IDirect3DDevice Interface follow: */
-static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(LPDIRECT3DDEVICE8 iface) {
- IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
- HRESULT hr;
-
+static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(IDirect3DDevice8 *iface)
+{
TRACE("iface %p.\n", iface);
- wined3d_mutex_lock();
- hr = IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice);
- wined3d_mutex_unlock();
-
- return hr;
+ return D3D_OK;
}
static UINT WINAPI IDirect3DDevice8Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE8 iface) {
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 1151d99..dfb6b26 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -280,22 +280,19 @@ static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEV
}
/* IDirect3DDevice Interface follow: */
-static HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE9EX iface) {
+static HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(IDirect3DDevice9Ex *iface)
+{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
- HRESULT hr;
TRACE("iface %p.\n", iface);
- wined3d_mutex_lock();
- hr = IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice);
- wined3d_mutex_unlock();
-
- if(hr == WINED3D_OK && This->notreset) {
- TRACE("D3D9 Device is marked not reset\n");
- hr = D3DERR_DEVICENOTRESET;
+ if (This->notreset)
+ {
+ TRACE("D3D9 device is marked not reset.\n");
+ return D3DERR_DEVICENOTRESET;
}
- return hr;
+ return D3D_OK;
}
static UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9EX iface) {
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 351ebda..aeaffbd 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1187,53 +1187,8 @@ static HRESULT WINAPI IDirectDrawImpl_GetScanLine(IDirectDraw7 *iface, DWORD *Sc
static HRESULT WINAPI
IDirectDrawImpl_TestCooperativeLevel(IDirectDraw7 *iface)
{
- IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
- HRESULT hr;
- TRACE("(%p)\n", This);
-
- EnterCriticalSection(&ddraw_cs);
- /* Description from MSDN:
- * For fullscreen apps return DDERR_NOEXCLUSIVEMODE if the user switched
- * away from the app with e.g. alt-tab. Windowed apps receive
- * DDERR_EXCLUSIVEMODEALREADYSET if another application created a
- * DirectDraw object in exclusive mode. DDERR_WRONGMODE is returned,
- * when the video mode has changed
- */
-
- hr = IWineD3DDevice_TestCooperativeLevel(This->wineD3DDevice);
+ TRACE("iface %p.\n", iface);
- /* Fix the result value. These values are mapped from their
- * d3d9 counterpart.
- */
- switch(hr)
- {
- case WINED3DERR_DEVICELOST:
- if(This->cooperative_level & DDSCL_EXCLUSIVE)
- {
- LeaveCriticalSection(&ddraw_cs);
- return DDERR_NOEXCLUSIVEMODE;
- }
- else
- {
- LeaveCriticalSection(&ddraw_cs);
- return DDERR_EXCLUSIVEMODEALREADYSET;
- }
-
- case WINED3DERR_DEVICENOTRESET:
- LeaveCriticalSection(&ddraw_cs);
- return DD_OK;
-
- case WINED3D_OK:
- LeaveCriticalSection(&ddraw_cs);
- return DD_OK;
-
- case WINED3DERR_DRIVERINTERNALERROR:
- default:
- ERR("(%p) Unexpected return value %08x from wineD3D, "
- " returning DD_OK\n", This, hr);
- }
-
- LeaveCriticalSection(&ddraw_cs);
return DD_OK;
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c48424e..136f396 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -6494,31 +6494,6 @@ static BOOL WINAPI IWineD3DDeviceImpl_ShowCursor(IWineD3DDevice* iface, BOO
return oldVisible;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_TestCooperativeLevel(IWineD3DDevice* iface) {
- IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
- IWineD3DResourceImpl *resource;
- TRACE("(%p) : state (%u)\n", This, This->state);
-
- /* TODO: Implement wrapping of the WndProc so that mimimize and maximize can be monitored and the states adjusted. */
- switch (This->state) {
- case WINED3D_OK:
- return WINED3D_OK;
- case WINED3DERR_DEVICELOST:
- {
- LIST_FOR_EACH_ENTRY(resource, &This->resources, IWineD3DResourceImpl, resource.resource_list_entry) {
- if (resource->resource.pool == WINED3DPOOL_DEFAULT)
- return WINED3DERR_DEVICENOTRESET;
- }
- return WINED3DERR_DEVICELOST;
- }
- case WINED3DERR_DRIVERINTERNALERROR:
- return WINED3DERR_DRIVERINTERNALERROR;
- }
-
- /* Unknown state */
- return WINED3DERR_DRIVERINTERNALERROR;
-}
-
static HRESULT WINAPI evict_managed_resource(IWineD3DResource *resource, void *data) {
TRACE("checking resource %p for eviction\n", resource);
if(((IWineD3DResourceImpl *) resource)->resource.pool == WINED3DPOOL_MANAGED) {
@@ -7154,7 +7129,6 @@ static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_SetCursorProperties,
IWineD3DDeviceImpl_SetCursorPosition,
IWineD3DDeviceImpl_ShowCursor,
- IWineD3DDeviceImpl_TestCooperativeLevel,
/*** Getters and setters **/
IWineD3DDeviceImpl_SetClipPlane,
IWineD3DDeviceImpl_GetClipPlane,
@@ -7278,9 +7252,6 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
device->surface_alignment = wined3d->dxVersion == 7 ? DDRAW_PITCH_ALIGNMENT : D3D8_PITCH_ALIGNMENT;
device->posFixup[0] = 1.0f; /* This is needed to get the x coord unmodified through a MAD. */
- /* Set the state up as invalid until the device is fully created. */
- device->state = WINED3DERR_DRIVERINTERNALERROR;
-
/* Get the initial screen setup for ddraw. */
hr = IWineD3D_GetAdapterDisplayMode((IWineD3D *)wined3d, adapter_idx, &mode);
if (FAILED(hr))
@@ -7330,9 +7301,6 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
device->blitter = select_blit_implementation(adapter, device_type);
- /* Set the state of the device to valid. */
- device->state = WINED3D_OK;
-
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9299a6e..12685d2 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1555,9 +1555,6 @@ struct IWineD3DDeviceImpl
/* Textures for when no other textures are mapped */
UINT dummyTextureName[MAX_TEXTURES];
- /* Device state management */
- HRESULT state;
-
/* DirectDraw stuff */
DWORD ddraw_width, ddraw_height;
WINED3DFORMAT ddraw_format;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 2534fbb..176e602 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -3076,8 +3076,6 @@ interface IWineD3DDevice : IWineD3DBase
BOOL ShowCursor(
[in] BOOL show
);
- HRESULT TestCooperativeLevel(
- );
HRESULT SetClipPlane(
[in] DWORD plane_idx,
[in] const float *plane
--
1.6.4.4
More information about the wine-patches
mailing list