Mesa (master): nir/lower_tex: handle query lod with nir_lower_tex_packing_16 at lower_tex_packing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 5 10:30:08 UTC 2020


Module: Mesa
Branch: master
Commit: 7f25f1f106728f0046672adf9c9ed79185265ea5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f25f1f106728f0046672adf9c9ed79185265ea5

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Sat Jul 11 00:36:23 2020 +0200

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 at collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5863>

---

 src/compiler/nir/nir_lower_tex.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

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;
 



More information about the mesa-commit mailing list