blorp,anv,hasvk: Use umod_imm
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 19 Mar 2023 10:38:45 +0000 (06:38 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 22 Mar 2023 06:18:18 +0000 (06:18 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22010>

src/intel/blorp/blorp_blit.c
src/intel/blorp/blorp_clear.c
src/intel/vulkan/anv_nir_lower_multiview.c
src/intel/vulkan_hasvk/anv_nir_lower_multiview.c

index 1d0ca31..dee5318 100644 (file)
@@ -1252,7 +1252,7 @@ brw_blorp_build_nir_shader(struct blorp_context *blorp,
        */
       assert(dst_pos->num_components == 2);
       nir_ssa_def *dst_x = nir_channel(&b, dst_pos, 0);
-      comp = nir_umod(&b, dst_x, nir_imm_int(&b, 3));
+      comp = nir_umod_imm(&b, dst_x, 3);
       dst_pos = nir_vec2(&b, nir_idiv(&b, dst_x, nir_imm_int(&b, 3)),
                              nir_channel(&b, dst_pos, 1));
    }
index 82343ae..b03aa7e 100644 (file)
@@ -80,8 +80,7 @@ blorp_params_get_clear_kernel_fs(struct blorp_batch *batch,
 
    if (clear_rgb_as_red) {
       nir_ssa_def *pos = nir_f2i32(&b, nir_load_frag_coord(&b));
-      nir_ssa_def *comp = nir_umod(&b, nir_channel(&b, pos, 0),
-                                       nir_imm_int(&b, 3));
+      nir_ssa_def *comp = nir_umod_imm(&b, nir_channel(&b, pos, 0), 3);
       color = nir_pad_vec4(&b, nir_vector_extract(&b, color, comp));
    }
 
@@ -150,8 +149,7 @@ blorp_params_get_clear_kernel_cs(struct blorp_batch *batch,
    nir_ssa_def *in_bounds = blorp_check_in_bounds(&b, bounds_rect, dst_pos);
 
    if (clear_rgb_as_red) {
-      nir_ssa_def *comp = nir_umod(&b, nir_channel(&b, dst_pos, 0),
-                                       nir_imm_int(&b, 3));
+      nir_ssa_def *comp = nir_umod_imm(&b, nir_channel(&b, dst_pos, 0), 3);
       color = nir_pad_vec4(&b, nir_vector_extract(&b, color, comp));
    }
 
index 4fb66cf..a96edcb 100644 (file)
@@ -91,8 +91,8 @@ build_view_index(struct lower_multiview_state *state)
           * that to an actual view id.
           */
          nir_ssa_def *compacted =
-            nir_umod(b, nir_load_instance_id(b),
-                        nir_imm_int(b, util_bitcount(state->view_mask)));
+            nir_umod_imm(b, nir_load_instance_id(b),
+                            util_bitcount(state->view_mask));
 
          if (util_is_power_of_two_or_zero(state->view_mask + 1)) {
             /* If we have a full view mask, then compacted is what we want */
index 2699c6f..ef408bb 100644 (file)
@@ -91,8 +91,8 @@ build_view_index(struct lower_multiview_state *state)
           * that to an actual view id.
           */
          nir_ssa_def *compacted =
-            nir_umod(b, nir_load_instance_id(b),
-                        nir_imm_int(b, util_bitcount(state->view_mask)));
+            nir_umod_imm(b, nir_load_instance_id(b),
+                            util_bitcount(state->view_mask));
 
          if (util_is_power_of_two_or_zero(state->view_mask + 1)) {
             /* If we have a full view mask, then compacted is what we want */