mesa: fix/add error check in _mesa_ColorMaterial()
authorBrian Paul <brianp@vmware.com>
Tue, 8 May 2012 16:22:20 +0000 (10:22 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 11 May 2012 22:13:14 +0000 (16:13 -0600)
_mesa_material_bitmask() will record a GL error and return 0 if
face or mode are illegal.  Return early in that case.

NOTE: This is a candidate for the 8.0 branch.

src/mesa/main/light.c

index 7bc22e2fa5463da1a2df5eb8987782b0ab21269e..38ec1b6e801ee48b29262425feb9525d653e45ef 100644 (file)
@@ -728,6 +728,8 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
                   _mesa_lookup_enum_by_nr(mode));
 
    bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial");
+   if (bitmask == 0)
+      return; /* error was recorded */
 
    if (ctx->Light.ColorMaterialBitmask == bitmask &&
        ctx->Light.ColorMaterialFace == face &&