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_print.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_print.c')
-rw-r--r-- | src/compiler/nir/nir_print.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 4fa12d2d207..93d1c02f23d 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -186,9 +186,9 @@ print_alu_src(nir_alu_instr *instr, unsigned src, print_state *state) print_src(&instr->src[src].src, state); bool print_swizzle = false; - unsigned used_channels = 0; + nir_component_mask_t used_channels = 0; - for (unsigned i = 0; i < 4; i++) { + for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) { if (!nir_alu_instr_channel_used(instr, src, i)) continue; @@ -204,7 +204,7 @@ print_alu_src(nir_alu_instr *instr, unsigned src, print_state *state) if (print_swizzle || used_channels != live_channels) { fprintf(fp, "."); - for (unsigned i = 0; i < 4; i++) { + for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) { if (!nir_alu_instr_channel_used(instr, src, i)) continue; @@ -227,7 +227,7 @@ print_alu_dest(nir_alu_dest *dest, print_state *state) if (!dest->dest.is_ssa && dest->write_mask != (1 << dest->dest.reg.reg->num_components) - 1) { fprintf(fp, "."); - for (unsigned i = 0; i < 4; i++) + for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) if ((dest->write_mask >> i) & 1) fprintf(fp, "%c", "xyzw"[i]); } @@ -491,6 +491,7 @@ print_var_decl(nir_variable *var, print_state *state) switch (var->data.mode) { case nir_var_shader_in: case nir_var_shader_out: + assert(num_components <= 4); if (num_components < 4 && num_components != 0) { const char *xyzw = "xyzw"; for (int i = 0; i < num_components; i++) |