mesa: Implement glGet*(GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED).
[mesa.git] / src / mesa / main / es1_conversion.c
index d79358944398f1d79235a32249ae4ae190566913..1dfe8278e715dc4fc806db6a86b729f076f627af 100644 (file)
@@ -1,7 +1,5 @@
-#include <stdbool.h>
-#include "main/mfeatures.h"
 
-#if FEATURE_ES1
+#include <stdbool.h>
 
 #include "api_loopback.h"
 #include "api_exec.h"
 #include "main/drawtex.h"
 #include "vbo/vbo.h"
 
-#ifndef GL_APIENTRY
-#define GL_APIENTRY GLAPIENTRY
-#endif
-
 #include "main/es1_conversion.h"
 
 void GL_APIENTRY
-_es_AlphaFuncx(GLenum func, GLclampx ref)
+_mesa_AlphaFuncx(GLenum func, GLclampx ref)
 {
    _mesa_AlphaFunc(func, (GLclampf) (ref / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
+_mesa_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
 {
    _mesa_ClearColor((GLclampf) (red / 65536.0f),
                     (GLclampf) (green / 65536.0f),
@@ -51,18 +45,18 @@ _es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
 }
 
 void GL_APIENTRY
-_es_ClearDepthx(GLclampx depth)
+_mesa_ClearDepthx(GLclampx depth)
 {
    _mesa_ClearDepthf((GLclampf) (depth / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_ClipPlanef(GLenum plane, const GLfloat *equation)
+_mesa_ClipPlanef(GLenum plane, const GLfloat *equation)
 {
    unsigned int i;
    GLdouble converted_equation[4];
 
-   for (i = 0; i < Elements(converted_equation); i++) {
+   for (i = 0; i < ARRAY_SIZE(converted_equation); i++) {
       converted_equation[i] = (GLdouble) (equation[i]);
    }
 
@@ -70,12 +64,12 @@ _es_ClipPlanef(GLenum plane, const GLfloat *equation)
 }
 
 void GL_APIENTRY
-_es_ClipPlanex(GLenum plane, const GLfixed *equation)
+_mesa_ClipPlanex(GLenum plane, const GLfixed *equation)
 {
    unsigned int i;
    GLdouble converted_equation[4];
 
-   for (i = 0; i < Elements(converted_equation); i++) {
+   for (i = 0; i < ARRAY_SIZE(converted_equation); i++) {
       converted_equation[i] = (GLdouble) (equation[i] / 65536.0);
    }
 
@@ -92,7 +86,7 @@ _es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
 }
 
 void GL_APIENTRY
-_es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+_mesa_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
 {
     _es_Color4f((GLfloat) (red / 65536.0f),
                 (GLfloat) (green / 65536.0f),
@@ -101,17 +95,17 @@ _es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
 }
 
 void GL_APIENTRY
-_es_DepthRangex(GLclampx zNear, GLclampx zFar)
+_mesa_DepthRangex(GLclampx zNear, GLclampx zFar)
 {
     _mesa_DepthRangef((GLclampf) (zNear / 65536.0f),
                       (GLclampf) (zFar / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h)
+_mesa_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h)
 {
 
-    _mesa_DrawTexf((GLfloat) (x / 65536.0f),
+    _mesa_DrawTexfOES((GLfloat) (x / 65536.0f),
                    (GLfloat) (y / 65536.0f),
                    (GLfloat) (z / 65536.0f),
                    (GLfloat) (w / 65536.0f),
@@ -119,20 +113,20 @@ _es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h)
 }
 
 void GL_APIENTRY
-_es_DrawTexxvOES(const GLfixed *coords)
+_mesa_DrawTexxvOES(const GLfixed *coords)
 {
     unsigned int i;
     GLfloat converted_coords[5];
 
-    for (i = 0; i < Elements(converted_coords); i++) {
+    for (i = 0; i < ARRAY_SIZE(converted_coords); i++) {
         converted_coords[i] = (GLfloat) (coords[i] / 65536.0f);
     }
 
-    _mesa_DrawTexfv(converted_coords);
+    _mesa_DrawTexfvOES(converted_coords);
 }
 
 void GL_APIENTRY
-_es_Fogx(GLenum pname, GLfixed param)
+_mesa_Fogx(GLenum pname, GLfixed param)
 {
    if (pname != GL_FOG_MODE) {
       _mesa_Fogf(pname, (GLfloat) (param / 65536.0f));
@@ -143,7 +137,7 @@ _es_Fogx(GLenum pname, GLfixed param)
 }
 
 void GL_APIENTRY
-_es_Fogxv(GLenum pname, const GLfixed *params)
+_mesa_Fogxv(GLenum pname, const GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -183,7 +177,7 @@ _es_Fogxv(GLenum pname, const GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+_mesa_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
              GLfloat zNear, GLfloat zFar)
 {
    _mesa_Frustum((GLdouble) (left),
@@ -195,7 +189,7 @@ _es_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
 }
 
 void GL_APIENTRY
-_es_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
+_mesa_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
              GLfixed zNear, GLfixed zFar)
 {
    _mesa_Frustum((GLdouble) (left / 65536.0),
@@ -207,31 +201,31 @@ _es_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
 }
 
 void GL_APIENTRY
-_es_GetClipPlanef(GLenum plane, GLfloat *equation)
+_mesa_GetClipPlanef(GLenum plane, GLfloat *equation)
 {
    unsigned int i;
    GLdouble converted_equation[4];
 
    _mesa_GetClipPlane(plane, converted_equation);
-   for (i = 0; i < Elements(converted_equation); i++) {
+   for (i = 0; i < ARRAY_SIZE(converted_equation); i++) {
       equation[i] = (GLfloat) (converted_equation[i]);
    }
 }
 
 void GL_APIENTRY
-_es_GetClipPlanex(GLenum plane, GLfixed *equation)
+_mesa_GetClipPlanex(GLenum plane, GLfixed *equation)
 {
    unsigned int i;
    GLdouble converted_equation[4];
 
    _mesa_GetClipPlane(plane, converted_equation);
-   for (i = 0; i < Elements(converted_equation); i++) {
+   for (i = 0; i < ARRAY_SIZE(converted_equation); i++) {
       equation[i] = (GLfixed) (converted_equation[i] * 65536);
    }
 }
 
 void GL_APIENTRY
-_es_GetLightxv(GLenum light, GLenum pname, GLfixed *params)
+_mesa_GetLightxv(GLenum light, GLenum pname, GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -272,7 +266,7 @@ _es_GetLightxv(GLenum light, GLenum pname, GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
+_mesa_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -310,7 +304,7 @@ _es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
+_mesa_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -333,7 +327,24 @@ _es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
       }
       break;
    case GL_TEXTURE_ENV:
-      if (pname != GL_TEXTURE_ENV_COLOR && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA) {
+      if (pname != GL_TEXTURE_ENV_COLOR &&
+          pname != GL_RGB_SCALE &&
+          pname != GL_ALPHA_SCALE &&
+          pname != GL_TEXTURE_ENV_MODE &&
+          pname != GL_COMBINE_RGB &&
+          pname != GL_COMBINE_ALPHA &&
+          pname != GL_SRC0_RGB &&
+          pname != GL_SRC1_RGB &&
+          pname != GL_SRC2_RGB &&
+          pname != GL_SRC0_ALPHA &&
+          pname != GL_SRC1_ALPHA &&
+          pname != GL_SRC2_ALPHA &&
+          pname != GL_OPERAND0_RGB &&
+          pname != GL_OPERAND1_RGB &&
+          pname != GL_OPERAND2_RGB &&
+          pname != GL_OPERAND0_ALPHA &&
+          pname != GL_OPERAND1_ALPHA &&
+          pname != GL_OPERAND2_ALPHA) {
          _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
                      "glGetTexEnvxv(target=0x%x)", target);
          return;
@@ -402,13 +413,13 @@ _check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
 }
 
 void GL_APIENTRY
-_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
+_mesa_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
 {
    _mesa_GetTexGeniv(coord, pname, (GLint *) params);
 }
 
 void GL_APIENTRY
-_es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
+_mesa_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -456,13 +467,13 @@ _es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_LightModelx(GLenum pname, GLfixed param)
+_mesa_LightModelx(GLenum pname, GLfixed param)
 {
    _mesa_LightModelf(pname, (GLfloat) param);
 }
 
 void GL_APIENTRY
-_es_LightModelxv(GLenum pname, const GLfixed *params)
+_mesa_LightModelxv(GLenum pname, const GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -497,13 +508,13 @@ _es_LightModelxv(GLenum pname, const GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_Lightx(GLenum light, GLenum pname, GLfixed param)
+_mesa_Lightx(GLenum light, GLenum pname, GLfixed param)
 {
    _mesa_Lightf(light, pname, (GLfloat) (param / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_Lightxv(GLenum light, GLenum pname, const GLfixed *params)
+_mesa_Lightxv(GLenum light, GLenum pname, const GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -545,18 +556,18 @@ _es_Lightxv(GLenum light, GLenum pname, const GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_LineWidthx(GLfixed width)
+_mesa_LineWidthx(GLfixed width)
 {
    _mesa_LineWidth((GLfloat) (width / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_LoadMatrixx(const GLfixed *m)
+_mesa_LoadMatrixx(const GLfixed *m)
 {
    unsigned int i;
    GLfloat converted_m[16];
 
-   for (i = 0; i < Elements(converted_m); i++) {
+   for (i = 0; i < ARRAY_SIZE(converted_m); i++) {
       converted_m[i] = (GLfloat) (m[i] / 65536.0f);
    }
 
@@ -564,7 +575,7 @@ _es_LoadMatrixx(const GLfixed *m)
 }
 
 void GL_APIENTRY
-_es_Materialx(GLenum face, GLenum pname, GLfixed param)
+_mesa_Materialx(GLenum face, GLenum pname, GLfixed param)
 {
    if (face != GL_FRONT_AND_BACK) {
       _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
@@ -582,7 +593,7 @@ _es_Materialx(GLenum face, GLenum pname, GLfixed param)
 }
 
 void GL_APIENTRY
-_es_Materialxv(GLenum face, GLenum pname, const GLfixed *params)
+_mesa_Materialxv(GLenum face, GLenum pname, const GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -619,12 +630,12 @@ _es_Materialxv(GLenum face, GLenum pname, const GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_MultMatrixx(const GLfixed *m)
+_mesa_MultMatrixx(const GLfixed *m)
 {
    unsigned int i;
    GLfloat converted_m[16];
 
-   for (i = 0; i < Elements(converted_m); i++) {
+   for (i = 0; i < ARRAY_SIZE(converted_m); i++) {
       converted_m[i] = (GLfloat) (m[i] / 65536.0f);
    }
 
@@ -632,7 +643,7 @@ _es_MultMatrixx(const GLfixed *m)
 }
 
 void GL_APIENTRY
-_es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+_mesa_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
 {
    _es_MultiTexCoord4f(texture,
                        (GLfloat) (s / 65536.0f),
@@ -642,7 +653,7 @@ _es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
 }
 
 void GL_APIENTRY
-_es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
+_mesa_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
 {
    _es_Normal3f((GLfloat) (nx / 65536.0f),
                 (GLfloat) (ny / 65536.0f),
@@ -650,7 +661,7 @@ _es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
 }
 
 void GL_APIENTRY
-_es_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+_mesa_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
            GLfloat zNear, GLfloat zFar)
 {
    _mesa_Ortho((GLdouble) (left),
@@ -662,7 +673,7 @@ _es_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
 }
 
 void GL_APIENTRY
-_es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
+_mesa_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
            GLfixed zNear, GLfixed zFar)
 {
    _mesa_Ortho((GLdouble) (left / 65536.0),
@@ -674,24 +685,13 @@ _es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
 }
 
 void GL_APIENTRY
-_es_PointParameterx(GLenum pname, GLfixed param)
+_mesa_PointParameterx(GLenum pname, GLfixed param)
 {
-   switch(pname) {
-   case GL_POINT_SIZE_MIN:
-   case GL_POINT_SIZE_MAX:
-   case GL_POINT_FADE_THRESHOLD_SIZE:
-      break;
-   default:
-      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
-                  "glPointParameterx(pname=0x%x)", pname);
-      return;
-   }
-
    _mesa_PointParameterf(pname, (GLfloat) (param / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_PointParameterxv(GLenum pname, const GLfixed *params)
+_mesa_PointParameterxv(GLenum pname, const GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 3;
@@ -720,20 +720,20 @@ _es_PointParameterxv(GLenum pname, const GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_PointSizex(GLfixed size)
+_mesa_PointSizex(GLfixed size)
 {
    _mesa_PointSize((GLfloat) (size / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_PolygonOffsetx(GLfixed factor, GLfixed units)
+_mesa_PolygonOffsetx(GLfixed factor, GLfixed units)
 {
    _mesa_PolygonOffset((GLfloat) (factor / 65536.0f),
                        (GLfloat) (units / 65536.0f));
 }
 
 void GL_APIENTRY
-_es_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+_mesa_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
 {
    _mesa_Rotatef((GLfloat) (angle / 65536.0f),
                  (GLfloat) (x / 65536.0f),
@@ -742,14 +742,14 @@ _es_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
 }
 
 void GL_APIENTRY
-_es_SampleCoveragex(GLclampx value, GLboolean invert)
+_mesa_SampleCoveragex(GLclampx value, GLboolean invert)
 {
-   _mesa_SampleCoverageARB((GLclampf) (value / 65536.0f),
+   _mesa_SampleCoverage((GLclampf) (value / 65536.0f),
                            invert);
 }
 
 void GL_APIENTRY
-_es_Scalex(GLfixed x, GLfixed y, GLfixed z)
+_mesa_Scalex(GLfixed x, GLfixed y, GLfixed z)
 {
    _mesa_Scalef((GLfloat) (x / 65536.0f),
                 (GLfloat) (y / 65536.0f),
@@ -757,7 +757,7 @@ _es_Scalex(GLfixed x, GLfixed y, GLfixed z)
 }
 
 void GL_APIENTRY
-_es_TexEnvx(GLenum target, GLenum pname, GLfixed param)
+_mesa_TexEnvx(GLenum target, GLenum pname, GLfixed param)
 {
    switch(target) {
    case GL_POINT_SPRITE:
@@ -802,7 +802,7 @@ _es_TexEnvx(GLenum target, GLenum pname, GLfixed param)
 }
 
 void GL_APIENTRY
-_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
+_mesa_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
 {
    switch(target) {
    case GL_POINT_SPRITE:
@@ -843,7 +843,7 @@ _es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
       unsigned int i;
       GLfloat converted_params[4];
 
-      for (i = 0; i < Elements(converted_params); i++) {
+      for (i = 0; i < ARRAY_SIZE(converted_params); i++) {
          converted_params[i] = (GLfloat) (params[i] / 65536.0f);
       }
 
@@ -870,19 +870,19 @@ _check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
 }
 
 void GL_APIENTRY
-_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
+_mesa_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
 {
    _es_TexGenf(coord, pname, (GLfloat) param);
 }
 
 void GL_APIENTRY
-_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
+_mesa_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
 {
    _es_TexGenf(coord, pname, (GLfloat) params[0]);
 }
 
 void GL_APIENTRY
-_es_TexParameterx(GLenum target, GLenum pname, GLfixed param)
+_mesa_TexParameterx(GLenum target, GLenum pname, GLfixed param)
 {
    if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT) {
       _mesa_TexParameterf(target, pname, (GLfloat) (param / 65536.0f));
@@ -892,7 +892,7 @@ _es_TexParameterx(GLenum target, GLenum pname, GLfixed param)
 }
 
 void GL_APIENTRY
-_es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
+_mesa_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
 {
    unsigned int i;
    unsigned int n_params = 4;
@@ -947,11 +947,9 @@ _es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
 }
 
 void GL_APIENTRY
-_es_Translatex(GLfixed x, GLfixed y, GLfixed z)
+_mesa_Translatex(GLfixed x, GLfixed y, GLfixed z)
 {
     _mesa_Translatef((GLfloat) (x / 65536.0f),
                      (GLfloat) (y / 65536.0f),
                      (GLfloat) (z / 65536.0f));
 }
-
-#endif /* FEATURE_ES1 */