summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_search.c
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2018-07-12 03:40:23 +0200
committerKarol Herbst <[email protected]>2018-07-17 13:24:09 +0200
commit1beef89ad85c47fb6dea565687682e14b8e21101 (patch)
tree3fcf7893574b44d734e39b06264a72d825d93cd4 /src/compiler/nir/nir_search.c
parentf65bee7e85221ebbfa26168ca081ae20dc13a13b (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_search.c')
-rw-r--r--src/compiler/nir/nir_search.c8
1 files changed, 4 insertions, 4 deletions
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;