diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2016-06-17 12:29:13 -0700 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2016-08-25 01:38:26 -0700 |
commit | a52830ffe2953c67b4e96cb147e9aa6a66142a25 (patch) | |
tree | 346ef7abe440d24de2dc0b408a5a0f3fb9c5ea88 | |
parent | 91752d803ceb671e482863a0acd925229ccb2f26 (diff) |
nir: Make a nir_alu_type_get_glsl_base_type() helper.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r-- | src/compiler/nir/nir.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5e527d8add1..ba6069f858a 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -684,6 +684,26 @@ nir_alu_type_get_base_type(nir_alu_type type) return type & NIR_ALU_TYPE_BASE_TYPE_MASK; } +static inline enum glsl_base_type +nir_alu_type_get_glsl_base_type(nir_alu_type type) +{ + if (type == nir_type_float64) + return GLSL_TYPE_DOUBLE; + + switch (nir_alu_type_get_base_type(type)) { + case nir_type_int: + return GLSL_TYPE_INT; + case nir_type_uint: + return GLSL_TYPE_UINT; + case nir_type_float: + return GLSL_TYPE_FLOAT; + case nir_type_bool: + return GLSL_TYPE_BOOL; + default: + unreachable("non-existent base type"); + } +} + typedef enum { NIR_OP_IS_COMMUTATIVE = (1 << 0), NIR_OP_IS_ASSOCIATIVE = (1 << 1), |