<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="target" category="OES_point_sprite">
- <value name="GL_POINT_SPRITE_OES"/>
-
- <desc name="pname">
- <value name="GL_COORD_REPLACE_OES"/>
- </desc>
- </desc>
-
- <desc name="pname" category="OES_point_sprite">
- <value name="GL_COORD_REPLACE_OES"/>
-
- <desc name="param">
- <value name="GL_TRUE"/>
- <value name="GL_FALSE"/>
- </desc>
- </desc>
-
- <desc name="target" category="EXT_texture_lod_bias">
- <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
-
- <desc name="pname">
- <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
- </desc>
- </desc>
-
- <desc name="pname" category="EXT_texture_lod_bias">
- <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
- <desc name="params" vector_size="1"/>
- </desc>
-
- <desc name="target">
- <value name="GL_TEXTURE_ENV"/>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_MODE"/>
- <value name="GL_COMBINE_RGB"/>
- <value name="GL_COMBINE_ALPHA"/>
- <value name="GL_RGB_SCALE"/>
- <value name="GL_ALPHA_SCALE"/>
- <value name="GL_SRC0_RGB"/>
- <value name="GL_SRC1_RGB"/>
- <value name="GL_SRC2_RGB"/>
- <value name="GL_SRC0_ALPHA"/>
- <value name="GL_SRC1_ALPHA"/>
- <value name="GL_SRC2_ALPHA"/>
- <value name="GL_OPERAND0_RGB"/>
- <value name="GL_OPERAND1_RGB"/>
- <value name="GL_OPERAND2_RGB"/>
- <value name="GL_OPERAND0_ALPHA"/>
- <value name="GL_OPERAND1_ALPHA"/>
- <value name="GL_OPERAND2_ALPHA"/>
- <value name="GL_TEXTURE_ENV_COLOR"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_MODE"/>
-
- <desc name="param">
- <value name="GL_REPLACE"/>
- <value name="GL_MODULATE"/>
- <value name="GL_DECAL"/>
- <value name="GL_BLEND"/>
- <value name="GL_ADD"/>
- <value name="GL_COMBINE"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_COMBINE_RGB"/>
-
- <desc name="param">
- <value name="GL_REPLACE"/>
- <value name="GL_MODULATE"/>
- <value name="GL_ADD"/>
- <value name="GL_ADD_SIGNED"/>
- <value name="GL_INTERPOLATE"/>
- <value name="GL_SUBTRACT"/>
- <value name="GL_DOT3_RGB"/>
- <value name="GL_DOT3_RGBA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_COMBINE_ALPHA"/>
-
- <desc name="param">
- <value name="GL_REPLACE"/>
- <value name="GL_MODULATE"/>
- <value name="GL_ADD"/>
- <value name="GL_ADD_SIGNED"/>
- <value name="GL_INTERPOLATE"/>
- <value name="GL_SUBTRACT"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_RGB_SCALE"/>
- <value name="GL_ALPHA_SCALE"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_SRC0_RGB"/>
- <value name="GL_SRC1_RGB"/>
- <value name="GL_SRC2_RGB"/>
- <value name="GL_SRC0_ALPHA"/>
- <value name="GL_SRC1_ALPHA"/>
- <value name="GL_SRC2_ALPHA"/>
-
- <desc name="param">
- <value name="GL_TEXTURE"/>
- <value name="GL_CONSTANT"/>
- <value name="GL_PRIMARY_COLOR"/>
- <value name="GL_PREVIOUS"/>
-
- <range base="GL_TEXTURE" from="0" to="31" category="OES_texture_env_crossbar"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_OPERAND0_RGB"/>
- <value name="GL_OPERAND1_RGB"/>
- <value name="GL_OPERAND2_RGB"/>
-
- <desc name="param">
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_OPERAND0_ALPHA"/>
- <value name="GL_OPERAND1_ALPHA"/>
- <value name="GL_OPERAND2_ALPHA"/>
-
- <desc name="param">
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_COLOR"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
</template>
<template name="TexGen">
void GL_APIENTRY
_es_TexEnvx(GLenum target, GLenum pname, GLfixed param)
{
- GLfloat converted_param;
- bool convert_param_value = true;
-
switch(target) {
case GL_POINT_SPRITE:
- if (pname != GL_COORD_REPLACE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_FILTER_CONTROL_EXT:
- if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_ENV:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(target=0x%x)", target);
- return;
- }
break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvx(target=0x%x)", target);
return;
}
+
switch(pname) {
case GL_COORD_REPLACE:
- if (param != GL_TRUE && param != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_TEXTURE_LOD_BIAS_EXT:
- break;
case GL_TEXTURE_ENV_MODE:
- if (param != GL_REPLACE && param != GL_MODULATE && param != GL_DECAL && param != GL_BLEND && param != GL_ADD && param != GL_COMBINE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
case GL_COMBINE_RGB:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
case GL_COMBINE_ALPHA:
- if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- break;
case GL_SRC0_RGB:
case GL_SRC1_RGB:
case GL_SRC2_RGB:
case GL_SRC0_ALPHA:
case GL_SRC1_ALPHA:
case GL_SRC2_ALPHA:
- convert_param_value = false;
- break;
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
- if (param != GL_SRC_COLOR && param != GL_ONE_MINUS_SRC_COLOR && param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
- if (param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
+ _mesa_TexEnvf(target, pname, (GLfloat) param);
+ break;
+ case GL_TEXTURE_LOD_BIAS_EXT:
+ case GL_RGB_SCALE:
+ case GL_ALPHA_SCALE:
+ _mesa_TexEnvf(target, pname, (GLfloat) (param / 65536.0f));
break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvx(pname=0x%x)", pname);
return;
}
-
- if (convert_param_value) {
- converted_param = (GLfloat) (param / 65536.0f);
- } else {
- converted_param = (GLfloat) param;
- }
-
- _mesa_TexEnvf(target, pname, converted_param);
}
void GL_APIENTRY
_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
{
- unsigned int i;
- unsigned int n_params = 4;
- GLfloat converted_params[4];
- bool convert_params_value = true;
-
switch(target) {
case GL_POINT_SPRITE:
- if (pname != GL_COORD_REPLACE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_FILTER_CONTROL_EXT:
- if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_ENV:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(target=0x%x)", target);
- return;
- }
break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvxv(target=0x%x)", target);
return;
}
+
switch(pname) {
case GL_COORD_REPLACE:
- if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
- case GL_TEXTURE_LOD_BIAS_EXT:
- n_params = 1;
- break;
case GL_TEXTURE_ENV_MODE:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
case GL_COMBINE_RGB:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
case GL_COMBINE_ALPHA:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- break;
case GL_SRC0_RGB:
case GL_SRC1_RGB:
case GL_SRC2_RGB:
case GL_SRC0_ALPHA:
case GL_SRC1_ALPHA:
case GL_SRC2_ALPHA:
- convert_params_value = false;
- n_params = 1;
- break;
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
- 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) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
- if (params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
+ _mesa_TexEnvf(target, pname, (GLfloat) params[0]);
break;
- case GL_TEXTURE_ENV_COLOR:
- n_params = 4;
+ case GL_TEXTURE_LOD_BIAS_EXT:
+ case GL_RGB_SCALE:
+ case GL_ALPHA_SCALE:
+ _mesa_TexEnvf(target, pname, (GLfloat) (params[0] / 65536.0f));
break;
+ case GL_TEXTURE_ENV_COLOR: {
+ unsigned int i;
+ GLfloat converted_params[4];
+
+ for (i = 0; i < Elements(converted_params); i++) {
+ converted_params[i] = (GLfloat) (params[i] / 65536.0f);
+ }
+
+ _mesa_TexEnvfv(target, pname, converted_params);
+ break;
+ }
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvxv(pname=0x%x)", pname);
return;
}
-
- if (convert_params_value) {
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) (params[i] / 65536.0f);
- }
- } else {
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) params[i];
- }
- }
-
- _mesa_TexEnvfv(target, pname, converted_params);
}
void GL_APIENTRY
break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
- legal = (ctx->Extensions.EXT_texture_env_dot3 &&
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_env_dot3 &&
pname == GL_COMBINE_RGB);
break;
case GL_DOT3_RGB:
case GL_MODULATE_ADD_ATI:
case GL_MODULATE_SIGNED_ADD_ATI:
case GL_MODULATE_SUBTRACT_ATI:
- legal = ctx->Extensions.ATI_texture_env_combine3;
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.ATI_texture_env_combine3);
break;
case GL_BUMP_ENVMAP_ATI:
- legal = (ctx->Extensions.ATI_envmap_bumpmap &&
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.ATI_envmap_bumpmap &&
pname == GL_COMBINE_RGB);
break;
default:
return;
}
- if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ if ((term == 3) && (ctx->API != API_OPENGL
+ || !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits);
break;
case GL_ZERO:
- legal = (ctx->Extensions.ATI_texture_env_combine3 ||
- ctx->Extensions.NV_texture_env_combine4);
+ legal = (ctx->API == API_OPENGL &&
+ (ctx->Extensions.ATI_texture_env_combine3 ||
+ ctx->Extensions.NV_texture_env_combine4));
break;
case GL_ONE:
- legal = ctx->Extensions.ATI_texture_env_combine3;
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.ATI_texture_env_combine3);
break;
default:
legal = GL_FALSE;
return;
}
- if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ if ((term == 3) && (ctx->API != API_OPENGL
+ || !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
/* The color input can only be used with GL_OPERAND[01]_RGB in the EXT
- * version. In the ARB and NV versions they can be used for any RGB
- * operand.
+ * version. In the ARB and NV versions and OpenGL ES 1.x they can be
+ * used for any RGB operand.
*/
legal = !alpha
&& ((term < 2) || ctx->Extensions.ARB_texture_env_combine
case GL_ONE_MINUS_SRC_ALPHA:
/* GL_ONE_MINUS_SRC_ALPHA can only be used with
* GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV
- * versions it can be used for any operand.
+ * versions and OpenGL ES 1.x it can be used for any operand.
*/
legal = (term < 2) || ctx->Extensions.ARB_texture_env_combine
|| ctx->Extensions.NV_texture_env_combine4;
set_combiner_scale(ctx, texUnit, pname, param[0]);
break;
case GL_BUMP_TARGET_ATI:
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API != API_OPENGL || !ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
return;
}