From: Alejandro PiƱeiro Date: Fri, 10 Jul 2020 22:36:23 +0000 (+0200) Subject: nir/lower_tex: handle query lod with nir_lower_tex_packing_16 at lower_tex_packing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f25f1f106728f0046672adf9c9ed79185265ea5;p=mesa.git nir/lower_tex: handle query lod with nir_lower_tex_packing_16 at lower_tex_packing packing_16 with floats assumed 1 (shadow) or 4 components. But query lod operations return 2. Fixes the following test with v3dv: dEQP-VK.ycbcr.query.lod.fragment.r8g8b8a8_unorm Acked-by: Alyssa Rosenzweig Reviewed-by: Iago Toral Quiroga Part-of: --- diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 0d23cde0c28..97521e51e7e 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -830,9 +830,19 @@ lower_tex_packing(nir_builder *b, nir_tex_instr *tex, switch (nir_alu_type_get_base_type(tex->dest_type)) { case nir_type_float: - if (tex->is_shadow && tex->is_new_style_shadow) { + switch (nir_tex_instr_dest_size(tex)) { + case 1: + assert(tex->is_shadow && tex->is_new_style_shadow); color = nir_unpack_half_2x16_split_x(b, nir_channel(b, color, 0)); - } else { + break; + case 2: { + nir_ssa_def *rg = nir_channel(b, color, 0); + color = nir_vec2(b, + nir_unpack_half_2x16_split_x(b, rg), + nir_unpack_half_2x16_split_y(b, rg)); + break; + } + case 4: { nir_ssa_def *rg = nir_channel(b, color, 0); nir_ssa_def *ba = nir_channel(b, color, 1); color = nir_vec4(b, @@ -840,6 +850,10 @@ lower_tex_packing(nir_builder *b, nir_tex_instr *tex, nir_unpack_half_2x16_split_y(b, rg), nir_unpack_half_2x16_split_x(b, ba), nir_unpack_half_2x16_split_y(b, ba)); + break; + } + default: + unreachable("wrong dest_size"); } break;