fix up mesa's probably bogus framebuffer updates with different read/write fbs
[mesa.git] / src / mesa / main / imports.h
index 2827264a3ac7219d8b2e11366c44fcf80eec2531..9be8014a131388aa70f81c8b79f15d8d9dca6b65 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.2
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
@@ -55,6 +55,15 @@ extern "C" {
 #define NULL 0
 #endif
 
+
+/** gcc -pedantic warns about long string literals, LONGSTRING silences that */
+#if !defined(__GNUC__) || (__GNUC__ < 2) || \
+    ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7))
+# define LONGSTRING
+#else
+# define LONGSTRING __extension__
+#endif
+
 /*@}*/
 
 
@@ -129,10 +138,16 @@ typedef union { GLfloat f; GLint i; } fi_type;
 #define M_E (2.7182818284590452354)
 #endif
 
+#ifndef ONE_DIV_LN2
+#define ONE_DIV_LN2 (1.442695040888963456)
+#endif
 
-/* XXX this is a bit of a hack needed for compilation within XFree86 */
-#ifndef FLT_MIN
-#define FLT_MIN (1.0e-37)
+#ifndef ONE_DIV_SQRT_LN2
+#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
+#endif
+
+#ifndef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
 #endif
 
 /* Degrees to radians conversion: */
@@ -149,7 +164,7 @@ typedef union { GLfloat f; GLint i; } fi_type;
     defined(__hppa__) || defined(hpux) || \
     defined(__mips) || defined(_MIPS_ARCH) || \
     defined(__arm__) || \
-    defined(__sh__) || \
+    defined(__sh__) || defined(__m32r__) || \
     (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
 #define USE_IEEE
 #define IEEE_ONE 0x3f800000
@@ -161,8 +176,6 @@ typedef union { GLfloat f; GLint i; } fi_type;
  ***/
 #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
 #  define SQRTF(X)  _mesa_sqrtf(X)
-#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#  define SQRTF(X)  (float) xf86sqrt((float) (X))
 #else
 #  define SQRTF(X)  (float) sqrt((float) (X))
 #endif
@@ -209,8 +222,6 @@ static INLINE GLfloat LOG2(GLfloat val)
    num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
    return num.f + log_2;
 }
-#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695))
 #else
 /*
  * NOTE: log_base_2(x) = log(x) / log(2)
@@ -281,15 +292,7 @@ static INLINE int GET_FLOAT_BITS( float x )
  *** LDEXPF: multiply value by an integral power of two
  *** FREXPF: extract mantissa and exponent from value
  ***/
-#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#define CEILF(x)   ((GLfloat) xf86ceil(x))
-#define FLOORF(x)  ((GLfloat) xf86floor(x))
-#define FABSF(x)   ((GLfloat) xf86fabs(x))
-#define LOGF(x)    ((GLfloat) xf86log(x))
-#define EXPF(x)    ((GLfloat) xf86exp(x))
-#define LDEXPF(x,y)   ((GLfloat) xf86ldexp(x,y))
-#define FREXPF(x,y)   ((GLfloat) xf86frexp(x,y))
-#elif defined(__gnu_linux__)
+#if defined(__gnu_linux__)
 /* C99 functions */
 #define CEILF(x)   ceilf(x)
 #define FLOORF(x)  floorf(x)
@@ -601,6 +604,17 @@ do {                                                                    \
 #endif
 
 
+/**
+ * Return 1 if this is a little endian machine, 0 if big endian.
+ */
+static INLINE GLboolean
+_mesa_little_endian(void)
+{
+   const GLuint ui = 1; /* intentionally not static */
+   return *((const GLubyte *) &ui);
+}
+
+
 
 /**********************************************************************
  * Functions
@@ -624,6 +638,10 @@ _mesa_align_calloc( size_t bytes, unsigned long alignment );
 extern void
 _mesa_align_free( void *ptr );
 
+extern void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+                    unsigned long alignment);
+
 extern void *
 _mesa_exec_malloc( GLuint size );
 
@@ -672,12 +690,18 @@ _mesa_sqrtf(float x);
 extern float
 _mesa_inv_sqrtf(float x);
 
+extern void
+_mesa_init_sqrt_table(void);
+
 extern double
 _mesa_pow(double x, double y);
 
 extern int
 _mesa_ffs(int i);
 
+extern int
+_mesa_ffsll(long long i);
+
 extern unsigned int
 _mesa_bitcount(unsigned int n);
 
@@ -751,10 +775,6 @@ extern void
 _mesa_exit( int status );
 
 
-extern void
-_mesa_init_default_imports( __GLimports *imports, void *driverCtx );
-
-
 #ifdef __cplusplus
 }
 #endif