From e54fbc197c95ac133610385959080d474fb75dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Fri, 22 Oct 2021 14:26:29 +0200 Subject: [PATCH] v3d: handle Z clipping in v71 Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/v3d/v3dx_emit.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c index 58c886bb29e..352da1ce8a8 100644 --- a/src/gallium/drivers/v3d/v3dx_emit.c +++ b/src/gallium/drivers/v3d/v3dx_emit.c @@ -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 &&