[Mesa-dev] [PATCH 08/16] st/nine: Change x86 FPU Control word on device creation as on wined3d and windows
Axel Davy
axel.davy at ens.fr
Fri Apr 24 13:09:37 PDT 2015
From: Tiziano Bacocco <tizbac2 at gmail.com>
Signed-off-by: Tiziano Bacocco <tizbac2 at 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
More information about the mesa-dev
mailing list