diff options
author | Kristian H. Kristensen <[email protected]> | 2019-04-10 13:08:00 -0700 |
---|---|---|
committer | Kristian H. Kristensen <[email protected]> | 2019-04-18 11:46:13 -0700 |
commit | c34b285b38400ca1aaa7d00410bc99d393c79e2f (patch) | |
tree | 46f63ef25833156c471262bc625e330281228b62 /src/gallium | |
parent | 18ce6ac6328db11bc68eb5689a28a43f7479cf7f (diff) |
freedreno/a2xx: Fix redundant if statement
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c index 498c1eae1d7..ecc0798679d 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c @@ -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); |