swr/rast: Fix early z / query interaction
authorTim Rowley <timothy.o.rowley@intel.com>
Wed, 7 Jun 2017 18:32:11 +0000 (13:32 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Fri, 16 Jun 2017 21:20:16 +0000 (16:20 -0500)
commit3695c8ec1e9dc5d5a9bd834aad5d3dad0a22b01a
tree690df8c322f3d0b534578824d114b883e2e8aba2
parentb7eb86c617ee8f73b552dc64a6d776d26672c38f
swr/rast: Fix early z / query interaction

For certain cases, we perform early z for optimization. The GL_SAMPLES_PASSED
query was providing erroneous results because we were counting the number
of samples passed before the fragment shader, which did not work if the
fragment shader contained a discard.

Account properly for discard and early z, by anding the zpass mask with
the post fragment shader active mask, after the fragment shader.

Fixes the following piglit tests:
    - occlusion-query-discard
    - occlusion_query_meta_fragments

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/core/backend.cpp