From 0c0b97893800132d5f26281b55806e2edd62eb63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 31 Jan 2023 06:15:34 -0500 Subject: [PATCH] radeonsi: set NEVER as the depth compare func if depth compare is disabled Fixes: 0c6e56c391a262bef - mesa: (more) correctly handle incomplete depth textures Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 9fa0f172eb6..ebe97b4c224 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2152,8 +2152,11 @@ static unsigned si_tex_mipfilter(unsigned filter) } } -static unsigned si_tex_compare(unsigned compare) +static unsigned si_tex_compare(unsigned mode, unsigned compare) { + if (mode == PIPE_TEX_COMPARE_NONE) + return V_008F30_SQ_TEX_DEPTH_COMPARE_NEVER; + switch (compare) { default: case PIPE_FUNC_NEVER: @@ -4808,7 +4811,7 @@ static void *si_create_sampler_state(struct pipe_context *ctx, rstate->val[0] = (S_008F30_CLAMP_X(si_tex_wrap(state->wrap_s)) | S_008F30_CLAMP_Y(si_tex_wrap(state->wrap_t)) | S_008F30_CLAMP_Z(si_tex_wrap(state->wrap_r)) | S_008F30_MAX_ANISO_RATIO(max_aniso_ratio) | - S_008F30_DEPTH_COMPARE_FUNC(si_tex_compare(state->compare_func)) | + S_008F30_DEPTH_COMPARE_FUNC(si_tex_compare(state->compare_mode, state->compare_func)) | S_008F30_FORCE_UNNORMALIZED(state->unnormalized_coords) | S_008F30_ANISO_THRESHOLD(max_aniso_ratio >> 1) | S_008F30_ANISO_BIAS(max_aniso_ratio) | S_008F30_DISABLE_CUBE_WRAP(!state->seamless_cube_map) |