intel/nir: Clean up lower_alpha_to_coverage a bit
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 7 Aug 2020 16:25:24 +0000 (11:25 -0500)
committerMarge Bot <eric+marge@anholt.net>
Sat, 29 Aug 2020 16:41:05 +0000 (16:41 +0000)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6233>

src/intel/compiler/brw_nir_lower_alpha_to_coverage.c

index d31384e5615cfaf9275375b888d4296da055b382..2f07ed451bb14e3e1dd4af4d00cbd1fbde13a9b3 100644 (file)
@@ -65,21 +65,16 @@ build_dither_mask(nir_builder *b, nir_ssa_def *color)
       nir_f2i32(b, nir_fmul_imm(b, nir_fsat(b, alpha), 16.0));
 
    nir_ssa_def *part_a =
-      nir_iand(b,
-               nir_imm_int(b, 0xf),
-               nir_ushr(b,
-                        nir_imm_int(b, 0xfea80),
-                        nir_iand(b, m, nir_imm_int(b, ~3))));
+      nir_iand_imm(b, nir_ushr(b, nir_imm_int(b, 0xfea80),
+                                  nir_iand_imm(b, m, ~3)),
+                      0xf);
 
-   nir_ssa_def *part_b = nir_iand(b, m, nir_imm_int(b, 2));
+   nir_ssa_def *part_b = nir_iand_imm(b, m, 2);
+   nir_ssa_def *part_c = nir_iand_imm(b, m, 1);
 
-   nir_ssa_def *part_c = nir_iand(b, m, nir_imm_int(b, 1));
-
-   return nir_ior(b,
-                  nir_imul_imm(b, part_a, 0x1111),
-                  nir_ior(b,
-                          nir_imul_imm(b, part_b, 0x0808),
-                          nir_imul_imm(b, part_c, 0x0100)));
+   return nir_ior(b, nir_imul_imm(b, part_a, 0x1111),
+                     nir_ior(b, nir_imul_imm(b, part_b, 0x0808),
+                                nir_imul_imm(b, part_c, 0x0100)));
 }
 
 bool