From 1beef89ad85c47fb6dea565687682e14b8e21101 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 12 Jul 2018 03:40:23 +0200 Subject: 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 Signed-off-by: Karol Herbst --- src/compiler/nir/nir_search.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/compiler/nir/nir_search.c') diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 28b36b2b863..21fcbe7aaec 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -41,7 +41,7 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr, unsigned num_components, const uint8_t *swizzle, struct match_state *state); -static const uint8_t identity_swizzle[] = { 0, 1, 2, 3 }; +static const uint8_t identity_swizzle[NIR_MAX_VEC_COMPONENTS] = { 0, 1, 2, 3 }; /** * Check if a source produces a value of the given type. @@ -97,7 +97,7 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src, unsigned num_components, const uint8_t *swizzle, struct match_state *state) { - uint8_t new_swizzle[4]; + uint8_t new_swizzle[NIR_MAX_VEC_COMPONENTS]; /* Searching only works on SSA values because, if it's not SSA, we can't * know if the value changed between one instance of that value in the @@ -167,7 +167,7 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src, state->variables[var->variable].abs = false; state->variables[var->variable].negate = false; - for (unsigned i = 0; i < 4; ++i) { + for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i) { if (i < num_components) state->variables[var->variable].swizzle[i] = new_swizzle[i]; else @@ -606,7 +606,7 @@ nir_alu_instr * nir_replace_instr(nir_alu_instr *instr, const nir_search_expression *search, const nir_search_value *replace, void *mem_ctx) { - uint8_t swizzle[4] = { 0, 0, 0, 0 }; + uint8_t swizzle[NIR_MAX_VEC_COMPONENTS] = { 0 }; for (unsigned i = 0; i < instr->dest.dest.ssa.num_components; ++i) swizzle[i] = i; -- cgit v1.2.3