summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/light.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-27 16:13:02 -0700
committerIan Romanick <[email protected]>2012-08-29 15:09:35 -0700
commit0fa4ed05cf51fc64f5e43d8ea6916115672bf7ab (patch)
tree08a95919233d82089a90503887d2866f9d861bd1 /src/mesa/main/light.c
parentfb4f2d34256aee6b0005b18769a395dd066d3820 (diff)
mesa/es: Validate glLightModel pname in Mesa code rather than the ES wrapper
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/light.c')
-rw-r--r--src/mesa/main/light.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index a6039353e66..cfb53dc061c 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -466,6 +466,8 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
COPY_4V( ctx->Light.Model.Ambient, params );
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
newbool = (params[0]!=0.0);
if (ctx->Light.Model.LocalViewer == newbool)
return;
@@ -484,6 +486,8 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
newenum = GL_SINGLE_COLOR;
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
@@ -499,12 +503,17 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->Light.Model.ColorControl = newenum;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
- break;
+ goto invalid_pname;
}
if (ctx->Driver.LightModelfv)
ctx->Driver.LightModelfv( ctx, pname, params );
+
+ return;
+
+invalid_pname:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
+ return;
}