Commit 55f3c576 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove the effetively unused "state" field from the device.

parent 135e6cea
......@@ -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) {
......
......@@ -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) {
......
......@@ -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
*/
TRACE("iface %p.\n", iface);
hr = IWineD3DDevice_TestCooperativeLevel(This->wineD3DDevice);
/* 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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -3076,8 +3076,6 @@ interface IWineD3DDevice : IWineD3DBase
BOOL ShowCursor(
[in] BOOL show
);
HRESULT TestCooperativeLevel(
);
HRESULT SetClipPlane(
[in] DWORD plane_idx,
[in] const float *plane
......
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