summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fog.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2012-07-27 12:37:05 -0700
committerIan Romanick <ian.d.romanick@intel.com>2012-08-29 15:09:35 -0700
commit10e7db1ccf4d3b2023f04663f7a6c079eb6afc57 (patch)
treeab2f9703af2482ebfcdffc5945c8fadb11730147 /src/mesa/main/fog.c
parentb7c7e5e45a14ed78eda104ebca25072172730645 (diff)
downloadexternal_mesa3d-10e7db1ccf4d3b2023f04663f7a6c079eb6afc57.zip
external_mesa3d-10e7db1ccf4d3b2023f04663f7a6c079eb6afc57.tar.gz
external_mesa3d-10e7db1ccf4d3b2023f04663f7a6c079eb6afc57.tar.bz2
mesa/es: Validate glFog pname in Mesa code rather than the ES wrapper
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/main/fog.c')
-rw-r--r--src/mesa/main/fog.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c
index d65add9..07405fb 100644
--- a/src/mesa/main/fog.c
+++ b/src/mesa/main/fog.c
@@ -141,6 +141,8 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
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);
@@ -161,7 +163,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
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;
@@ -174,7 +176,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
}
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;
@@ -186,13 +188,18 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
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;
}