From: Brian Paul Date: Thu, 27 Aug 2009 20:34:21 +0000 (-0600) Subject: intel: use more efficient loop over buffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a068e098e275fc5d2aba309165263834f429143e;p=mesa.git intel: use more efficient loop over buffers --- diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index cfddabd3182..630d2adab87 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -150,14 +150,18 @@ intelClear(GLcontext *ctx, GLbitfield mask) /* SW fallback clearing */ swrast_mask = mask & ~tri_mask & ~blit_mask; - for (i = 0; i < BUFFER_COUNT; i++) { - GLuint bufBit = 1 << i; - if ((blit_mask | tri_mask) & bufBit) { + { + /* look for non-Intel renderbuffers (clear them with swrast) */ + GLbitfield blit_or_tri = blit_mask | tri_mask; + while (blit_or_tri) { + GLuint i = _mesa_ffs(blit_or_tri) - 1; + GLbitfield bufBit = 1 << i; if (!fb->Attachment[i].Renderbuffer->ClassID) { blit_mask &= ~bufBit; tri_mask &= ~bufBit; swrast_mask |= bufBit; } + blit_or_tri ^= bufBit; } }