summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2006-02-27 14:41:41 +0000
committerMichal Krol <mjkrol@gmail.org>2006-02-27 14:41:41 +0000
commit9ac9605de156408580b81ba7e2780bd3f5372c6d (patch)
treee0dfe1127ed3b7f9674c450dea59b921e84c4dfc /src/mesa/main
parentc56f2c49a51e7ad1106c46e3e86dfe2756ef87c4 (diff)
More GLSL code:
- add x86 code generator; - add full support for uniforms in ARB_shader_objects; - add assembly instruction: global_addr; - reorganize #includes; - built-in uniforms accessed by index, rather than by name; - add some entries to x86sse rtasm; - add configurations to VC6 projects: 'Release x86' and 'Debug x86'; - #define SLANG_X86 active only on VC6 x86 builds; - introduce code export table for a shader; - remove GNU license from the noise library;
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/imports.c11
-rw-r--r--src/mesa/main/imports.h29
2 files changed, 38 insertions, 2 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index a49c711a25..96b89dd960 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -295,6 +295,17 @@ _mesa_sin(double a)
#else
return sin(a);
#endif
+}
+
+/** Single precision wrapper around either sin() or xf86sin() */
+float
+_mesa_sinf(float a)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return (float) xf86sin((double) a);
+#else
+ return (float) sin((double) a);
+#endif
}
/** Wrapper around either cos() or xf86cos() */
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index c698312944..425ef825d1 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -572,7 +572,29 @@ do { \
_watcom_start_fast_math(&x,&mask); \
} while (0)
#endif
-#define END_FAST_MATH(x) _watcom_end_fast_math(&x)
+#define END_FAST_MATH(x) _watcom_end_fast_math(&x)
+
+#elif defined(_MSC_VER) && defined(_M_IX86)
+#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */
+#define FAST_X86_FPU 0x003f /* See GCC comments above */
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x) do {\
+ static GLuint mask = DEFAULT_X86_FPU;\
+ __asm fnstcw word ptr [x]\
+ __asm fldcw word ptr [mask]\
+} while(0)
+#else
+#define START_FAST_MATH(x) do {\
+ static GLuint mask = FAST_X86_FPU;\
+ __asm fnstcw word ptr [x]\
+ __asm fldcw word ptr [mask]\
+} while(0)
+#endif
+#define END_FAST_MATH(x) do {\
+ __asm fnclex\
+ __asm fldcw word ptr [x]\
+} while(0)
+
#else
#define START_FAST_MATH(x) x = 0
#define END_FAST_MATH(x) (void)(x)
@@ -627,7 +649,10 @@ extern int
_mesa_memcmp( const void *s1, const void *s2, size_t n );
extern double
-_mesa_sin(double a);
+_mesa_sin(double a);
+
+extern float
+_mesa_sinf(float a);
extern double
_mesa_cos(double a);