spirv: Fix indentation in vtn_handle_ptr
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 27 May 2020 22:41:23 +0000 (17:41 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 24 Jul 2020 03:41:54 +0000 (22:41 -0500)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5278>

src/compiler/spirv/spirv_to_nir.c

index 32a37dc3462414908ceedfd36f5e2689b0277cc1..93969bfede1239c3bfa04626eb2182a8e3179d61 100644 (file)
@@ -4735,59 +4735,59 @@ static void
 vtn_handle_ptr(struct vtn_builder *b, SpvOp opcode,
                const uint32_t *w, unsigned count)
 {
-      struct vtn_type *type1 = vtn_untyped_value(b, w[3])->type;
-      struct vtn_type *type2 = vtn_untyped_value(b, w[4])->type;
-      vtn_fail_if(type1->base_type != vtn_base_type_pointer ||
-                  type2->base_type != vtn_base_type_pointer,
-                  "%s operands must have pointer types",
-                  spirv_op_to_string(opcode));
-      vtn_fail_if(type1->storage_class != type2->storage_class,
-                  "%s operands must have the same storage class",
-                  spirv_op_to_string(opcode));
+   struct vtn_type *type1 = vtn_untyped_value(b, w[3])->type;
+   struct vtn_type *type2 = vtn_untyped_value(b, w[4])->type;
+   vtn_fail_if(type1->base_type != vtn_base_type_pointer ||
+               type2->base_type != vtn_base_type_pointer,
+               "%s operands must have pointer types",
+               spirv_op_to_string(opcode));
+   vtn_fail_if(type1->storage_class != type2->storage_class,
+               "%s operands must have the same storage class",
+               spirv_op_to_string(opcode));
 
-      struct vtn_type *vtn_type =
-         vtn_value(b, w[1], vtn_value_type_type)->type;
-      const struct glsl_type *type = vtn_type->type;
+   struct vtn_type *vtn_type =
+      vtn_value(b, w[1], vtn_value_type_type)->type;
+   const struct glsl_type *type = vtn_type->type;
 
-      nir_address_format addr_format = vtn_mode_to_address_format(
-         b, vtn_storage_class_to_mode(b, type1->storage_class, NULL, NULL));
+   nir_address_format addr_format = vtn_mode_to_address_format(
+      b, vtn_storage_class_to_mode(b, type1->storage_class, NULL, NULL));
 
-      nir_ssa_def *def;
+   nir_ssa_def *def;
 
-      switch (opcode) {
-      case SpvOpPtrDiff: {
-         /* OpPtrDiff returns the difference in number of elements (not byte offset). */
-         unsigned elem_size, elem_align;
-         glsl_get_natural_size_align_bytes(type1->deref->type,
-                                           &elem_size, &elem_align);
-
-         def = nir_build_addr_isub(&b->nb,
-                                   vtn_ssa_value(b, w[3])->def,
-                                   vtn_ssa_value(b, w[4])->def,
-                                   addr_format);
-         def = nir_idiv(&b->nb, def, nir_imm_intN_t(&b->nb, elem_size, def->bit_size));
-         def = nir_i2i(&b->nb, def, glsl_get_bit_size(type));
-         break;
-      }
+   switch (opcode) {
+   case SpvOpPtrDiff: {
+      /* OpPtrDiff returns the difference in number of elements (not byte offset). */
+      unsigned elem_size, elem_align;
+      glsl_get_natural_size_align_bytes(type1->deref->type,
+                                        &elem_size, &elem_align);
 
-      case SpvOpPtrEqual:
-      case SpvOpPtrNotEqual: {
-         def = nir_build_addr_ieq(&b->nb,
-                                  vtn_ssa_value(b, w[3])->def,
-                                  vtn_ssa_value(b, w[4])->def,
-                                  addr_format);
-         if (opcode == SpvOpPtrNotEqual)
-            def = nir_inot(&b->nb, def);
-         break;
-      }
+      def = nir_build_addr_isub(&b->nb,
+                                vtn_ssa_value(b, w[3])->def,
+                                vtn_ssa_value(b, w[4])->def,
+                                addr_format);
+      def = nir_idiv(&b->nb, def, nir_imm_intN_t(&b->nb, elem_size, def->bit_size));
+      def = nir_i2i(&b->nb, def, glsl_get_bit_size(type));
+      break;
+   }
 
-      default:
-         unreachable("Invalid ptr operation");
-      }
+   case SpvOpPtrEqual:
+   case SpvOpPtrNotEqual: {
+      def = nir_build_addr_ieq(&b->nb,
+                               vtn_ssa_value(b, w[3])->def,
+                               vtn_ssa_value(b, w[4])->def,
+                               addr_format);
+      if (opcode == SpvOpPtrNotEqual)
+         def = nir_inot(&b->nb, def);
+      break;
+   }
+
+   default:
+      unreachable("Invalid ptr operation");
+   }
 
-      struct vtn_ssa_value *ssa_value = vtn_create_ssa_value(b, type);
-      ssa_value->def = def;
-      vtn_push_ssa(b, w[2], vtn_type, ssa_value);
+   struct vtn_ssa_value *ssa_value = vtn_create_ssa_value(b, type);
+   ssa_value->def = def;
+   vtn_push_ssa(b, w[2], vtn_type, ssa_value);
 }
 
 static bool