From 6c27f7582dec79397cf1958daa6abee66eac1846 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Thu, 13 Apr 2023 13:21:31 +0200 Subject: [PATCH] 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 Signed-off-by: Juan A. Suarez Romero Part-of: (cherry picked from commit 82c22580192502bcacb9f96319b560a09031219b) --- .pick_status.json | 2 +- src/gallium/drivers/v3d/v3dx_state.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index af43d2f18b1..6562b95fa49 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index b7651def3a7..c3a9834c692 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -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 */