es1_conversion.c revision fb4f2d34256aee6b0005b18769a395dd066d3820
175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include <stdbool.h>
275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "main/mfeatures.h"
375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#if FEATURE_ES1
575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "api_loopback.h"
775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "api_exec.h"
875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "blend.h"
975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "clear.h"
1075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "clip.h"
1175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "context.h"
1275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "depth.h"
1375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "fog.h"
1475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "imports.h"
1575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "light.h"
1675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "lines.h"
1775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "matrix.h"
1875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "multisample.h"
1975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "pixelstore.h"
2075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "points.h"
2175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "polygon.h"
2275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "readpix.h"
2375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "texenv.h"
2475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "texgen.h"
2575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "texobj.h"
2675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "texparam.h"
2775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "mtypes.h"
2875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "viewport.h"
2975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "main/drawtex.h"
3075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "vbo/vbo.h"
3175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
3275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#ifndef GL_APIENTRY
3375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#define GL_APIENTRY GLAPIENTRY
3475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#endif
3575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
3675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen#include "main/es1_conversion.h"
3775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
3875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
3921416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata_es_AlphaFuncx(GLenum func, GLclampx ref)
4075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
4175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_AlphaFunc(func, (GLclampf) (ref / 65536.0f));
4275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
4321416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata
4475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
4575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
4675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
4775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_ClearColor((GLclampf) (red / 65536.0f),
4875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                    (GLclampf) (green / 65536.0f),
4975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                    (GLclampf) (blue / 65536.0f),
5021416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata                    (GLclampf) (alpha / 65536.0f));
5175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
5275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
5375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
5421416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata_es_ClearDepthx(GLclampx depth)
5521416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata{
5675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_ClearDepthf((GLclampf) (depth / 65536.0f));
5775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
5875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
5975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
6075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_ClipPlanef(GLenum plane, const GLfloat *equation)
6175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
6275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
6375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLdouble converted_equation[4];
6475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
6575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < Elements(converted_equation); i++) {
6675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_equation[i] = (GLdouble) (equation[i]);
6775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
6875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
6975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_ClipPlane(plane, converted_equation);
7075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
7175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
7275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
7375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_ClipPlanex(GLenum plane, const GLfixed *equation)
7475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
7575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
7675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLdouble converted_equation[4];
7775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
7875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < Elements(converted_equation); i++) {
7975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_equation[i] = (GLdouble) (equation[i] / 65536.0);
8075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
8175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
8275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_ClipPlane(plane, converted_equation);
8375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
8475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
8575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
8675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
8775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
8875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    _es_Color4f((GLfloat) (red / 255.0f),
8975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                (GLfloat) (green / 255.0f),
9075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                (GLfloat) (blue / 255.0f),
9121416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata                (GLfloat) (alpha / 255.0f));
9221416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata}
9321416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata
9421416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granatavoid GL_APIENTRY
9521416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata_es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
9621416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata{
9721416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata    _es_Color4f((GLfloat) (red / 65536.0f),
9821416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata                (GLfloat) (green / 65536.0f),
9921416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata                (GLfloat) (blue / 65536.0f),
10021416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata                (GLfloat) (alpha / 65536.0f));
10121416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata}
10221416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata
10321416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granatavoid GL_APIENTRY
10421416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata_es_DepthRangex(GLclampx zNear, GLclampx zFar)
10521416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata{
10621416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata    _mesa_DepthRangef((GLclampf) (zNear / 65536.0f),
10721416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata                      (GLclampf) (zFar / 65536.0f));
10821416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata}
10921416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata
11021416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granatavoid GL_APIENTRY
11121416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata_es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h)
11275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
11375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
11475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    _mesa_DrawTexf((GLfloat) (x / 65536.0f),
11575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                   (GLfloat) (y / 65536.0f),
11675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                   (GLfloat) (z / 65536.0f),
11775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                   (GLfloat) (w / 65536.0f),
11875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                   (GLfloat) (h / 65536.0f));
11975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
12075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
12175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
12275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_DrawTexxvOES(const GLfixed *coords)
12375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
12475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    unsigned int i;
12575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    GLfloat converted_coords[5];
12675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
12775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    for (i = 0; i < Elements(converted_coords); i++) {
12875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen        converted_coords[i] = (GLfloat) (coords[i] / 65536.0f);
12975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    }
13075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
13175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen    _mesa_DrawTexfv(converted_coords);
13275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
13375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
13475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
13575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Fogx(GLenum pname, GLfixed param)
13675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
13775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (pname != GL_FOG_MODE) {
13875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_Fogf(pname, (GLfloat) (param / 65536.0f));
13975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
14075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_Fogf(pname, (GLfloat) param);
14175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
14275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
14375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
14475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
14575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
14675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Fogxv(GLenum pname, const GLfixed *params)
14775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
14875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
14975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
15075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
15175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   bool convert_params_value = true;
15275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
15375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
15475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_FOG_MODE:
15575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
15675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
15775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
15875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_FOG_COLOR:
15975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
16075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
16175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_FOG_DENSITY:
16275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_FOG_START:
16375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_FOG_END:
16475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
16575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
16675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
16775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
16875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glFogxv(pname=0x%x)", pname);
16975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
17075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
17175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
17275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (convert_params_value) {
17375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
17475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         converted_params[i] = (GLfloat) (params[i] / 65536.0f);
17575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
17675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
17775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
17875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         converted_params[i] = (GLfloat) params[i];
17975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
18075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
18175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
18275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Fogfv(pname, converted_params);
18375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
18475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
18575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
18675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
18775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen             GLfloat zNear, GLfloat zFar)
18875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
18975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Frustum((GLdouble) (left),
19075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (right),
19175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (bottom),
19275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (top),
19375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (zNear),
19475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (zFar));
19575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
19675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
19775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
19875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
19975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen             GLfixed zNear, GLfixed zFar)
20075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
20175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Frustum((GLdouble) (left / 65536.0),
20275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (right / 65536.0),
20375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (bottom / 65536.0),
20475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (top / 65536.0),
20575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (zNear / 65536.0),
20675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLdouble) (zFar / 65536.0));
20775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
20875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
20975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
21075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_GetClipPlanef(GLenum plane, GLfloat *equation)
21175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
21275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
21375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLdouble converted_equation[4];
21475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
21575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_GetClipPlane(plane, converted_equation);
21675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < Elements(converted_equation); i++) {
21775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      equation[i] = (GLfloat) (converted_equation[i]);
21875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
21975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
22075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
22175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
22275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_GetClipPlanex(GLenum plane, GLfixed *equation)
22375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
22475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
22575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLdouble converted_equation[4];
22675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
22775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_GetClipPlane(plane, converted_equation);
22875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < Elements(converted_equation); i++) {
22975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      equation[i] = (GLfixed) (converted_equation[i] * 65536);
23075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
23175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
23275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
23375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
23475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_GetLightxv(GLenum light, GLenum pname, GLfixed *params)
23575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
23675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
23775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
23875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
23975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
24075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (light < GL_LIGHT0 || light > GL_LIGHT7) {
24175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
24275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetLightxv(light=0x%x)", light);
24375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
24475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
24575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
24675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_AMBIENT:
24775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_DIFFUSE:
24875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPECULAR:
24975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POSITION:
25075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
25175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
25275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPOT_DIRECTION:
25375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 3;
25475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
25575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPOT_EXPONENT:
25675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPOT_CUTOFF:
25775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_CONSTANT_ATTENUATION:
25875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_LINEAR_ATTENUATION:
25975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_QUADRATIC_ATTENUATION:
26075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
26175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
26275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
26375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
26475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetLightxv(pname=0x%x)", pname);
26575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
26675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
26775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
26875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_GetLightfv(light, pname, converted_params);
26975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
27075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      params[i] = (GLint) (converted_params[i] * 65536);
27175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
27275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
27375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
27475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
27575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
27675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
27775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
27875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
27975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
28075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
28175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(face) {
28275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_FRONT:
28375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_BACK:
28475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
28575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
28675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
28775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetMaterialxv(face=0x%x)", face);
28875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
28975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
29075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
29175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SHININESS:
29275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
29375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
29475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_AMBIENT:
29575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_DIFFUSE:
29675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPECULAR:
29775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_EMISSION:
29875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
29975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
30075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
30175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
30275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetMaterialxv(pname=0x%x)", pname);
30375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
30475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
30575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
30675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_GetMaterialfv(face, pname, converted_params);
30775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
30875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      params[i] = (GLint) (converted_params[i] * 65536);
30975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
31075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
31175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
31275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
31375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
31475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
31575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
31675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
31775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
31875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   bool convert_params_value = true;
31975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
32075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(target) {
32175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SPRITE:
32275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_COORD_REPLACE) {
32375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
32475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glGetTexEnvxv(target=0x%x)", target);
32575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
32675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
32775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
32875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_FILTER_CONTROL_EXT:
32975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
33075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
33175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glGetTexEnvxv(target=0x%x)", target);
33275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
33375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
33475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
33575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV:
33675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      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) {
33775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
33875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glGetTexEnvxv(target=0x%x)", target);
33975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
34075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
34175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
34275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
34375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
34475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexEnvxv(target=0x%x)", target);
34575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
34675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
34775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
34875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COORD_REPLACE:
34975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
35075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
35175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
35275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_LOD_BIAS_EXT:
35375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
35475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
35575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV_COLOR:
35675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
35775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
35875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_RGB_SCALE:
35975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_ALPHA_SCALE:
36075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
36175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
36275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV_MODE:
36321416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata   case GL_COMBINE_RGB:
36475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COMBINE_ALPHA:
36575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC0_RGB:
36675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC1_RGB:
36775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC2_RGB:
36821416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata   case GL_SRC0_ALPHA:
36975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC1_ALPHA:
37075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC2_ALPHA:
37121416a1d09aad1e25401e54578c3343bb0f0c25fEnrico Granata   case GL_OPERAND0_RGB:
37275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND1_RGB:
37375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND2_RGB:
37475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND0_ALPHA:
37575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND1_ALPHA:
37675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND2_ALPHA:
37775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
37875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
37975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
38075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
38175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
38275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexEnvxv(pname=0x%x)", pname);
38375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
38475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
38575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
38675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_GetTexEnvfv(target, pname, converted_params);
38775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (convert_params_value) {
38875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
38975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         params[i] = (GLint) (converted_params[i] * 65536);
39075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
39175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
39275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
39375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         params[i] = (GLfixed) converted_params[i];
39475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
39575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
39675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
39775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
39875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
39975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
40075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
40175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
40275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 1;
40375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[1];
40475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
40575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(coord) {
40675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_GEN_STR_OES:
40775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
40875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
40975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
41075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexGenivOES(coord=0x%x)", coord);
41175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
41275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
41375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
41475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_GEN_MODE:
41575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
41675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
41775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
41875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
41975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexGenivOES(pname=0x%x)", pname);
42075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
42175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
42275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
42375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_GetTexGenfv(coord, pname, converted_params);
42475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
42575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      params[i] = (GLfloat) converted_params[i];
42675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
42775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
42875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
42975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
43075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
43175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
43275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
43375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 1;
43475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[1];
43575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
43675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(coord) {
43775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_GEN_STR_OES:
43875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
43975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
44075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
44175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexGenxvOES(coord=0x%x)", coord);
44275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
44375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
44475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
44575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_GEN_MODE:
44675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
44775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
44875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
44975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
45075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexGenxvOES(pname=0x%x)", pname);
45175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
45275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
45375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
45475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_GetTexGenfv(coord, pname, converted_params);
45575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
45675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      params[i] = (GLfloat) converted_params[i];
45775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
45875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
45975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
46075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
46175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
46275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
46375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
46475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
46575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
46675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   bool convert_params_value = true;
46775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
46875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(target) {
46975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_2D:
47075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_CUBE_MAP:
47175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_EXTERNAL_OES:
47275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
47375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
47475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
47575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexParameterxv(target=0x%x)", target);
47675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
47775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
47875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
47975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_WRAP_S:
48075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_WRAP_T:
48175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_MIN_FILTER:
48275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_MAG_FILTER:
48375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_GENERATE_MIPMAP:
48475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
48575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
48675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
48775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_CROP_RECT_OES:
48875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
48975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
49075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
49175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
49275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glGetTexParameterxv(pname=0x%x)", pname);
49375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
49475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
49575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
49675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_GetTexParameterfv(target, pname, converted_params);
49775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (convert_params_value) {
49875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
49975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         params[i] = (GLint) (converted_params[i] * 65536);
50075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
50175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
50275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
50375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         params[i] = (GLfixed) converted_params[i];
50475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
50575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
50675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
50775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
50875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
50975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_LightModelx(GLenum pname, GLfixed param)
51075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
51175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
51275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_LIGHT_MODEL_TWO_SIDE:
51375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_TRUE && param != GL_FALSE) {
51475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
51575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glLightModelx(pname=0x%x)", pname);
51675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
51775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
51875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
51975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
52075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
52175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glLightModelx(pname=0x%x)", pname);
52275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
52375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
52475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
52575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_LightModelf(pname, (GLfloat) param);
52675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
52775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
52875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
52975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_LightModelxv(GLenum pname, const GLfixed *params)
53075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
53175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
53275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
53375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
53475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   bool convert_params_value = true;
53575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
53675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
53775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_LIGHT_MODEL_AMBIENT:
53875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
53975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
54075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_LIGHT_MODEL_TWO_SIDE:
54175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
54275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
54375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glLightModelxv(pname=0x%x)", pname);
54475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
54575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
54675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
54775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
54875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
54975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
55075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
55175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glLightModelxv(pname=0x%x)", pname);
55275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
55375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
55475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
55575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (convert_params_value) {
55675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
55775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         converted_params[i] = (GLfloat) (params[i] / 65536.0f);
55875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
55975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
56075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
56175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         converted_params[i] = (GLfloat) params[i];
56275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
56375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
56475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
56575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_LightModelfv(pname, converted_params);
56675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
56775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
56875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
56975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Lightx(GLenum light, GLenum pname, GLfixed param)
57075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
57175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Lightf(light, pname, (GLfloat) (param / 65536.0f));
57275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
57375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
57475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
57575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Lightxv(GLenum light, GLenum pname, const GLfixed *params)
57675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
57775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
57875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
57975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
58075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
58175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (light < GL_LIGHT0 || light > GL_LIGHT7) {
58275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
58375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glLightxv(light=0x%x)", light);
58475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
58575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
58675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
58775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_AMBIENT:
58875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_DIFFUSE:
58975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPECULAR:
59075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POSITION:
59175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
59275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
59375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPOT_DIRECTION:
59475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 3;
59575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
59675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPOT_EXPONENT:
59775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPOT_CUTOFF:
59875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_CONSTANT_ATTENUATION:
59975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_LINEAR_ATTENUATION:
60075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_QUADRATIC_ATTENUATION:
60175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
60275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
60375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
60475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
60575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glLightxv(pname=0x%x)", pname);
60675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
60775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
60875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
60975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
61075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_params[i] = (GLfloat) (params[i] / 65536.0f);
61175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
61275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
61375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Lightfv(light, pname, converted_params);
61475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
61575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
61675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
61775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_LineWidthx(GLfixed width)
61875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
61975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_LineWidth((GLfloat) (width / 65536.0f));
62075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
62175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
62275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
62375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_LoadMatrixx(const GLfixed *m)
62475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
62575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
62675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_m[16];
62775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
62875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < Elements(converted_m); i++) {
62975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_m[i] = (GLfloat) (m[i] / 65536.0f);
63075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
63175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
63275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_LoadMatrixf(converted_m);
63375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
63475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
63575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
63675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Materialx(GLenum face, GLenum pname, GLfixed param)
63775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
63875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (face != GL_FRONT_AND_BACK) {
63975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
64075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glMaterialx(face=0x%x)", face);
64175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
64275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
64375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
64475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (pname != GL_SHININESS) {
64575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
64675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glMaterialx(pname=0x%x)", pname);
64775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
64875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
64975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
65075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_Materialf(face, pname, (GLfloat) (param / 65536.0f));
65175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
65275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
65375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
65475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Materialxv(GLenum face, GLenum pname, const GLfixed *params)
65575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
65675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
65775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
65875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
65975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
66075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (face != GL_FRONT_AND_BACK) {
66175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
66275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glMaterialxv(face=0x%x)", face);
66375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
66475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
66575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
66675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
66775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_AMBIENT:
66875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_DIFFUSE:
66975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_AMBIENT_AND_DIFFUSE:
67075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SPECULAR:
67175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_EMISSION:
67275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
67375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
67475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SHININESS:
67575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
67675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
67775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
67875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
67975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glMaterialxv(pname=0x%x)", pname);
68075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
68175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
68275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
68375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
68475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_params[i] = (GLfloat) (params[i] / 65536.0f);
68575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
68675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
68775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_Materialfv(face, pname, converted_params);
68875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
68975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
69075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
69175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_MultMatrixx(const GLfixed *m)
69275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
69375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
69475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_m[16];
69575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
69675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < Elements(converted_m); i++) {
69775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_m[i] = (GLfloat) (m[i] / 65536.0f);
69875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
69975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
70075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_MultMatrixf(converted_m);
70175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
70275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
70375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
70475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
70575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
70675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_MultiTexCoord4f(texture,
70775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                       (GLfloat) (s / 65536.0f),
70875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                       (GLfloat) (t / 65536.0f),
70975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                       (GLfloat) (r / 65536.0f),
71075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                       (GLfloat) (q / 65536.0f));
71175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
71275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
71375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
71475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
71575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
71675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_Normal3f((GLfloat) (nx / 65536.0f),
71775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                (GLfloat) (ny / 65536.0f),
71875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                (GLfloat) (nz / 65536.0f));
71975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
72075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
72175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
72275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
72375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen           GLfloat zNear, GLfloat zFar)
72475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
72575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Ortho((GLdouble) (left),
72675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (right),
72775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (bottom),
72875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (top),
72975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (zNear),
73075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (zFar));
73175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
73275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
73375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
73475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
73575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen           GLfixed zNear, GLfixed zFar)
73675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
73775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Ortho((GLdouble) (left / 65536.0),
73875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (right / 65536.0),
73975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (bottom / 65536.0),
74075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (top / 65536.0),
74175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (zNear / 65536.0),
74275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen               (GLdouble) (zFar / 65536.0));
74375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
74475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
74575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
74675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_PointParameterx(GLenum pname, GLfixed param)
74775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
74875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
74975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SIZE_MIN:
75075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SIZE_MAX:
75175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_FADE_THRESHOLD_SIZE:
75275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
75375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
75475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
75575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glPointParameterx(pname=0x%x)", pname);
75675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
75775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
75875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
75975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_PointParameterf(pname, (GLfloat) (param / 65536.0f));
76075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
76175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
76275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
76375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_PointParameterxv(GLenum pname, const GLfixed *params)
76475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
76575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
76675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 3;
76775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[3];
76875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
76975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
77075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SIZE_MIN:
77175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SIZE_MAX:
77275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_FADE_THRESHOLD_SIZE:
77375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
77475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
77575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_DISTANCE_ATTENUATION:
77675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 3;
77775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
77875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
77975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
78075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glPointParameterxv(pname=0x%x)", pname);
78175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
78275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
78375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
78475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   for (i = 0; i < n_params; i++) {
78575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_params[i] = (GLfloat) (params[i] / 65536.0f);
78675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
78775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
78875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_PointParameterfv(pname, converted_params);
78975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
79075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
79175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
79275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_PointSizex(GLfixed size)
79375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
79475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_PointSize((GLfloat) (size / 65536.0f));
79575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
79675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
79775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
79875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_PolygonOffsetx(GLfixed factor, GLfixed units)
79975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
80075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_PolygonOffset((GLfloat) (factor / 65536.0f),
80175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                       (GLfloat) (units / 65536.0f));
80275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
80375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
80475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
80575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
80675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
80775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Rotatef((GLfloat) (angle / 65536.0f),
80875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLfloat) (x / 65536.0f),
80975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLfloat) (y / 65536.0f),
81075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                 (GLfloat) (z / 65536.0f));
81175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
81275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
81375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
81475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_SampleCoveragex(GLclampx value, GLboolean invert)
81575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
81675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_SampleCoverageARB((GLclampf) (value / 65536.0f),
81775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                           invert);
81875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
81975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
82075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
82175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_Scalex(GLfixed x, GLfixed y, GLfixed z)
82275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
82375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_Scalef((GLfloat) (x / 65536.0f),
82475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                (GLfloat) (y / 65536.0f),
82575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                (GLfloat) (z / 65536.0f));
82675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
82775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
82875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
82975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_TexEnvx(GLenum target, GLenum pname, GLfixed param)
83075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
83175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_param;
83275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   bool convert_param_value = true;
83375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
83475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(target) {
83575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SPRITE:
83675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_COORD_REPLACE) {
83775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
83875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(target=0x%x)", target);
83975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
84075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
84175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
84275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_FILTER_CONTROL_EXT:
84375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
84475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
84575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(target=0x%x)", target);
84675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
84775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
84875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
84975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV:
85075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && 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 && pname != GL_TEXTURE_ENV_COLOR) {
85175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
85275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(target=0x%x)", target);
85375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
85475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
85575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
85675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
85775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
85875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glTexEnvx(target=0x%x)", target);
85975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
86075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
86175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
86275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COORD_REPLACE:
86375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_TRUE && param != GL_FALSE) {
86475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
86575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(pname=0x%x)", pname);
86675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
86775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
86875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
86975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
87075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_LOD_BIAS_EXT:
87175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
87275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV_MODE:
87375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_REPLACE && param != GL_MODULATE && param != GL_DECAL && param != GL_BLEND && param != GL_ADD && param != GL_COMBINE) {
87475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
87575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(pname=0x%x)", pname);
87675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
87775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
87875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
87975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
88075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COMBINE_RGB:
88175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT && param != GL_DOT3_RGB && param != GL_DOT3_RGBA) {
88275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
88375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(pname=0x%x)", pname);
88475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
88575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
88675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
88775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
88875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COMBINE_ALPHA:
88975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT) {
89075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
89175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(pname=0x%x)", pname);
89275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
89375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
89475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
89575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
89675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_RGB_SCALE:
89775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_ALPHA_SCALE:
89875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
89975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC0_RGB:
90075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC1_RGB:
90175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC2_RGB:
90275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC0_ALPHA:
90375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC1_ALPHA:
90475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC2_ALPHA:
90575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
90675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
90775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND0_RGB:
90875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND1_RGB:
90975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND2_RGB:
91075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_SRC_COLOR && param != GL_ONE_MINUS_SRC_COLOR && param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) {
91175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
91275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(pname=0x%x)", pname);
91375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
91475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
91575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
91675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
91775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND0_ALPHA:
91875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND1_ALPHA:
91975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND2_ALPHA:
92075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) {
92175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
92275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvx(pname=0x%x)", pname);
92375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
92475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
92575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_param_value = false;
92675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
92775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
92875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
92975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glTexEnvx(pname=0x%x)", pname);
93075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
93175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
93275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
93375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (convert_param_value) {
93475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_param = (GLfloat) (param / 65536.0f);
93575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
93675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      converted_param = (GLfloat) param;
93775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
93875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
93975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_TexEnvf(target, pname, converted_param);
94075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
94175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
94275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
94375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
94475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
94575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int i;
94675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   unsigned int n_params = 4;
94775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   GLfloat converted_params[4];
94875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   bool convert_params_value = true;
94975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
95075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(target) {
95175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_POINT_SPRITE:
95275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_COORD_REPLACE) {
95375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
95475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(target=0x%x)", target);
95575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
95675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
95775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
95875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_FILTER_CONTROL_EXT:
95975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
96075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
96175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(target=0x%x)", target);
96275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
96375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
96475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
96575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV:
96675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && 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 && pname != GL_TEXTURE_ENV_COLOR) {
96775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
96875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(target=0x%x)", target);
96975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
97075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
97175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
97275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
97375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
97475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glTexEnvxv(target=0x%x)", target);
97575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
97675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
97775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
97875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COORD_REPLACE:
97975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
98075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
98175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(pname=0x%x)", pname);
98275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
98375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
98475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
98575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
98675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
98775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_LOD_BIAS_EXT:
98875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
98975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
99075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV_MODE:
99175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_DECAL && params[0] != GL_BLEND && params[0] != GL_ADD && params[0] != GL_COMBINE) {
99275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
99375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(pname=0x%x)", pname);
99475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
99575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
99675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
99775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
99875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
99975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COMBINE_RGB:
100075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_ADD && params[0] != GL_ADD_SIGNED && params[0] != GL_INTERPOLATE && params[0] != GL_SUBTRACT && params[0] != GL_DOT3_RGB && params[0] != GL_DOT3_RGBA) {
100175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
100275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(pname=0x%x)", pname);
100375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
100475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
100575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
100675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
100775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
100875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_COMBINE_ALPHA:
100975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_ADD && params[0] != GL_ADD_SIGNED && params[0] != GL_INTERPOLATE && params[0] != GL_SUBTRACT) {
101075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
101175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(pname=0x%x)", pname);
101275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
101375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
101475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
101575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
101675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
101775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_RGB_SCALE:
101875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_ALPHA_SCALE:
101975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
102075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC0_RGB:
102175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC1_RGB:
102275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC2_RGB:
102375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC0_ALPHA:
102475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC1_ALPHA:
102575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_SRC2_ALPHA:
102675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
102775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
102875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
102975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND0_RGB:
103075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND1_RGB:
103175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND2_RGB:
103275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_SRC_COLOR && params[0] != GL_ONE_MINUS_SRC_COLOR && params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) {
103375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
103475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(pname=0x%x)", pname);
103575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
103675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
103775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
103875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
103975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
104075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND0_ALPHA:
104175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND1_ALPHA:
104275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_OPERAND2_ALPHA:
104375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) {
104475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
104575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexEnvxv(pname=0x%x)", pname);
104675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
104775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
104875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      convert_params_value = false;
104975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 1;
105075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
105175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_ENV_COLOR:
105275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      n_params = 4;
105375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
105475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
105575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
105675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glTexEnvxv(pname=0x%x)", pname);
105775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
105875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
105975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
106075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   if (convert_params_value) {
106175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
106275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         converted_params[i] = (GLfloat) (params[i] / 65536.0f);
106375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
106475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   } else {
106575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      for (i = 0; i < n_params; i++) {
106675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         converted_params[i] = (GLfloat) params[i];
106775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
106875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
106975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
107075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _mesa_TexEnvfv(target, pname, converted_params);
107175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
107275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
107375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
107475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_check_TexGeniOES(GLenum coord, GLenum pname, GLint param)
107575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen{
107675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(coord) {
107775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_GEN_STR_OES:
107875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
107975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
108075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
108175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glTexGeniOES(coord=0x%x)", coord);
108275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
108375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
108475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   switch(pname) {
108575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   case GL_TEXTURE_GEN_MODE:
108675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) {
108775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
108875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                     "glTexGeniOES(pname=0x%x)", pname);
108975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen         return;
109075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      }
109175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      break;
109275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   default:
109375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
109475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen                  "glTexGeniOES(pname=0x%x)", pname);
109575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen      return;
109675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   }
109775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
109875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen   _es_TexGenf(coord, pname, (GLfloat) param);
109975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen}
110075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen
110175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenvoid GL_APIENTRY
1102_check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
1103{
1104   unsigned int i;
1105   unsigned int n_params = 1;
1106   GLfloat converted_params[1];
1107
1108   switch(coord) {
1109   case GL_TEXTURE_GEN_STR_OES:
1110      break;
1111   default:
1112      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1113                  "glTexGenivOES(coord=0x%x)", coord);
1114      return;
1115   }
1116   switch(pname) {
1117   case GL_TEXTURE_GEN_MODE:
1118      if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) {
1119         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1120                     "glTexGenivOES(pname=0x%x)", pname);
1121         return;
1122      }
1123      n_params = 1;
1124      break;
1125   default:
1126      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1127                  "glTexGenivOES(pname=0x%x)", pname);
1128      return;
1129   }
1130
1131   for (i = 0; i < n_params; i++) {
1132      converted_params[i] = (GLfloat) params[i];
1133   }
1134
1135   _es_TexGenfv(coord, pname, converted_params);
1136}
1137
1138void GL_APIENTRY
1139_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
1140{
1141   switch(coord) {
1142   case GL_TEXTURE_GEN_STR_OES:
1143      break;
1144   default:
1145      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1146                  "glTexGenxOES(coord=0x%x)", coord);
1147      return;
1148   }
1149   switch(pname) {
1150   case GL_TEXTURE_GEN_MODE:
1151      if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) {
1152         _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1153                     "glTexGenxOES(pname=0x%x)", pname);
1154         return;
1155      }
1156      break;
1157   default:
1158      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1159                  "glTexGenxOES(pname=0x%x)", pname);
1160      return;
1161   }
1162
1163   _es_TexGenf(coord, pname, (GLfloat) param);
1164}
1165
1166void GL_APIENTRY
1167_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
1168{
1169    unsigned int i;
1170    unsigned int n_params = 1;
1171    GLfloat converted_params[1];
1172
1173    switch(coord) {
1174    case GL_TEXTURE_GEN_STR_OES:
1175       break;
1176    default:
1177       _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1178                   "glTexGenxvOES(coord=0x%x)", coord);
1179       return;
1180    }
1181    switch(pname) {
1182    case GL_TEXTURE_GEN_MODE:
1183       if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) {
1184          _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1185                      "glTexGenxvOES(pname=0x%x)", pname);
1186          return;
1187       }
1188       n_params = 1;
1189       break;
1190    default:
1191       _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1192                   "glTexGenxvOES(pname=0x%x)", pname);
1193       return;
1194    }
1195
1196    for (i = 0; i < n_params; i++) {
1197       converted_params[i] = (GLfloat) params[i];
1198    }
1199
1200    _es_TexGenfv(coord, pname, converted_params);
1201}
1202
1203void GL_APIENTRY
1204_es_TexParameterx(GLenum target, GLenum pname, GLfixed param)
1205{
1206   if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT) {
1207      _mesa_TexParameterf(target, pname, (GLfloat) (param / 65536.0f));
1208   } else {
1209      _mesa_TexParameterf(target, pname, (GLfloat) param);
1210   }
1211}
1212
1213void GL_APIENTRY
1214_es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
1215{
1216   unsigned int i;
1217   unsigned int n_params = 4;
1218   GLfloat converted_params[4];
1219   bool convert_params_value = true;
1220
1221   switch(target) {
1222   case GL_TEXTURE_2D:
1223   case GL_TEXTURE_CUBE_MAP:
1224   case GL_TEXTURE_EXTERNAL_OES:
1225      break;
1226   default:
1227      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1228                  "glTexParameterxv(target=0x%x)", target);
1229      return;
1230   }
1231   switch(pname) {
1232   case GL_TEXTURE_WRAP_S:
1233   case GL_TEXTURE_WRAP_T:
1234      convert_params_value = false;
1235      n_params = 1;
1236      break;
1237   case GL_TEXTURE_MIN_FILTER:
1238   case GL_TEXTURE_MAG_FILTER:
1239   case GL_GENERATE_MIPMAP:
1240      convert_params_value = false;
1241      n_params = 1;
1242      break;
1243   case GL_TEXTURE_MAX_ANISOTROPY_EXT:
1244      n_params = 1;
1245      break;
1246   case GL_TEXTURE_CROP_RECT_OES:
1247      n_params = 4;
1248      break;
1249   default:
1250      _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
1251                  "glTexParameterxv(pname=0x%x)", pname);
1252      return;
1253   }
1254
1255   if (convert_params_value) {
1256      for (i = 0; i < n_params; i++) {
1257         converted_params[i] = (GLfloat) (params[i] / 65536.0f);
1258      }
1259   } else {
1260      for (i = 0; i < n_params; i++) {
1261         converted_params[i] = (GLfloat) params[i];
1262      }
1263   }
1264
1265   _mesa_TexParameterfv(target, pname, converted_params);
1266}
1267
1268void GL_APIENTRY
1269_es_Translatex(GLfixed x, GLfixed y, GLfixed z)
1270{
1271    _mesa_Translatef((GLfloat) (x / 65536.0f),
1272                     (GLfloat) (y / 65536.0f),
1273                     (GLfloat) (z / 65536.0f));
1274}
1275
1276#endif /* FEATURE_ES1 */
1277