diff options
author | Ian Romanick <[email protected]> | 2012-07-27 16:13:02 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-29 15:09:35 -0700 |
commit | 0fa4ed05cf51fc64f5e43d8ea6916115672bf7ab (patch) | |
tree | 08a95919233d82089a90503887d2866f9d861bd1 /src/mesa | |
parent | fb4f2d34256aee6b0005b18769a395dd066d3820 (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')
-rw-r--r-- | src/mesa/main/APIspec.xml | 14 | ||||
-rw-r--r-- | src/mesa/main/es1_conversion.c | 19 | ||||
-rw-r--r-- | src/mesa/main/light.c | 13 |
3 files changed, 11 insertions, 35 deletions
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml index baa7abf7f49..5c265020e8e 100644 --- a/src/mesa/main/APIspec.xml +++ b/src/mesa/main/APIspec.xml @@ -94,20 +94,6 @@ <param name="param" type="GLtype"/> </vector> </proto> - - <desc name="pname"> - <value name="GL_LIGHT_MODEL_AMBIENT"/> - - <desc name="params" vector_size="4"/> - </desc> - - <desc name="pname"> - <value name="GL_LIGHT_MODEL_TWO_SIDE"/> - <desc name="param"> - <value name="GL_TRUE"/> - <value name="GL_FALSE"/> - </desc> - </desc> </template> <template name="LineWidth"> diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c index 9b13f13d8a3..a71becc1066 100644 --- a/src/mesa/main/es1_conversion.c +++ b/src/mesa/main/es1_conversion.c @@ -508,20 +508,6 @@ _es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) void GL_APIENTRY _es_LightModelx(GLenum pname, GLfixed param) { - switch(pname) { - case GL_LIGHT_MODEL_TWO_SIDE: - if (param != GL_TRUE && param != GL_FALSE) { - _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, - "glLightModelx(pname=0x%x)", pname); - return; - } - break; - default: - _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, - "glLightModelx(pname=0x%x)", pname); - return; - } - _mesa_LightModelf(pname, (GLfloat) param); } @@ -538,11 +524,6 @@ _es_LightModelxv(GLenum pname, const GLfixed *params) n_params = 4; break; case GL_LIGHT_MODEL_TWO_SIDE: - if (params[0] != GL_TRUE && params[0] != GL_FALSE) { - _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, - "glLightModelxv(pname=0x%x)", pname); - return; - } convert_params_value = false; n_params = 1; break; 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; } |