v3d: set depth compare function correctly

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>
(cherry picked from commit 82c2258019)
This commit is contained in:
Juan A. Suarez Romero 2023-04-13 13:21:31 +02:00 committed by Dylan Baker
parent bb365235a1
commit 6c27f7582d
2 changed files with 7 additions and 4 deletions

View file

@ -2764,7 +2764,7 @@
"description": "v3d: set depth compare function correctly",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View 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 */