ddraw: Implement FPU mode fixup in d3d7 device.

As documented in DirectX7 SDK, d3d7 devices set FPU mode (control word) on every 
call and restore it back to original state before returning, if created in 
DDSCL_FPUPRESERVE cooperative mode. This allows games to work with FPU in a 
possibly incompatible mode and avoid resetting it all the time.
This commit is contained in:
Alexander Dorofeyev 2008-06-20 02:49:46 +03:00 committed by Alexandre Julliard
parent a850cafe6d
commit cb5e06c944
4 changed files with 1135 additions and 85 deletions

View File

@ -524,8 +524,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
WARN("(%p) Unhandled flag DDSCL_ALLOWMODEX, harmless\n", This);
if(cooplevel & DDSCL_FPUSETUP)
WARN("(%p) Unhandled flag DDSCL_FPUSETUP, harmless\n", This);
if(cooplevel & DDSCL_FPUPRESERVE)
WARN("(%p) Unhandled flag DDSCL_FPUPRESERVE, harmless\n", This);
/* Store the cooperative_level */
This->cooperative_level |= cooplevel;

View File

@ -358,7 +358,8 @@ struct IDirect3DDeviceImpl
};
/* Vtables in various versions */
const IDirect3DDevice7Vtbl IDirect3DDevice7_Vtbl;
const IDirect3DDevice7Vtbl IDirect3DDevice7_FPUSetup_Vtbl;
const IDirect3DDevice7Vtbl IDirect3DDevice7_FPUPreserve_Vtbl;
const IDirect3DDevice3Vtbl IDirect3DDevice3_Vtbl;
const IDirect3DDevice2Vtbl IDirect3DDevice2_Vtbl;
const IDirect3DDeviceVtbl IDirect3DDevice1_Vtbl;

File diff suppressed because it is too large Load Diff

View File

@ -805,7 +805,11 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
return DDERR_OUTOFMEMORY;
}
ICOM_INIT_INTERFACE(object, IDirect3DDevice7, IDirect3DDevice7_Vtbl);
if (This->cooperative_level & DDSCL_FPUPRESERVE)
ICOM_INIT_INTERFACE(object, IDirect3DDevice7, IDirect3DDevice7_FPUPreserve_Vtbl);
else
ICOM_INIT_INTERFACE(object, IDirect3DDevice7, IDirect3DDevice7_FPUSetup_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DDevice3, IDirect3DDevice3_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DDevice2, IDirect3DDevice2_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DDevice, IDirect3DDevice1_Vtbl);