From: Tiziano Bacocco <tizb...@gmail.com>

Signed-off-by: Tiziano Bacocco <tizb...@gmail.com>
---
 src/gallium/state_trackers/nine/device9.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 1a776a7..4ef02bb 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -53,6 +53,18 @@
 
 #define DBG_CHANNEL DBG_DEVICE
 
+static void nine_setup_fpu(void)
+{
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+    WORD cw;
+    __asm__ volatile ("fnstcw %0" : "=m" (cw));
+    cw = (cw & ~0xf3f) | 0x3f;
+    __asm__ volatile ("fldcw %0" : : "m" (cw));
+#else
+    WARN_ONCE("FPU setup not supported on non-x86 platforms\n");
+#endif
+}
+
 static void
 NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset )
 {
@@ -168,6 +180,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
     IDirect3D9_AddRef(This->d3d9);
     ID3DPresentGroup_AddRef(This->present);
 
+    if (!(This->params.BehaviorFlags & D3DCREATE_FPU_PRESERVE))
+        nine_setup_fpu();
+
     This->pipe = This->screen->context_create(This->screen, NULL);
     if (!This->pipe) { return E_OUTOFMEMORY; } /* guess */
 
-- 
2.1.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to