aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-27 14:34:21 -0600
committerBrian Paul <[email protected]>2009-08-30 09:10:36 -0600
commita068e098e275fc5d2aba309165263834f429143e (patch)
treec5e75efc85730352d50b73da799df90e09196e00
parent0243f79eac707cb2209346b0be2f7b67ce6efdf8 (diff)
intel: use more efficient loop over buffers
-rw-r--r--src/mesa/drivers/dri/intel/intel_clear.c10
1 files changed, 7 insertions, 3 deletions
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;
}
}