diff options
author | Karol Herbst <[email protected]> | 2018-07-12 03:40:23 +0200 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2018-07-17 13:24:09 +0200 |
commit | 1beef89ad85c47fb6dea565687682e14b8e21101 (patch) | |
tree | 3fcf7893574b44d734e39b06264a72d825d93cd4 /src/compiler/nir/nir.h | |
parent | f65bee7e85221ebbfa26168ca081ae20dc13a13b (diff) |
nir: prepare for bumping up max components to 16
OpenCL knows vector of size 8 and 16.
v2: rebased on master (nir_swizzle rework)
rework more declarations with nir_component_mask_t
adjust print_var_decl
Reviewed-by: Jason Ekstrand <[email protected]>
Signed-off-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 92ab3a699cc..d3e63be091f 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -57,6 +57,8 @@ extern "C" { #define NIR_FALSE 0u #define NIR_TRUE (~0u) +#define NIR_MAX_VEC_COMPONENTS 4 +typedef uint8_t nir_component_mask_t; /** Defines a cast function * @@ -115,16 +117,16 @@ typedef enum { } nir_rounding_mode; typedef union { - float f32[4]; - double f64[4]; - int8_t i8[4]; - uint8_t u8[4]; - int16_t i16[4]; - uint16_t u16[4]; - int32_t i32[4]; - uint32_t u32[4]; - int64_t i64[4]; - uint64_t u64[4]; + float f32[NIR_MAX_VEC_COMPONENTS]; + double f64[NIR_MAX_VEC_COMPONENTS]; + int8_t i8[NIR_MAX_VEC_COMPONENTS]; + uint8_t u8[NIR_MAX_VEC_COMPONENTS]; + int16_t i16[NIR_MAX_VEC_COMPONENTS]; + uint16_t u16[NIR_MAX_VEC_COMPONENTS]; + int32_t i32[NIR_MAX_VEC_COMPONENTS]; + uint32_t u32[NIR_MAX_VEC_COMPONENTS]; + int64_t i64[NIR_MAX_VEC_COMPONENTS]; + uint64_t u64[NIR_MAX_VEC_COMPONENTS]; } nir_const_value; typedef struct nir_constant { @@ -135,7 +137,7 @@ typedef struct nir_constant { * by the type associated with the \c nir_variable. Constants may be * scalars, vectors, or matrices. */ - nir_const_value values[4]; + nir_const_value values[NIR_MAX_VEC_COMPONENTS]; /* we could get this from the var->type but makes clone *much* easier to * not have to care about the type. @@ -697,7 +699,7 @@ typedef struct { * a statement like "foo.xzw = bar.zyx" would have a writemask of 1101b and * a swizzle of {2, x, 1, 0} where x means "don't care." */ - uint8_t swizzle[4]; + uint8_t swizzle[NIR_MAX_VEC_COMPONENTS]; } nir_alu_src; typedef struct { @@ -712,7 +714,7 @@ typedef struct { bool saturate; - unsigned write_mask : 4; /* ignored if dest.is_ssa is true */ + unsigned write_mask : NIR_MAX_VEC_COMPONENTS; /* ignored if dest.is_ssa is true */ } nir_alu_dest; typedef enum { @@ -841,14 +843,14 @@ typedef struct { /** * The number of components in each input */ - unsigned input_sizes[4]; + unsigned input_sizes[NIR_MAX_VEC_COMPONENTS]; /** * The type of vector that each input takes. Note that negate and * absolute value are only allowed on inputs with int or float type and * behave differently on the two. */ - nir_alu_type input_types[4]; + nir_alu_type input_types[NIR_MAX_VEC_COMPONENTS]; nir_op_algebraic_property algebraic_properties; } nir_op_info; @@ -2420,7 +2422,7 @@ void nir_ssa_def_rewrite_uses(nir_ssa_def *def, nir_src new_src); void nir_ssa_def_rewrite_uses_after(nir_ssa_def *def, nir_src new_src, nir_instr *after_me); -uint8_t nir_ssa_def_components_read(const nir_ssa_def *def); +nir_component_mask_t nir_ssa_def_components_read(const nir_ssa_def *def); /* * finds the next basic block in source-code order, returns NULL if there is |