v3d: handle Z clipping in v71
authorAlejandro Piñeiro <apinheiro@igalia.com>
Fri, 22 Oct 2021 12:26:29 +0000 (14:26 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 13 Oct 2023 22:37:43 +0000 (22:37 +0000)
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>

src/gallium/drivers/v3d/v3dx_emit.c

index 58c886b..352da1c 100644 (file)
@@ -539,8 +539,22 @@ v3dX(emit_state)(struct pipe_context *pctx)
                                 v3d_line_smoothing_enabled(v3d) ?
                                 V3D_LINE_RASTERIZATION_PERP_END_CAPS :
                                 V3D_LINE_RASTERIZATION_DIAMOND_EXIT;
-                }
 
+#if V3D_VERSION >= 71
+                        /* The following follows the logic implemented in v3dv
+                         * plus the definition of depth_clip_near/far and
+                         * depth_clamp.
+                         *
+                         * Note: some extensions are not supported by v3d
+                         * (like ARB_depth_clamp) that would affect this, but
+                         * the values on rasterizer are taking that into
+                         * account.
+                         */
+                        config.z_clipping_mode = v3d->rasterizer->base.depth_clip_near ||
+                           v3d->rasterizer->base.depth_clip_far ?
+                           V3D_Z_CLIP_MODE_MIN_ONE_TO_ONE : V3D_Z_CLIP_MODE_NONE;
+#endif
+                }
         }
 
         if (v3d->dirty & V3D_DIRTY_RASTERIZER &&