mesa: move check for no-op glShadeModel call earlier
authorBrian Paul <brianp@vmware.com>
Wed, 22 Jul 2015 00:44:07 +0000 (18:44 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 22 Jul 2015 00:44:07 +0000 (18:44 -0600)
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/light.c

index dab21d1a634c649bc78e1e8f799107ab7aef96f6..89b1c4b142f5f78d650369dc21daac2525c9e917 100644 (file)
@@ -44,14 +44,14 @@ _mesa_ShadeModel( GLenum mode )
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glShadeModel %s\n", _mesa_enum_to_string(mode));
 
+   if (ctx->Light.ShadeModel == mode)
+      return;
+
    if (mode != GL_FLAT && mode != GL_SMOOTH) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glShadeModel");
       return;
    }
 
-   if (ctx->Light.ShadeModel == mode)
-      return;
-
    FLUSH_VERTICES(ctx, _NEW_LIGHT);
    ctx->Light.ShadeModel = mode;