Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / gallium / include / pipe / p_util.h
index 3d8ad48d4fa79465271cdf1c7109ff5628e8728d..7dcdd282875ac9cc503083003c04ca7d64b6b398 100644 (file)
@@ -31,6 +31,7 @@
 #include "p_config.h"
 #include "p_compiler.h"
 #include "p_debug.h"
+#include "p_format.h"
 #include "p_pointer.h"
 #include <math.h>
 #include <stdarg.h>
@@ -140,8 +141,6 @@ REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
 
 #define CALLOC_STRUCT(T)   (struct T *) CALLOC(1, sizeof(struct T))
 
-#define GETENV( X ) debug_get_option( X, NULL )
-
 
 /**
  * Return memory on given byte alignment
@@ -207,7 +206,6 @@ mem_dup(const void *src, uint size)
 #ifndef Elements
 #define Elements(x) (sizeof(x)/sizeof((x)[0]))
 #endif
-
 #define Offset(TYPE, MEMBER) ((unsigned)&(((TYPE *)NULL)->MEMBER))
 
 /**
@@ -227,7 +225,7 @@ static INLINE int align_int(int x, int align)
 
 
 
-#if defined(__MSC__) && defined(__WIN32__)
+#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
 static INLINE unsigned ffs( unsigned u )
 {
    unsigned i;
@@ -344,14 +342,14 @@ static INLINE int ifloor(float f)
 }
 
 
-#if defined(__GNUC__) && defined(__i386__
+#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86
 static INLINE int iround(float f)
 {
    int r;
    __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
    return r;
 }
-#elif defined(__MSC__) && defined(__WIN32__)
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
 static INLINE int iround(float f)
 {
    int r;
@@ -404,17 +402,20 @@ static INLINE int align(int value, int alignment)
 
 /* util/p_util.c
  */
-extern void pipe_copy_rect(ubyte * dst, unsigned cpp, unsigned dst_pitch,
-                           unsigned dst_x, unsigned dst_y, unsigned width,
-                           unsigned height, const ubyte * src,
-                           int src_pitch, unsigned src_x, int src_y);
-
+extern void pipe_copy_rect(ubyte * dst, const struct pipe_format_block *block,
+                           unsigned dst_stride, unsigned dst_x, unsigned dst_y,
+                           unsigned width, unsigned height, const ubyte * src,
+                           int src_stride, unsigned src_x, int src_y);
 
+extern void
+pipe_fill_rect(ubyte * dst, const struct pipe_format_block *block,
+               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
+               unsigned width, unsigned height, uint32_t value);
 
-#ifdef WIN32
-
-#if !defined(_INC_MATH) || !defined(__cplusplus)
 
+#if defined(_MSC_VER) 
+#if _MSC_VER < 1400 && !defined(__cplusplus) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
 static INLINE float cosf( float f ) 
 {
    return (float) cos( (double) f );
@@ -454,8 +455,15 @@ static INLINE float logf( float f )
 {
    return (float) log( (double) f );
 }
-#endif  /* _INC_MATH */
+
+#else
+/* Work-around an extra semi-colon in VS 2005 logf definition */
+#ifdef logf
+#undef logf
+#define logf(x) ((float)log((double)(x)))
+#endif /* logf */
 #endif
+#endif /* _MSC_VER */
 
 
 #ifdef __cplusplus