Module: Mesa
Branch: master
Commit: 3695c8ec1e9dc5d5a9bd834aad5d3dad0a22b01a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3695c8ec1e9dc5d5a9bd834aad5d3dad0a22b01a

Author: Tim Rowley <[email protected]>
Date:   Wed Jun  7 13:32:11 2017 -0500

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 <[email protected]>

---

 src/gallium/drivers/swr/rasterizer/core/backend.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp 
b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
index 16698ef08f..ca9a8b4044 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
@@ -593,6 +593,10 @@ void BackendSingleSample(DRAW_CONTEXT *pDC, uint32_t 
workerId, uint32_t x, uint3
                             pDepthBuffer, depthPassMask, vCoverageMask, 
pStencilBuffer, stencilPassMask);
                         goto Endtile;
                     }
+                } else {
+                    // for early z, consolidate discards from shader
+                    // into depthPassMask
+                    depthPassMask = _simd_and_ps(depthPassMask, vCoverageMask);
                 }
 
                 uint32_t statMask = _simd_movemask_ps(depthPassMask);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to