ptn,ttn: Use nir_channel for selecting channels
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 6 May 2019 15:20:23 +0000 (10:20 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 24 May 2019 13:38:11 +0000 (08:38 -0500)
Both of these passes predate the nir_channel helper.  We should just use
it instead of hand-rolling it in both passes.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/auxiliary/nir/tgsi_to_nir.c
src/mesa/program/prog_to_nir.c

index aa9321f..09d7798 100644 (file)
@@ -109,7 +109,7 @@ struct ttn_compile {
 #define ttn_swizzle(b, src, x, y, z, w) \
    nir_swizzle(b, src, SWIZ(x, y, z, w), 4, false)
 #define ttn_channel(b, src, swiz) \
-   nir_swizzle(b, src, SWIZ(swiz, swiz, swiz, swiz), 1, false)
+   nir_channel(b, src, TGSI_SWIZZLE_##swiz)
 
 static gl_varying_slot
 tgsi_varying_semantic_to_slot(unsigned semantic, unsigned index)
index dda3cd9..52a1253 100644 (file)
@@ -62,7 +62,7 @@ struct ptn_compile {
 
 #define SWIZ(X, Y, Z, W) \
    (unsigned[4]){ SWIZZLE_##X, SWIZZLE_##Y, SWIZZLE_##Z, SWIZZLE_##W }
-#define ptn_channel(b, src, ch) nir_swizzle(b, src, SWIZ(ch, ch, ch, ch), 1, true)
+#define ptn_channel(b, src, ch) nir_channel(b, src, SWIZZLE_##ch)
 
 static nir_ssa_def *
 ptn_src_for_dest(struct ptn_compile *c, nir_alu_dest *dest)