[Mesa-dev] [PATCH 08/17] radeonsi: merge 2 identical if statements in si_clear

Marek Olšák maraeo at gmail.com
Wed Apr 4 01:59:13 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

and other cleanups
---
 src/gallium/drivers/radeonsi/si_clear.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c
index 464b9d7ac56..8aa27b7f405 100644
--- a/src/gallium/drivers/radeonsi/si_clear.c
+++ b/src/gallium/drivers/radeonsi/si_clear.c
@@ -520,34 +520,27 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct pipe_framebuffer_state *fb = &sctx->framebuffer.state;
 	struct pipe_surface *zsbuf = fb->zsbuf;
 	struct r600_texture *zstex =
 		zsbuf ? (struct r600_texture*)zsbuf->texture : NULL;
 
 	if (buffers & PIPE_CLEAR_COLOR) {
 		si_do_fast_color_clear(sctx, &buffers, color);
 		if (!buffers)
 			return; /* all buffers have been fast cleared */
-	}
-
-	if (buffers & PIPE_CLEAR_COLOR) {
-		int i;
 
 		/* These buffers cannot use fast clear, make sure to disable expansion. */
-		for (i = 0; i < fb->nr_cbufs; i++) {
+		for (unsigned i = 0; i < fb->nr_cbufs; i++) {
 			struct r600_texture *tex;
 
 			/* If not clearing this buffer, skip. */
-			if (!(buffers & (PIPE_CLEAR_COLOR0 << i)))
-				continue;
-
-			if (!fb->cbufs[i])
+			if (!(buffers & (PIPE_CLEAR_COLOR0 << i)) || !fb->cbufs[i])
 				continue;
 
 			tex = (struct r600_texture *)fb->cbufs[i]->texture;
 			if (tex->fmask.size == 0)
 				tex->dirty_level_mask &= ~(1 << fb->cbufs[i]->u.tex.level);
 		}
 	}
 
 	if (zstex &&
 	    si_htile_enabled(zstex, zsbuf->u.tex.level) &&
-- 
2.15.1



More information about the mesa-dev mailing list