From 72dcc826189552510180689f2b28705a92787d58 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Mon, 16 Feb 2026 13:24:46 +0100 Subject: [PATCH] r600: enable EXT_texture_shadow_lod The support needed only a minor adjustment. Note: As far as rv770 is concerned: khr-gl33 (4/12), the support needs some work and is disabled. This change was tested on palm, barts and cayman: piglit (3/3) khr-gl46 (15/16). The failing test: sampler2darrayshadow_vertex is referenced as "Bug 21620051" (VK-GL-CTS) and seems to have a problem. Signed-off-by: Patrick Lerda Part-of: --- src/gallium/drivers/r600/r600_pipe.c | 3 ++- src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index eccb43989ec..f9320ecd6e3 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -450,7 +450,8 @@ static void r600_init_screen_caps(struct r600_screen *rscreen) caps->surface_reinterpret_blocks = true; caps->compressed_surface_reinterpret_blocks_layered = true; caps->query_memory_info = true; - caps->query_so_overflow = family >= CHIP_CEDAR; + caps->query_so_overflow = + caps->texture_shadow_lod = family >= CHIP_CEDAR; caps->framebuffer_no_attachment = true; caps->legacy_math_rules = true; caps->can_bind_const_buffer_as_vertex = true; diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp index 65ff403e055..b9e0a576e96 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp @@ -154,6 +154,10 @@ lower_txl_txf_array_or_cube(nir_builder *b, nir_tex_instr *tex) if (min_lod_idx >= 0) lod = nir_fmax(b, lod, tex->src[min_lod_idx].src.ssa); + if (unlikely(tex->sampler_dim == GLSL_SAMPLER_DIM_2D && tex->is_shadow && + tex->is_array)) + lod = nir_fadd(b, lod, nir_imm_float(b, -1.0)); + /* max lod? */ nir_def *lambda_exp = nir_fexp2(b, lod);