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.c | |
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.c')
-rw-r--r-- | src/compiler/nir/nir.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index ca89a46f7d4..bc7f05b3e86 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -251,7 +251,7 @@ nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src, nir_src_copy(&dest->src, &src->src, &instr->instr); dest->abs = src->abs; dest->negate = src->negate; - for (unsigned i = 0; i < 4; i++) + for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) dest->swizzle[i] = src->swizzle[i]; } @@ -421,10 +421,8 @@ alu_src_init(nir_alu_src *src) { src_init(&src->src); src->abs = src->negate = false; - src->swizzle[0] = 0; - src->swizzle[1] = 1; - src->swizzle[2] = 2; - src->swizzle[3] = 3; + for (int i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i) + src->swizzle[i] = i; } nir_alu_instr * @@ -1426,10 +1424,10 @@ nir_ssa_def_rewrite_uses_after(nir_ssa_def *def, nir_src new_src, nir_if_rewrite_condition(use_src->parent_if, new_src); } -uint8_t +nir_component_mask_t nir_ssa_def_components_read(const nir_ssa_def *def) { - uint8_t read_mask = 0; + nir_component_mask_t read_mask = 0; nir_foreach_use(use, def) { if (use->parent_instr->type == nir_instr_type_alu) { nir_alu_instr *alu = nir_instr_as_alu(use->parent_instr); @@ -1437,7 +1435,7 @@ nir_ssa_def_components_read(const nir_ssa_def *def) int src_idx = alu_src - &alu->src[0]; assert(src_idx >= 0 && src_idx < nir_op_infos[alu->op].num_inputs); - for (unsigned c = 0; c < 4; c++) { + for (unsigned c = 0; c < NIR_MAX_VEC_COMPONENTS; c++) { if (!nir_alu_instr_channel_used(alu, src_idx, c)) continue; |