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-18 16:33:49 -0700 |
commit | a8990bfb41f9912d77359899523f5730c2dd4d6d (patch) | |
tree | b287b60f35e3072677662e2263046a4017e12acb | |
parent | 79767345ffc3faecb8866710c9bdb8fed0b36937 (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 9ce5be2176d..398f52e07dc 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), |