summaryrefslogtreecommitdiff
path: root/src/broadcom
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2023-02-14 10:09:53 +0100
committerMarge Bot <emma+marge@anholt.net>2023-10-13 22:37:43 +0000
commit48383668a7c53f3edda9ab266a0ef00ca20fbf95 (patch)
treee35da9dbcd43e2e5f1998e0fdc833e9540e41b1a /src/broadcom
parent662d6e296e44a4be499a10b6046bc67dd98050a3 (diff)
downloadmesa-48383668a7c53f3edda9ab266a0ef00ca20fbf95.tar.gz
mesa-48383668a7c53f3edda9ab266a0ef00ca20fbf95.tar.bz2
mesa-48383668a7c53f3edda9ab266a0ef00ca20fbf95.zip
v3dv: fix depth clipping then Z scale is too small in V3D 7.x
When the Z scale is too small guardband clipping may not clip correctly, so disable it, which is a new option in V3D 7.x. This fixes this test in V3D 7.x without needing any workarounds: dEQP-VK.draw.renderpass.inverted_depth_ranges.nodepthclamp_deltazero Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
Diffstat (limited to 'src/broadcom')
-rw-r--r--src/broadcom/vulkan/v3dvx_cmd_buffer.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c
index 638158b791e..a2011ef1b5e 100644
--- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c
@@ -1363,10 +1363,28 @@ v3dX(cmd_buffer_emit_viewport)(struct v3dv_cmd_buffer *cmd_buffer)
v3dv_cmd_buffer_state_get_viewport_z_xform(&cmd_buffer->state, 0,
&translate_z, &scale_z);
+#if V3D_VERSION == 42
cl_emit(&job->bcl, CLIPPER_Z_SCALE_AND_OFFSET, clip) {
clip.viewport_z_offset_zc_to_zs = translate_z;
clip.viewport_z_scale_zc_to_zs = scale_z;
}
+#endif
+
+#if V3D_VERSION >= 71
+ /* If the Z scale is too small guardband clipping may not clip correctly */
+ if (fabsf(scale_z) < 0.01f) {
+ cl_emit(&job->bcl, CLIPPER_Z_SCALE_AND_OFFSET_NO_GUARDBAND, clip) {
+ clip.viewport_z_offset_zc_to_zs = translate_z;
+ clip.viewport_z_scale_zc_to_zs = scale_z;
+ }
+ } else {
+ cl_emit(&job->bcl, CLIPPER_Z_SCALE_AND_OFFSET, clip) {
+ clip.viewport_z_offset_zc_to_zs = translate_z;
+ clip.viewport_z_scale_zc_to_zs = scale_z;
+ }
+ }
+#endif
+
cl_emit(&job->bcl, CLIPPER_Z_MIN_MAX_CLIPPING_PLANES, clip) {
/* Vulkan's default Z NDC is [0..1]. If 'negative_one_to_one' is enabled,
* we are using OpenGL's [-1, 1] instead.