tgsi_to_nir: fix 2-component system values like tess_level_inner_default
authorMarek Olšák <marek.olsak@amd.com>
Wed, 18 Sep 2019 19:12:30 +0000 (15:12 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 23 Sep 2019 19:34:56 +0000 (15:34 -0400)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/auxiliary/nir/tgsi_to_nir.c

index b92a4485e4c0b29a1afe69ce82b61ef96ffebd3a..88e9963e0303d00f58f019348b5b4e329be312ce 100644 (file)
@@ -659,7 +659,9 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index,
          unreachable("bad system value");
       }
 
-      if (load->num_components == 3)
+      if (load->num_components == 2)
+         load = nir_swizzle(b, load, SWIZ(X, Y, Y, Y), 4);
+      else if (load->num_components == 3)
          load = nir_swizzle(b, load, SWIZ(X, Y, Z, Z), 4);
 
       src = nir_src_for_ssa(load);