<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="pname">
- <value name="GL_FOG_MODE"/>
- <desc name="param">
- <value name="GL_EXP"/>
- <value name="GL_EXP2"/>
- <value name="GL_LINEAR"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_FOG_COLOR"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_FOG_DENSITY"/>
- <value name="GL_FOG_START"/>
- <value name="GL_FOG_END"/>
-
- <desc name="params" vector_size="1"/>
- </desc>
</template>
<template name="FrontFace">
void GL_APIENTRY
_es_Fogx(GLenum pname, GLfixed param)
{
- bool convert_param_value = true;
-
- switch(pname) {
- case GL_FOG_MODE:
- if (param != GL_EXP && param != GL_EXP2 && param != GL_LINEAR) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glFogx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_FOG_DENSITY:
- case GL_FOG_START:
- case GL_FOG_END:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glFogx(pname=0x%x)", pname);
- return;
- }
-
- if (convert_param_value) {
+ if (pname != GL_FOG_MODE) {
_mesa_Fogf(pname, (GLfloat) (param / 65536.0f));
} else {
_mesa_Fogf(pname, (GLfloat) param);
switch(pname) {
case GL_FOG_MODE:
- if (params[0] != GL_EXP && params[0] != GL_EXP2 && params[0] != GL_LINEAR) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glFogxv(pname=0x%x)", pname);
- return;
- }
convert_params_value = false;
n_params = 1;
break;
update_fog_scale(ctx);
break;
case GL_FOG_INDEX:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
if (ctx->Fog.Index == *params)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
break;
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum) (GLint) *params;
- if (!ctx->Extensions.EXT_fog_coord ||
+ if (ctx->API != API_OPENGL || !ctx->Extensions.EXT_fog_coord ||
(p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
}
case GL_FOG_DISTANCE_MODE_NV: {
GLenum p = (GLenum) (GLint) *params;
- if (!ctx->Extensions.NV_fog_distance ||
+ if (ctx->API != API_OPENGL || !ctx->Extensions.NV_fog_distance ||
(p != GL_EYE_RADIAL_NV && p != GL_EYE_PLANE && p != GL_EYE_PLANE_ABSOLUTE_NV)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
break;
}
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
- return;
+ goto invalid_pname;
}
if (ctx->Driver.Fogfv) {
(*ctx->Driver.Fogfv)( ctx, pname, params );
}
+
+ return;
+
+invalid_pname:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
+ return;
}