spirv: Fix indentation in vtn_handle_ptr
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5278>
This commit is contained in:
@@ -4735,59 +4735,59 @@ static void
|
|||||||
vtn_handle_ptr(struct vtn_builder *b, SpvOp opcode,
|
vtn_handle_ptr(struct vtn_builder *b, SpvOp opcode,
|
||||||
const uint32_t *w, unsigned count)
|
const uint32_t *w, unsigned count)
|
||||||
{
|
{
|
||||||
struct vtn_type *type1 = vtn_untyped_value(b, w[3])->type;
|
struct vtn_type *type1 = vtn_untyped_value(b, w[3])->type;
|
||||||
struct vtn_type *type2 = vtn_untyped_value(b, w[4])->type;
|
struct vtn_type *type2 = vtn_untyped_value(b, w[4])->type;
|
||||||
vtn_fail_if(type1->base_type != vtn_base_type_pointer ||
|
vtn_fail_if(type1->base_type != vtn_base_type_pointer ||
|
||||||
type2->base_type != vtn_base_type_pointer,
|
type2->base_type != vtn_base_type_pointer,
|
||||||
"%s operands must have pointer types",
|
"%s operands must have pointer types",
|
||||||
spirv_op_to_string(opcode));
|
spirv_op_to_string(opcode));
|
||||||
vtn_fail_if(type1->storage_class != type2->storage_class,
|
vtn_fail_if(type1->storage_class != type2->storage_class,
|
||||||
"%s operands must have the same storage class",
|
"%s operands must have the same storage class",
|
||||||
spirv_op_to_string(opcode));
|
spirv_op_to_string(opcode));
|
||||||
|
|
||||||
struct vtn_type *vtn_type =
|
struct vtn_type *vtn_type =
|
||||||
vtn_value(b, w[1], vtn_value_type_type)->type;
|
vtn_value(b, w[1], vtn_value_type_type)->type;
|
||||||
const struct glsl_type *type = vtn_type->type;
|
const struct glsl_type *type = vtn_type->type;
|
||||||
|
|
||||||
nir_address_format addr_format = vtn_mode_to_address_format(
|
nir_address_format addr_format = vtn_mode_to_address_format(
|
||||||
b, vtn_storage_class_to_mode(b, type1->storage_class, NULL, NULL));
|
b, vtn_storage_class_to_mode(b, type1->storage_class, NULL, NULL));
|
||||||
|
|
||||||
nir_ssa_def *def;
|
nir_ssa_def *def;
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case SpvOpPtrDiff: {
|
case SpvOpPtrDiff: {
|
||||||
/* OpPtrDiff returns the difference in number of elements (not byte offset). */
|
/* OpPtrDiff returns the difference in number of elements (not byte offset). */
|
||||||
unsigned elem_size, elem_align;
|
unsigned elem_size, elem_align;
|
||||||
glsl_get_natural_size_align_bytes(type1->deref->type,
|
glsl_get_natural_size_align_bytes(type1->deref->type,
|
||||||
&elem_size, &elem_align);
|
&elem_size, &elem_align);
|
||||||
|
|
||||||
def = nir_build_addr_isub(&b->nb,
|
def = nir_build_addr_isub(&b->nb,
|
||||||
vtn_ssa_value(b, w[3])->def,
|
vtn_ssa_value(b, w[3])->def,
|
||||||
vtn_ssa_value(b, w[4])->def,
|
vtn_ssa_value(b, w[4])->def,
|
||||||
addr_format);
|
addr_format);
|
||||||
def = nir_idiv(&b->nb, def, nir_imm_intN_t(&b->nb, elem_size, def->bit_size));
|
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));
|
def = nir_i2i(&b->nb, def, glsl_get_bit_size(type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SpvOpPtrEqual:
|
case SpvOpPtrEqual:
|
||||||
case SpvOpPtrNotEqual: {
|
case SpvOpPtrNotEqual: {
|
||||||
def = nir_build_addr_ieq(&b->nb,
|
def = nir_build_addr_ieq(&b->nb,
|
||||||
vtn_ssa_value(b, w[3])->def,
|
vtn_ssa_value(b, w[3])->def,
|
||||||
vtn_ssa_value(b, w[4])->def,
|
vtn_ssa_value(b, w[4])->def,
|
||||||
addr_format);
|
addr_format);
|
||||||
if (opcode == SpvOpPtrNotEqual)
|
if (opcode == SpvOpPtrNotEqual)
|
||||||
def = nir_inot(&b->nb, def);
|
def = nir_inot(&b->nb, def);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Invalid ptr operation");
|
unreachable("Invalid ptr operation");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct vtn_ssa_value *ssa_value = vtn_create_ssa_value(b, type);
|
struct vtn_ssa_value *ssa_value = vtn_create_ssa_value(b, type);
|
||||||
ssa_value->def = def;
|
ssa_value->def = def;
|
||||||
vtn_push_ssa(b, w[2], vtn_type, ssa_value);
|
vtn_push_ssa(b, w[2], vtn_type, ssa_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Reference in New Issue
Block a user