diff options
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_quad_occlusion.c')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_quad_occlusion.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c index d65fdbdab72..54254df1f11 100644 --- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c +++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c @@ -39,18 +39,22 @@ #include "sp_surface.h" #include "sp_quad.h" +static unsigned count_bits( unsigned val ) +{ + unsigned i; + + for (i = 0; val ; val >>= 1) + i += (val & 1); + + return i; +} static void occlusion_count_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; - struct pipe_query_object *occ - = softpipe->queries[PIPE_QUERY_OCCLUSION_COUNTER]; - occ->count += (quad->mask ) & 1; - occ->count += (quad->mask >> 1) & 1; - occ->count += (quad->mask >> 2) & 1; - occ->count += (quad->mask >> 3) & 1; + softpipe->occlusion_count += count_bits(quad->mask); qs->next->run(qs->next, quad); } |