From 14b82270837c331adc30bf2a747b3cb720917d67 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 15 Oct 2021 17:23:51 +0100 Subject: [PATCH] nir: add some missing nir_alu_type_get_base_type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rhys Perry Reviewed-by: Timur Kristóf Part-of: --- src/compiler/nir/nir_instr_set.c | 2 +- src/compiler/nir/nir_search_helpers.h | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index 39658ded8b3..443928136fb 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -432,7 +432,7 @@ nir_alu_srcs_negative_equal(const nir_alu_instr *alu1, nir_alu_instr_channel_used(alu2, src2, i)); } - if (nir_op_infos[alu1->op].input_types[src1] == nir_type_float) { + if (nir_alu_type_get_base_type(nir_op_infos[alu1->op].input_types[src1]) == nir_type_float) { assert(nir_op_infos[alu1->op].input_types[src1] == nir_op_infos[alu2->op].input_types[src2]); } else { diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 5048167bde6..2030dff6957 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -148,7 +148,8 @@ is_zero_to_one(UNUSED struct hash_table *ht, const nir_alu_instr *instr, return false; for (unsigned i = 0; i < num_components; i++) { - switch (nir_op_infos[instr->op].input_types[src]) { + nir_alu_type type = nir_op_infos[instr->op].input_types[src]; + switch (nir_alu_type_get_base_type(type)) { case nir_type_float: { double val = nir_src_comp_as_float(instr->src[src].src, swizzle[i]); if (isnan(val) || val < 0.0f || val > 1.0f) @@ -179,7 +180,8 @@ is_gt_0_and_lt_1(UNUSED struct hash_table *ht, const nir_alu_instr *instr, return false; for (unsigned i = 0; i < num_components; i++) { - switch (nir_op_infos[instr->op].input_types[src]) { + nir_alu_type type = nir_op_infos[instr->op].input_types[src]; + switch (nir_alu_type_get_base_type(type)) { case nir_type_float: { double val = nir_src_comp_as_float(instr->src[src].src, swizzle[i]); if (isnan(val) || val <= 0.0f || val >= 1.0f) @@ -395,7 +397,8 @@ is_only_used_as_float(nir_alu_instr *instr) assert(instr != user_alu); unsigned index = (nir_alu_src*)container_of(src, nir_alu_src, src) - user_alu->src; - if (nir_op_infos[user_alu->op].input_types[index] != nir_type_float) + nir_alu_type type = nir_op_infos[user_alu->op].input_types[index]; + if (nir_alu_type_get_base_type(type) != nir_type_float) return false; }