Mesa (master): panfrost: Preserve w sign in perspective division

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 18 05:14:46 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Fri Feb 15 06:38:23 2019 +0000

panfrost: Preserve w sign in perspective division

This fixes issues where polygons that should be culled (due to negative
w, for instance) may not be.

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 src/gallium/drivers/panfrost/midgard/midgard_compile.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 6b6a405d963..cd8412c2dff 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -2919,13 +2919,15 @@ write_transformed_position(nir_builder *b, nir_src input_point_src, int uniform_
 
         /* gl_Position will be written out in screenspace xyz, with w set to
          * the reciprocal we computed earlier. The transformed w component is
-         * then used for perspective-correct varying interpolation */
+         * then used for perspective-correct varying interpolation. The
+         * transformed w component must preserve its original sign; this is
+         * used in depth clipping computations */
 
         nir_ssa_def *screen_space = nir_vec4(b,
                                              nir_channel(b, viewport_xy, 0),
                                              nir_channel(b, viewport_xy, 1),
                                              screen_depth,
-                                             nir_fabs(b, w_recip));
+                                             w_recip);
 
         /* Finally, write out the transformed values to the varying */
 




More information about the mesa-commit mailing list