From: Jason Ekstrand Date: Wed, 27 May 2020 22:41:23 +0000 (-0500) Subject: spirv: Fix indentation in vtn_handle_ptr X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62c53ad20b77691804de656dfa9caad49b196581;p=mesa.git spirv: Fix indentation in vtn_handle_ptr Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 32a37dc3462..93969bfede1 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -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