freedreno/a2xx: Fix redundant if statement
authorKristian H. Kristensen <hoegsberg@chromium.org>
Wed, 10 Apr 2019 20:08:00 +0000 (13:08 -0700)
committerKristian H. Kristensen <hoegsberg@google.com>
Thu, 18 Apr 2019 18:46:13 +0000 (11:46 -0700)
We test the condition, declare a few variables, then test the exact
same condition again. Let's not do that.

Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
src/gallium/drivers/freedreno/a2xx/fd2_draw.c

index 498c1eae1d73da5c024fcb58411a5c61d5daee3d..ecc0798679df6df62bbc92cd62fd3066711cba8b 100644 (file)
@@ -551,22 +551,20 @@ fd2_clear(struct fd_context *ctx, unsigned buffers,
 
                if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
                        uint32_t clear_mask, depth_clear;
-                       if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
-                               switch (fd_pipe2depth(fb->zsbuf->format)) {
-                               case DEPTHX_24_8:
-                                       clear_mask = ((buffers & PIPE_CLEAR_DEPTH) ? 0xe : 0) |
-                                               ((buffers & PIPE_CLEAR_STENCIL) ? 0x1 : 0);
-                                       depth_clear = (((uint32_t)(0xffffff * depth)) << 8) |
-                                               (stencil & 0xff);
-                                       break;
-                               case DEPTHX_16:
-                                       clear_mask = 0xf;
-                                       depth_clear = (uint32_t)(0xffffffff * depth);
-                                       break;
-                               default:
-                                       debug_assert(0);
-                                       break;
-                               }
+                       switch (fd_pipe2depth(fb->zsbuf->format)) {
+                       case DEPTHX_24_8:
+                               clear_mask = ((buffers & PIPE_CLEAR_DEPTH) ? 0xe : 0) |
+                                       ((buffers & PIPE_CLEAR_STENCIL) ? 0x1 : 0);
+                               depth_clear = (((uint32_t)(0xffffff * depth)) << 8) |
+                                       (stencil & 0xff);
+                               break;
+                       case DEPTHX_16:
+                               clear_mask = 0xf;
+                               depth_clear = (uint32_t)(0xffffffff * depth);
+                               break;
+                       default:
+                               unreachable("invalid depth");
+                               break;
                        }
 
                        OUT_PKT3(ring, CP_SET_CONSTANT, 2);