Re: [Mesa-dev] [PATCH] mesa: Drop USE_IEEE define.

2014-08-08 Thread Jonathan Gray
On Wed, Aug 06, 2014 at 04:54:38PM -0700, Matt Turner wrote:
> I think OpenVMS was the only platform that Mesa ran on that used a
> non-IEEE representation for floats. We removed OpenVMS support a while
> back, and this should alleviate the need to continue updating the
> this-platform-uses-IEEE list.

OpenVMS isn't the only thing that runs on a vax, this will likely
break the software rasteriser on OpenBSD and NetBSD on vax.

It seems Mesa isn't currently built on OpenBSD/vax but is
on NetBSD.  Though NetBSD are stuck with Mesa 7.x.x due to
the DRM/KMS situation.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Drop USE_IEEE define.

2014-08-07 Thread Matt Turner
On Thu, Aug 7, 2014 at 5:35 AM, Brian Paul  wrote:
> On 08/06/2014 05:54 PM, Matt Turner wrote:
>>
>> I think OpenVMS was the only platform that Mesa ran on that used a
>> non-IEEE representation for floats. We removed OpenVMS support a while
>> back, and this should alleviate the need to continue updating the
>> this-platform-uses-IEEE list.
>>
>> The one bit of this patch that needs review is the IS_INF_OR_NAN,
>> because I'm not sure if MSVC supports isfinite.
>>
>> Bugzilla:
>> https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D82268&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=qpFrFaVk9Le%2Fvop6RCMCcKv5D0yZLSihxGjqPEOSVqA%3D%0A&s=347af2b199daf0bee356bc0d21fbc6d1ffb166984c7efb70271c6faf3fb52fcb
>>
>> ---
>>   src/mesa/main/compiler.h| 18 --
>>   src/mesa/main/imports.h | 27 +++
>>   src/mesa/main/macros.h  |  2 +-
>>   src/mesa/program/prog_execute.c |  5 -
>>   4 files changed, 4 insertions(+), 48 deletions(-)
>>
>
> Looks OK to me.  The MSVC build seems fine with this patch.
>
> Reviewed-by: Brian Paul 

Thanks Brian!
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Drop USE_IEEE define.

2014-08-07 Thread Brian Paul

On 08/06/2014 05:54 PM, Matt Turner wrote:

I think OpenVMS was the only platform that Mesa ran on that used a
non-IEEE representation for floats. We removed OpenVMS support a while
back, and this should alleviate the need to continue updating the
this-platform-uses-IEEE list.

The one bit of this patch that needs review is the IS_INF_OR_NAN,
because I'm not sure if MSVC supports isfinite.

Bugzilla: 
https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D82268&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=qpFrFaVk9Le%2Fvop6RCMCcKv5D0yZLSihxGjqPEOSVqA%3D%0A&s=347af2b199daf0bee356bc0d21fbc6d1ffb166984c7efb70271c6faf3fb52fcb
---
  src/mesa/main/compiler.h| 18 --
  src/mesa/main/imports.h | 27 +++
  src/mesa/main/macros.h  |  2 +-
  src/mesa/program/prog_execute.c |  5 -
  4 files changed, 4 insertions(+), 48 deletions(-)



Looks OK to me.  The MSVC build seems fine with this patch.

Reviewed-by: Brian Paul 


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Drop USE_IEEE define.

2014-08-06 Thread Matt Turner
I think OpenVMS was the only platform that Mesa ran on that used a
non-IEEE representation for floats. We removed OpenVMS support a while
back, and this should alleviate the need to continue updating the
this-platform-uses-IEEE list.

