From 5f4a2f6cfed2df5e868907befadc15fc054a6887 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 9 May 2023 11:24:30 -0400 Subject: [PATCH] zink: move get_alu_type() up in file Part-of: --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index dc0342a93c7..2e61f3c8ae8 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -346,6 +346,38 @@ get_uvec_type(struct ntv_context *ctx, unsigned bit_size, unsigned num_component return uint_type; } +static SpvId +get_alu_type(struct ntv_context *ctx, nir_alu_type type, unsigned num_components, unsigned bit_size) +{ + if (bit_size == 1) + return get_bvec_type(ctx, num_components); + + switch (nir_alu_type_get_base_type(type)) { + case nir_type_bool: + unreachable("bool should have bit-size 1"); + + case nir_type_int: + case nir_type_int8: + case nir_type_int16: + case nir_type_int64: + return get_ivec_type(ctx, bit_size, num_components); + + case nir_type_uint: + case nir_type_uint8: + case nir_type_uint16: + case nir_type_uint64: + return get_uvec_type(ctx, bit_size, num_components); + + case nir_type_float: + case nir_type_float16: + case nir_type_float64: + return get_fvec_type(ctx, bit_size, num_components); + + default: + unreachable("unsupported nir_alu_type"); + } +} + static SpvStorageClass get_storage_class(struct nir_variable *var) { @@ -1962,38 +1994,6 @@ store_alu_result(struct ntv_context *ctx, nir_alu_instr *alu, SpvId result, bool force_float ? nir_type_float : nir_op_infos[alu->op].output_type); } -static SpvId -get_alu_type(struct ntv_context *ctx, nir_alu_type type, unsigned num_components, unsigned bit_size) -{ - if (bit_size == 1) - return get_bvec_type(ctx, num_components); - - switch (nir_alu_type_get_base_type(type)) { - case nir_type_bool: - unreachable("bool should have bit-size 1"); - - case nir_type_int: - case nir_type_int8: - case nir_type_int16: - case nir_type_int64: - return get_ivec_type(ctx, bit_size, num_components); - - case nir_type_uint: - case nir_type_uint8: - case nir_type_uint16: - case nir_type_uint64: - return get_uvec_type(ctx, bit_size, num_components); - - case nir_type_float: - case nir_type_float16: - case nir_type_float64: - return get_fvec_type(ctx, bit_size, num_components); - - default: - unreachable("unsupported nir_alu_type"); - } -} - static SpvId get_dest_type(struct ntv_context *ctx, nir_dest *dest, nir_alu_type type) {