[Mesa-dev] [PATCH 1/6] mesa: move check for no-op glFrontFace call earlier

Brian Paul brianp at vmware.com
Fri Jul 17 17:48:38 PDT 2015


If the new mode matches the current mode, there can be no error.
---
 src/mesa/main/polygon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index a1f0aa0..6be6f33 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -93,14 +93,14 @@ _mesa_FrontFace( GLenum mode )
    if (MESA_VERBOSE&VERBOSE_API)
       _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
 
+   if (ctx->Polygon.FrontFace == mode)
+      return;
+
    if (mode!=GL_CW && mode!=GL_CCW) {
       _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
       return;
    }
 
-   if (ctx->Polygon.FrontFace == mode)
-      return;
-
    FLUSH_VERTICES(ctx, _NEW_POLYGON);
    ctx->Polygon.FrontFace = mode;
 
-- 
1.9.1



More information about the mesa-dev mailing list