summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-09-22 19:26:08 +0100
committerKeith Whitwell <[email protected]>2009-09-22 19:26:08 +0100
commitb626176f0613852df908b4b0552b9b67d5830b4e (patch)
treeabafd33eb000da7557d54376383c8cb8924876fc /src
parent67d4a5b15cfd8583c19a5776b0ec1564b60239eb (diff)
softpipe: fix occlusion counting
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 9cffea2c9e6..ce1bab9341a 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -631,7 +631,7 @@ alpha_test_quads(struct quad_stage *qs,
}
}
-static unsigned mask_count[0x8] =
+static unsigned mask_count[16] =
{
0, /* 0x0 */
1, /* 0x1 */
@@ -641,6 +641,14 @@ static unsigned mask_count[0x8] =
2, /* 0x5 */
2, /* 0x6 */
3, /* 0x7 */
+ 1, /* 0x8 */
+ 2, /* 0x9 */
+ 2, /* 0xa */
+ 3, /* 0xb */
+ 2, /* 0xc */
+ 3, /* 0xd */
+ 3, /* 0xe */
+ 4, /* 0xf */
};
@@ -693,13 +701,17 @@ depth_test_quads_fallback(struct quad_stage *qs,
qs->softpipe->depth_stencil->depth.writemask)
write_depth_stencil_values(&data, quads[i]);
- qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask];
quads[pass++] = quads[i];
}
nr = pass;
}
+ if (qs->softpipe->active_query_count) {
+ for (i = 0; i < nr; i++)
+ qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask];
+ }
+
if (nr)
qs->next->run(qs->next, quads, nr);
}
@@ -883,6 +895,8 @@ choose_depth_test(struct quad_stage *qs,
boolean depthwrite = qs->softpipe->depth_stencil->depth.writemask;
+ boolean occlusion = qs->softpipe->active_query_count;
+
if (!alpha &&
!depth &&
@@ -893,6 +907,7 @@ choose_depth_test(struct quad_stage *qs,
interp_depth &&
depth &&
depthwrite &&
+ !occlusion &&
!stencil)
{
switch (depthfunc) {