Commit cb5e06c9 authored by Alexander Dorofeyev's avatar Alexander Dorofeyev Committed by Alexandre Julliard

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.
parent a850cafe
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
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