This fixes issues where polygons that should be culled (due to negative
w, for instance) may not be.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
/* gl_Position will be written out in screenspace xyz, with w set to
* the reciprocal we computed earlier. The transformed w component is
/* 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_ssa_def *screen_space = nir_vec4(b,
nir_channel(b, viewport_xy, 0),
nir_channel(b, viewport_xy, 1),
screen_depth,
/* Finally, write out the transformed values to the varying */
/* Finally, write out the transformed values to the varying */