r300: Use a switch statement in r300UpdateCulling.
authorOliver McFadden <z3ro.geek@gmail.com>
Fri, 13 Jul 2007 01:45:05 +0000 (01:45 +0000)
committerOliver McFadden <z3ro.geek@gmail.com>
Fri, 13 Jul 2007 04:51:36 +0000 (04:51 +0000)
src/mesa/drivers/dri/r300/r300_state.c

index 6e1eeb857a4784d7949a5330aeb2dd27d91e078b..d6f477bbf5cbb22f328e9806bef1902889184a76 100644 (file)
@@ -317,19 +317,34 @@ static void r300UpdateCulling(GLcontext * ctx)
        r300ContextPtr r300 = R300_CONTEXT(ctx);
        uint32_t val = 0;
 
-       R300_STATECHANGE(r300, cul);
        if (ctx->Polygon.CullFlag) {
-               if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
-                       val = R300_CULL_FRONT | R300_CULL_BACK;
-               else if (ctx->Polygon.CullFaceMode == GL_FRONT)
+               switch (ctx->Polygon.CullFaceMode) {
+               case GL_FRONT:
                        val = R300_CULL_FRONT;
-               else
+                       break;
+               case GL_BACK:
                        val = R300_CULL_BACK;
+                       break;
+               case GL_FRONT_AND_BACK:
+                       val = R300_CULL_FRONT | R300_CULL_BACK;
+                       break;
+               default:
+                       break;
+               }
        }
-       if (ctx->Polygon.FrontFace == GL_CW)
+
+       switch (ctx->Polygon.FrontFace) {
+       case GL_CW:
                val |= R300_FRONT_FACE_CW;
-       else
+               break;
+       case GL_CCW:
                val |= R300_FRONT_FACE_CCW;
+               break;
+       default:
+               break;
+       }
+
+       R300_STATECHANGE(r300, cul);
        r300->hw.cul.cmd[R300_CUL_CULL] = val;
 }