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 <alyssa.rosenzweig@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5863>
This commit is contained in:
Alejandro Piñeiro
2020-07-11 00:36:23 +02:00
committed by Marge Bot
parent 6e2e77557e
commit 7f25f1f106

View File

@@ -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;