summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-21 04:35:18 +0000
committeryongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-21 04:35:18 +0000
commitd85c12dfb72ccb6e7447b8d20bfb4c61117a6d13 (patch)
tree2ec3ef0e2b2249221ca53b59ba414af96f3da0a4
parent18c58b9654f2d94e875b168a93fc908c0809363e (diff)
downloadsrc-d85c12dfb72ccb6e7447b8d20bfb4c61117a6d13.tar.gz
Fix the compile errors for mesa on Android
There are some compile errors for mesa when trying to build gpu_tests on Android. They were fixed in the mesa upstream. So this patch combines 3 commits from mesa upstream. They are: 1) Commit eb0ff1a1c0 by chad@chad-versace.us: remove the use of fpu_control.h 2) Commit 504f92c739 by olvaffe@gmail.com: android has no log2f nor ffs 3) Commit 497baf4e4a by ian.d.romanick@intel.com: Use C-style system headers in C++ code to avoid issues with std:: namespace BUG=138226 TEST= Review URL: https://chromiumcodereview.appspot.com/10825442 git-svn-id: svn://svn.chromium.org/chrome/trunk/src/third_party/mesa/MesaLib@152502 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--src/glsl/glsl_parser_extras.h2
-rw-r--r--src/glsl/ir.h4
-rw-r--r--src/mesa/main/compiler.h3
-rw-r--r--src/mesa/main/debug.c11
-rw-r--r--src/mesa/main/imports.c3
-rw-r--r--src/mesa/main/imports.h6
6 files changed, 11 insertions, 18 deletions
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index ddc2138..44e789a 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -31,7 +31,7 @@
#ifdef __cplusplus
-#include <cstdlib>
+#include <stdlib.h>
#include "glsl_symbol_table.h"
enum _mesa_glsl_parser_targets {
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 5aa7c6d..456c43f 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -26,8 +26,8 @@
#ifndef IR_H
#define IR_H
-#include <cstdio>
-#include <cstdlib>
+#include <stdio.h>
+#include <stdlib.h>
extern "C" {
#include <talloc.h>
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 668fd09..907796f 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -45,9 +45,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#if defined(__linux__) && defined(__i386__)
-#include <fpu_control.h>
-#endif
#include <float.h>
#include <stdarg.h>
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 526145a..bcbd837 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -216,17 +216,6 @@ static void add_debug_flags( const char *debug )
if (strstr(debug, "flush"))
MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH;
-#if defined(_FPU_GETCW) && defined(_FPU_SETCW)
- if (strstr(debug, "fpexceptions")) {
- /* raise FP exceptions */
- fpu_control_t mask;
- _FPU_GETCW(mask);
- mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM
- | _FPU_MASK_OM | _FPU_MASK_UM);
- _FPU_SETCW(mask);
- }
-#endif
-
#else
(void) debug;
#endif
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 46e5c93..2cbb09d 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -756,7 +756,8 @@ _mesa_strdup( const char *s )
float
_mesa_strtof( const char *s, char **end )
{
-#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__)
+#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
+ !defined(ANDROID)
static locale_t loc = NULL;
if (!loc) {
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 751f206..3136b1e 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -134,7 +134,13 @@ typedef union { GLfloat f; GLint i; } fi_type;
#define exp2f(f) ((float) exp2(f))
#define floorf(f) ((float) floor(f))
#define logf(f) ((float) log(f))
+
+#if defined(ANDROID)
+#define log2f(f) (logf(f) * (float) (1.0 / M_LN2))
+#else
#define log2f(f) ((float) log2(f))
+#endif
+
#define powf(x,y) ((float) pow(x,y))
#define sinf(f) ((float) sin(f))
#define sinhf(f) ((float) sinh(f))