From 91d090f0e7fe33c32238822388d2845cb28bf319 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Tue, 4 Jul 2023 18:24:30 +0200 Subject: [PATCH] llvmpipe: Allow comparison sampling for float formats Fixes test_gather_c (vkd3d-proton). Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/llvmpipe/lp_texture_handle.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture_handle.c b/src/gallium/drivers/llvmpipe/lp_texture_handle.c index 7977e3f7c08..7c966662da1 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture_handle.c +++ b/src/gallium/drivers/llvmpipe/lp_texture_handle.c @@ -343,8 +343,15 @@ compile_sample_function(struct llvmpipe_context *ctx, struct lp_static_texture_s if ((sampler->compare_mode == PIPE_TEX_COMPARE_NONE) == !!(sample_key & LP_SAMPLER_SHADOW)) return NULL; + /* Skip integer formats which would cause a type mismatch in the compare function. */ const struct util_format_description *desc = util_format_description(texture->format); - if ((sample_key & LP_SAMPLER_SHADOW) && !util_format_has_depth(desc)) + struct lp_type texel_type = { + .floating = true, + .width = 32, + .length = 1, + }; + texel_type = lp_build_texel_type(texel_type, desc); + if ((sample_key & LP_SAMPLER_SHADOW) && !texel_type.floating) return NULL; if (texture_dims(texture->target) != 2 && op_type == LP_SAMPLER_OP_GATHER)