Mesa (master): st/nine: Change x86 FPU Control word on device creation as on wined3d and windows
David Heidelberg
okias at kemper.freedesktop.org
Fri Feb 6 17:32:52 UTC 2015
Module: Mesa
Branch: master
Commit: 3c4c266f25e93ee5578f5c52fcba5f550ef59d72
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c4c266f25e93ee5578f5c52fcba5f550ef59d72
Author: Tiziano Bacocco <tizbac2 at gmail.com>
Date: Sun Jan 25 12:15:39 2015 +0100
st/nine: Change x86 FPU Control word on device creation as on wined3d and windows
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 78e148b..96061e0 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 */
More information about the mesa-commit
mailing list