mesa: Validate the layer selection of an array texture too
[mesa.git] / src / mesa / main / querymatrix.c
index 82b6fe7ab9f69dfe7dab2cbd07fc8af33daa8d54..aee8aef129ea25cf2e50a6fca8ff2a3637b5bc29 100644 (file)
@@ -14,8 +14,9 @@
 
 #include <stdlib.h>
 #include <math.h>
-#include "GLES/gl.h"
-#include "GLES/glext.h"
+#include "glheader.h"
+#include "querymatrix.h"
+#include "main/get.h"
 
 
 /**
@@ -36,9 +37,9 @@
 #define INT_TO_FIXED(x) ((GLfixed) ((x) << 16))
 #define FLOAT_TO_FIXED(x) ((GLfixed) ((x) * 65536.0))
 
-#if defined(WIN32) || defined(_WIN32_WCE)
+#if defined(_MSC_VER)
 /* Oddly, the fpclassify() function doesn't exist in such a form
- * on Windows.  This is an implementation using slightly different
+ * on MSVC.  This is an implementation using slightly different
  * lower-level Windows functions.
  */
 #include <float.h>
@@ -69,15 +70,26 @@ fpclassify(double x)
             return FP_NAN;
     }
 }
-#endif
 
-extern GLbitfield GL_APIENTRY _es_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]);
+#elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
+     defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
+     (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \
+     (defined(__sun) && defined(__GNUC__)) || defined(ANDROID) || defined(__HAIKU__)
+
+/* fpclassify is available. */
+
+#elif !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600
+
+enum {FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL}
+fpclassify(double x)
+{
+   /* XXX do something better someday */
+   return FP_NORMAL;
+}
 
-/* The Mesa functions we'll need */
-extern void GL_APIENTRY _mesa_GetIntegerv(GLenum pname, GLint *params);
-extern void GL_APIENTRY _mesa_GetFloatv(GLenum pname, GLfloat *params);
+#endif
 
-GLbitfield GL_APIENTRY _es_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16])
+GLbitfield GLAPIENTRY _mesa_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16])
 {
     GLfloat matrix[16];
     GLint tmp;
@@ -100,10 +112,6 @@ GLbitfield GL_APIENTRY _es_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[
         {GL_MODELVIEW, GL_MODELVIEW_MATRIX},
         {GL_PROJECTION, GL_PROJECTION_MATRIX},
         {GL_TEXTURE, GL_TEXTURE_MATRIX},
-#if 0
-        /* this doesn't exist in GLES */
-        {GL_COLOR, GL_COLOR_MATRIX},
-#endif
     };
 
     /* Call Mesa to get the current matrix in floating-point form.  First,