anv: use imm-helpers
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 16 Jun 2023 13:45:17 +0000 (15:45 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Jun 2023 07:08:19 +0000 (07:08 +0000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23855>

src/intel/vulkan/anv_nir_apply_pipeline_layout.c
src/intel/vulkan/anv_nir_lower_multiview.c

index e76520f..86311db 100644 (file)
@@ -723,8 +723,9 @@ build_surface_index_for_binding(nir_builder *b,
 
          /* With bindless indexes are offsets in the descriptor buffer */
          surface_index =
-            nir_iadd(b, nir_imm_int(b, bind_layout->descriptor_offset),
-                     nir_imul_imm(b, array_index, bind_layout->descriptor_stride));
+            nir_iadd_imm(b,
+                         nir_imul_imm(b, array_index, bind_layout->descriptor_stride),
+                         bind_layout->descriptor_offset);
          if (plane != 0) {
             assert(plane < bind_layout->max_plane_count);
             surface_index = nir_iadd_imm(b, surface_index,
index 4b4ebb5..b545922 100644 (file)
@@ -109,7 +109,7 @@ build_view_index(struct lower_multiview_state *state)
                remap |= (uint64_t)bit << (i++ * 4);
             }
 
-            nir_ssa_def *shift = nir_imul(b, compacted, nir_imm_int(b, 4));
+            nir_ssa_def *shift = nir_imul_imm(b, compacted, 4);
 
             /* One of these days, when we have int64 everywhere, this will be
              * easier.
@@ -122,11 +122,11 @@ build_view_index(struct lower_multiview_state *state)
                   nir_ushr(b, nir_imm_int(b, remap), shift);
                nir_ssa_def *shifted_high =
                   nir_ushr(b, nir_imm_int(b, remap >> 32),
-                              nir_isub(b, shift, nir_imm_int(b, 32)));
+                              nir_iadd_imm(b, shift, -32));
                shifted = nir_bcsel(b, nir_ilt_imm(b, shift, 32),
                                       shifted_low, shifted_high);
             }
-            state->view_index = nir_iand(b, shifted, nir_imm_int(b, 0xf));
+            state->view_index = nir_iand_imm(b, shifted, 0xf);
          }
       } else {
          const struct glsl_type *type = glsl_int_type();