v3d: set depth compare function correctly
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Thu, 13 Apr 2023 11:21:31 +0000 (13:21 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 14 Apr 2023 20:20:43 +0000 (20:20 +0000)
Depth compare function must be set to the configured one only when
compare mode is enabled; otherwise it must be configured to never.

v2 (Eric):
- Handle V3D < 4.0 case

CC: mesa-stable
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22470>

src/gallium/drivers/v3d/v3dx_state.c

index 1795b9f..079358a 100644 (file)
@@ -548,8 +548,9 @@ v3d_upload_sampler_state_variant(void *map,
                 sampler.wrap_r = translate_wrap(cso->wrap_r);
 
                 sampler.fixed_bias = cso->lod_bias;
-                sampler.depth_compare_function = cso->compare_func;
-
+                sampler.depth_compare_function = cso->compare_mode ?
+                                                 cso->compare_func :
+                                                 V3D_COMPARE_FUNC_NEVER;
                 sampler.min_filter_nearest =
                         cso->min_img_filter == PIPE_TEX_FILTER_NEAREST;
                 sampler.mag_filter_nearest =
@@ -792,7 +793,9 @@ v3d_create_sampler_state(struct pipe_context *pctx,
         }
 
         v3dx_pack(&so->texture_shader_state, TEXTURE_SHADER_STATE, tex) {
-                tex.depth_compare_function = cso->compare_func;
+                tex.depth_compare_function = cso->compare_mode ?
+                                             cso->compare_func :
+                                             V3D_COMPARE_FUNC_NEVER;
                 tex.fixed_bias = cso->lod_bias;
         }
 #endif /* V3D_VERSION < 40 */