vc4: Use nir_channel() to simplify all of our nir_swizzle() cases.
authorEric Anholt <eric@anholt.net>
Sat, 21 Nov 2015 04:42:12 +0000 (20:42 -0800)
committerEric Anholt <eric@anholt.net>
Sun, 22 Nov 2015 02:55:31 +0000 (18:55 -0800)
src/gallium/drivers/vc4/vc4_nir_lower_blend.c
src/gallium/drivers/vc4/vc4_nir_lower_io.c

index 373c9e12d1159b1cfbd1c2b23df2131251514854..0672a92226f24081421b70207e0367989d077872 100644 (file)
@@ -509,8 +509,8 @@ vc4_nir_lower_blend_instr(struct vc4_compile *c, nir_builder *b,
         nir_ssa_def *dst_vec4 = nir_unpack_unorm_4x8(b, packed_dst_color);
         nir_ssa_def *src_color[4], *unpacked_dst_color[4];
         for (unsigned i = 0; i < 4; i++) {
-                src_color[i] = nir_swizzle(b, intr->src[0].ssa, &i, 1, false);
-                unpacked_dst_color[i] = nir_swizzle(b, dst_vec4, &i, 1, false);
+                src_color[i] = nir_channel(b, intr->src[0].ssa, i);
+                unpacked_dst_color[i] = nir_channel(b, dst_vec4, i);
         }
 
         vc4_nir_emit_alpha_test_discard(c, b, src_color[3]);
index 7ea263afb682f0521fd3248285ba69fc7043fdf1..1afe52a63f4c805ac9053bfd74dfa90ced66d5b6 100644 (file)
@@ -84,7 +84,7 @@ vc4_nir_unpack_16u(nir_builder *b, nir_ssa_def *src, unsigned chan)
 static nir_ssa_def *
 vc4_nir_unpack_8f(nir_builder *b, nir_ssa_def *src, unsigned chan)
 {
-        return nir_swizzle(b, nir_unpack_unorm_4x8(b, src), &chan, 1, false);
+        return nir_channel(b, nir_unpack_unorm_4x8(b, src), chan);
 }
 
 static nir_ssa_def *
@@ -326,9 +326,8 @@ vc4_nir_lower_output(struct vc4_compile *c, nir_builder *b,
                 intr_comp->const_index[0] = intr->const_index[0] * 4 + i;
 
                 assert(intr->src[0].is_ssa);
-                intr_comp->src[0] = nir_src_for_ssa(nir_swizzle(b,
-                                                                intr->src[0].ssa,
-                                                                &i, 1, false));
+                intr_comp->src[0] =
+                        nir_src_for_ssa(nir_channel(b, intr->src[0].ssa, i));
                 nir_builder_instr_insert(b, &intr_comp->instr);
         }