<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">
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
* 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;
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;
_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;
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);
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);
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);
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);
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;
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;
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;