summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/light.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-27 15:57:09 -0700
committerIan Romanick <[email protected]>2012-08-29 15:09:35 -0700
commit8df3f9bd5f7626a4548e9901c0b7af33a21af8a6 (patch)
tree81092633783eba82550e6a0273af7e2591952c3c /src/mesa/main/light.c
parent9555d7bdc1cec4cf08be85a2d1e9095de8dd3771 (diff)
mesa/es: Validate glGetMaterial pname in Mesa code rather than the ES wrapper
Fixes a bug that glGetMaterial[fx]v in ES1 contexts would (try to) allow queries of GL_AMBIENT_AND_DIFFUSE. This enum can only be used in glMaterial, not in the get. Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/light.c')
-rw-r--r--src/mesa/main/light.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index d6fbcd9be2c..a6039353e66 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -789,6 +789,10 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
*params = mat[MAT_ATTRIB_SHININESS(f)][0];
break;
case GL_COLOR_INDEXES:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
+ return;
+ }
params[0] = mat[MAT_ATTRIB_INDEXES(f)][0];
params[1] = mat[MAT_ATTRIB_INDEXES(f)][1];
params[2] = mat[MAT_ATTRIB_INDEXES(f)][2];
@@ -807,6 +811,8 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
+ ASSERT(ctx->API == API_OPENGL);
+
FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
if (face==GL_FRONT) {