The one bit of this patch that needs review is the IS_INF_OR_NAN,
because I'm not sure if MSVC supports isfinite.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82268
---
 src/mesa/main/compiler.h| 18 --
 src/mesa/main/imports.h | 27 +++
 src/mesa/main/macros.h  |  2 +-
 src/mesa/program/prog_execute.c |  5 -
 4 files changed, 4 insertions(+), 48 deletions(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index ae7d343..3516022 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -265,25 +265,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 #define FLT_MAX_EXP 128
 #endif
 
-
-/**
- * USE_IEEE: Determine if we're using IEEE floating point
- */
-#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
-defined(__s390__) || defined(__s390x__) || defined(__powerpc__) || \
-defined(__x86_64__) || \
-defined(__m68k__) || \
-defined(ia64) || defined(__ia64__) || \
-defined(__hppa__) || defined(hpux) || \
-defined(__mips) || defined(_MIPS_ARCH) || \
-defined(__arm__) || defined(__aarch64__) || \
-defined(__sh__) || defined(__m32r__) || \
-(defined(__sun) && defined(_IEEE_754)) || \
-defined(__alpha__)
-#define USE_IEEE
 #define IEEE_ONE 0x3f80
-#endif
-
 
 /**
  * START/END_FAST_MATH macros:
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 023ef2e..59fd19c 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -164,7 +164,6 @@ INV_SQRTF(float x)
  ***/
 static inline GLfloat LOG2(GLfloat x)
 {
-#ifdef USE_IEEE
 #if 0
/* This is pretty fast, but not accurate enough (only 2 fractional bits).
 * Based on code from http://www.stereopsis.com/log2.html
@@ -186,13 +185,6 @@ static inline GLfloat LOG2(GLfloat x)
num.i += 127 << 23;
num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
return num.f + log_2;
-#else
-   /*
-* NOTE: log_base_2(x) = log(x) / log(2)
-* NOTE: 1.442695 = 1/log(2).
-*/
-   return (GLfloat) (log(x) * 1.442695F);
-#endif
 }
 
 
@@ -200,14 +192,7 @@ static inline GLfloat LOG2(GLfloat x)
 /***
  *** IS_INF_OR_NAN: test if float is infinite or NaN
  ***/
-#ifdef USE_IEEE
-static inline int IS_INF_OR_NAN( float x )
-{
-   fi_type tmp;
-   tmp.f = x;
-   return !(int)((unsigned int)((tmp.i & 0x7fff)-0x7f80) >> 31);
-}
-#elif defined(isfinite)
+#if defined(isfinite)
 #define IS_INF_OR_NAN(x)(!isfinite(x))
 #elif defined(finite)
 #define IS_INF_OR_NAN(x)(!finite(x))
@@ -321,7 +306,7 @@ static inline int IFLOOR(float f)
__asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
__asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
return (ai - bi) >> 1;
-#elif defined(USE_IEEE)
+#else
int ai, bi;
double af, bf;
fi_type u;
@@ -330,9 +315,6 @@ static inline int IFLOOR(float f)
u.f = (float) af;  ai = u.i;
u.f = (float) bf;  bi = u.i;
return (ai - bi) >> 1;
-#else
-   int i = IROUND(f);
-   return (i > f) ? i - 1 : i;
 #endif
 }
 
@@ -356,7 +338,7 @@ static inline int ICEIL(float f)
__asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
__asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
return (ai - bi + 1) >> 1;
-#elif defined(USE_IEEE)
+#else
int ai, bi;
double af, bf;
fi_type u;
@@ -365,9 +347,6 @@ static inline int ICEIL(float f)
u.f = (float) af; ai = u.i;
u.f = (float) bf; bi = u.i;
return (ai - bi + 1) >> 1;
-#else
-   int i = IROUND(f);
-   return (i < f) ? i + 1 : i;
 #endif
 }
 
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 954df3c..0ba658a 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -140,7 +140,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
  *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255]
  *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255]
  ***/
-#if defined(USE_IEEE) && !defined(DEBUG)
+#ifndef DEBUG
 /* This function/macro is sensitive to precision.  Test very carefully
  * if you change it!
  */
diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
index 115525e..fcc9ed5 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -52,7 +52,6 @@
 /**
  * Set x to positive or negative infinity.
  */
-#if defined(USE_IEEE) || defined(_WIN32)
 #define SET_POS_INFINITY(x)  \
do {  \
  fi_type fi; \
@@ -65,10 +64,6 @@
  fi.i = 0xFF80;  \
  x = fi.f;   \
} while (0)
-#else
-#define SET_POS_INFINITY(x)  x = (GLfloat) HUGE_VAL
-#define SET_NEG_INF