[Mesa-dev] [PATCH 1/2] mesa: fix/add error check in _mesa_ColorMaterial()

Brian Paul brianp at vmware.com
Tue May 8 12:15:59 PDT 2012


_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 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 7bc22e2..38ec1b6 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -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 &&
-- 
1.7.3.4



More information about the mesa-dev mailing list