summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/APIspec.xml13
-rw-r--r--src/mesa/main/es1_conversion.c110
-rw-r--r--src/mesa/main/texgen.c44
3 files changed, 39 insertions, 128 deletions
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 5c265020e8e..02e2c9fa305 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -342,19 +342,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="coord" category="OES_texture_cube_map">
- <value name="GL_TEXTURE_GEN_STR_OES"/>
- </desc>
-
- <desc name="pname" category="OES_texture_cube_map">
- <value name="GL_TEXTURE_GEN_MODE_OES"/>
-
- <desc name="param">
- <value name="GL_NORMAL_MAP_OES"/>
- <value name="GL_REFLECTION_MAP_OES"/>
- </desc>
- </desc>
</template>
<template name="Clear">
diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c
index a71becc1066..6edc97bd468 100644
--- a/src/mesa/main/es1_conversion.c
+++ b/src/mesa/main/es1_conversion.c
@@ -1054,131 +1054,25 @@ _es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
void GL_APIENTRY
_check_TexGeniOES(GLenum coord, GLenum pname, GLint param)
{
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGeniOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGeniOES(pname=0x%x)", pname);
- return;
- }
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGeniOES(pname=0x%x)", pname);
- return;
- }
-
_es_TexGenf(coord, pname, (GLfloat) param);
}
void GL_APIENTRY
_check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenivOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenivOES(pname=0x%x)", pname);
- return;
- }
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenivOES(pname=0x%x)", pname);
- return;
- }
-
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) params[i];
- }
-
- _es_TexGenfv(coord, pname, converted_params);
+ _es_TexGenf(coord, pname, (GLfloat) params[0]);
}
void GL_APIENTRY
_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
{
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxOES(pname=0x%x)", pname);
- return;
- }
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxOES(pname=0x%x)", pname);
- return;
- }
-
_es_TexGenf(coord, pname, (GLfloat) param);
}
void GL_APIENTRY
_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxvOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxvOES(pname=0x%x)", pname);
- return;
- }
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxvOES(pname=0x%x)", pname);
- return;
- }
-
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) params[i];
- }
-
- _es_TexGenfv(coord, pname, converted_params);
+ _es_TexGenf(coord, pname, (GLfloat) params[0]);
}
void GL_APIENTRY
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 0ace0b9364d..05d68915add 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -48,8 +48,14 @@
* Return texgen state for given coordinate
*/
static struct gl_texgen *
-get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
+get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit,
+ GLenum coord)
{
+ if (ctx->API == API_OPENGLES) {
+ return (coord == GL_TEXTURE_GEN_STR_OES)
+ ? &texUnit->GenS : NULL;
+ }
+
switch (coord) {
case GL_S:
return &texUnit->GenS;
@@ -87,7 +93,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
return;
@@ -126,6 +132,12 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (ctx->API != API_OPENGL
+ && (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texgen->Mode = mode;
texgen->_ModeBit = bit;
@@ -134,6 +146,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_OBJECT_PLANE:
{
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
if (TEST_EQ_4V(texgen->ObjectPlane, params))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -144,6 +160,12 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_EYE_PLANE:
{
GLfloat tmp[4];
+
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+
/* Transform plane equation by the inverse modelview matrix */
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
@@ -206,7 +228,11 @@ _es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
void GLAPIENTRY
_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ if (coord != GL_TEXTURE_GEN_STR_OES) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGen[fx](pname)" );
+ return;
+ }
/* set S, T, and R at the same time */
_mesa_TexGenf(GL_S, pname, param);
_mesa_TexGenf(GL_T, pname, param);
@@ -217,7 +243,11 @@ _es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
void GLAPIENTRY
_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ if (coord != GL_TEXTURE_GEN_STR_OES) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGen[fx]v(pname)" );
+ return;
+ }
/* set S, T, and R at the same time */
_mesa_TexGenfv(GL_S, pname, params);
_mesa_TexGenfv(GL_T, pname, params);
@@ -279,7 +309,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
return;
@@ -317,7 +347,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
return;
@@ -355,7 +385,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
return;