summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp6
-rw-r--r--src/compiler/nir/nir_builder.h9
-rw-r--r--src/compiler/nir/nir_builtin_builder.c8
-rw-r--r--src/compiler/nir/nir_lower_tex.c16
-rw-r--r--src/compiler/nir/nir_lower_vars_to_ssa.c2
-rw-r--r--src/compiler/nir/nir_split_vars.c2
-rw-r--r--src/compiler/spirv/spirv_to_nir.c4
-rw-r--r--src/compiler/spirv/vtn_glsl450.c18
8 files changed, 32 insertions, 33 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index d21ad90505e..9152b02967c 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -1634,7 +1634,7 @@ nir_visitor::visit(ir_assignment *ir)
for (unsigned i = 0; i < 4; i++) {
swiz[i] = ir->write_mask & (1 << i) ? component++ : 0;
}
- src = nir_swizzle(&b, src, swiz, num_components, false);
+ src = nir_swizzle(&b, src, swiz, num_components);
}
if (ir->condition) {
@@ -1816,7 +1816,7 @@ nir_visitor::visit(ir_expression *ir)
};
result = nir_swizzle(&b, result, swiz,
- swizzle->type->vector_elements, false);
+ swizzle->type->vector_elements);
}
return;
@@ -2276,7 +2276,7 @@ nir_visitor::visit(ir_swizzle *ir)
{
unsigned swizzle[4] = { ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w };
result = nir_swizzle(&b, evaluate_rvalue(ir->val), swizzle,
- ir->type->vector_elements, false);
+ ir->type->vector_elements);
}
void
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index ced009a66c7..68cf886fa1c 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -528,7 +528,7 @@ nir_imov_alu(nir_builder *build, nir_alu_src src, unsigned num_components)
*/
static inline nir_ssa_def *
nir_swizzle(nir_builder *build, nir_ssa_def *src, const unsigned *swiz,
- unsigned num_components, bool use_fmov)
+ unsigned num_components)
{
assert(num_components <= NIR_MAX_VEC_COMPONENTS);
nir_alu_src alu_src = { NIR_SRC_INIT };
@@ -544,8 +544,7 @@ nir_swizzle(nir_builder *build, nir_ssa_def *src, const unsigned *swiz,
if (num_components == src->num_components && is_identity_swizzle)
return src;
- return use_fmov ? nir_fmov_alu(build, alu_src, num_components) :
- nir_imov_alu(build, alu_src, num_components);
+ return nir_imov_alu(build, alu_src, num_components);
}
/* Selects the right fdot given the number of components in each source. */
@@ -587,7 +586,7 @@ nir_bany(nir_builder *b, nir_ssa_def *src)
static inline nir_ssa_def *
nir_channel(nir_builder *b, nir_ssa_def *def, unsigned c)
{
- return nir_swizzle(b, def, &c, 1, false);
+ return nir_swizzle(b, def, &c, 1);
}
static inline nir_ssa_def *
@@ -601,7 +600,7 @@ nir_channels(nir_builder *b, nir_ssa_def *def, nir_component_mask_t mask)
swizzle[num_channels++] = i;
}
- return nir_swizzle(b, def, swizzle, num_channels, false);
+ return nir_swizzle(b, def, swizzle, num_channels);
}
static inline nir_ssa_def *
diff --git a/src/compiler/nir/nir_builtin_builder.c b/src/compiler/nir/nir_builtin_builder.c
index a050306765e..8812c7a6a8a 100644
--- a/src/compiler/nir/nir_builtin_builder.c
+++ b/src/compiler/nir/nir_builtin_builder.c
@@ -32,10 +32,10 @@ nir_cross3(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y)
unsigned yzx[3] = { 1, 2, 0 };
unsigned zxy[3] = { 2, 0, 1 };
- return nir_fsub(b, nir_fmul(b, nir_swizzle(b, x, yzx, 3, true),
- nir_swizzle(b, y, zxy, 3, true)),
- nir_fmul(b, nir_swizzle(b, x, zxy, 3, true),
- nir_swizzle(b, y, yzx, 3, true)));
+ return nir_fsub(b, nir_fmul(b, nir_swizzle(b, x, yzx, 3),
+ nir_swizzle(b, y, zxy, 3)),
+ nir_fmul(b, nir_swizzle(b, x, zxy, 3),
+ nir_swizzle(b, y, yzx, 3)));
}
nir_ssa_def*
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 0e1aa26a904..53719017a87 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -589,20 +589,20 @@ lower_gradient_cube_map(nir_builder *b, nir_tex_instr *tex)
Q = nir_bcsel(b, cond_z,
p,
nir_bcsel(b, cond_y,
- nir_swizzle(b, p, xzy, 3, false),
- nir_swizzle(b, p, yzx, 3, false)));
+ nir_swizzle(b, p, xzy, 3),
+ nir_swizzle(b, p, yzx, 3)));
dQdx = nir_bcsel(b, cond_z,
dPdx,
nir_bcsel(b, cond_y,
- nir_swizzle(b, dPdx, xzy, 3, false),
- nir_swizzle(b, dPdx, yzx, 3, false)));
+ nir_swizzle(b, dPdx, xzy, 3),
+ nir_swizzle(b, dPdx, yzx, 3)));
dQdy = nir_bcsel(b, cond_z,
dPdy,
nir_bcsel(b, cond_y,
- nir_swizzle(b, dPdy, xzy, 3, false),
- nir_swizzle(b, dPdy, yzx, 3, false)));
+ nir_swizzle(b, dPdy, xzy, 3),
+ nir_swizzle(b, dPdy, yzx, 3)));
/* 2. quotient rule */
@@ -780,7 +780,7 @@ swizzle_tg4_broadcom(nir_builder *b, nir_tex_instr *tex)
assert(nir_tex_instr_dest_size(tex) == 4);
unsigned swiz[4] = { 2, 3, 1, 0 };
- nir_ssa_def *swizzled = nir_swizzle(b, &tex->dest.ssa, swiz, 4, false);
+ nir_ssa_def *swizzled = nir_swizzle(b, &tex->dest.ssa, swiz, 4);
nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, nir_src_for_ssa(swizzled),
swizzled->parent_instr);
@@ -808,7 +808,7 @@ swizzle_result(nir_builder *b, nir_tex_instr *tex, const uint8_t swizzle[4])
swizzle[2] < 4 && swizzle[3] < 4) {
unsigned swiz[4] = { swizzle[0], swizzle[1], swizzle[2], swizzle[3] };
/* We have no 0s or 1s, just emit a swizzling MOV */
- swizzled = nir_swizzle(b, &tex->dest.ssa, swiz, 4, false);
+ swizzled = nir_swizzle(b, &tex->dest.ssa, swiz, 4);
} else {
nir_ssa_def *srcs[4];
for (unsigned i = 0; i < 4; i++) {
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c
index a5f4ca53cf9..8239eb069c5 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -589,7 +589,7 @@ rename_variables(struct lower_variables_state *state)
swiz[i] = i < intrin->num_components ? i : 0;
new_def = nir_swizzle(&b, value, swiz,
- intrin->num_components, false);
+ intrin->num_components);
} else {
nir_ssa_def *old_def =
nir_phi_builder_value_get_block_def(node->pb_value, block);
diff --git a/src/compiler/nir/nir_split_vars.c b/src/compiler/nir/nir_split_vars.c
index 5e799d2dc57..62f322236e3 100644
--- a/src/compiler/nir/nir_split_vars.c
+++ b/src/compiler/nir/nir_split_vars.c
@@ -1464,7 +1464,7 @@ shrink_vec_var_access_impl(nir_function_impl *impl,
b.cursor = nir_before_instr(&intrin->instr);
nir_ssa_def *swizzled =
- nir_swizzle(&b, intrin->src[1].ssa, swizzle, c, false);
+ nir_swizzle(&b, intrin->src[1].ssa, swizzle, c);
/* Rewrite to use the compacted source */
nir_instr_rewrite_src(&intrin->instr, &intrin->src[1],
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 9a66b9a28cb..d877077fa3b 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2458,7 +2458,7 @@ get_image_coord(struct vtn_builder *b, uint32_t value)
for (unsigned i = 0; i < 4; i++)
swizzle[i] = MIN2(i, dim - 1);
- return nir_swizzle(&b->nb, coord->def, swizzle, 4, false);
+ return nir_swizzle(&b->nb, coord->def, swizzle, 4);
}
static nir_ssa_def *
@@ -2470,7 +2470,7 @@ expand_to_vec4(nir_builder *b, nir_ssa_def *value)
unsigned swiz[4];
for (unsigned i = 0; i < 4; i++)
swiz[i] = i < value->num_components ? i : 0;
- return nir_swizzle(b, value, swiz, 4, false);
+ return nir_swizzle(b, value, swiz, 4);
}
static void
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index adfdc1a790c..753e74cf73c 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -40,7 +40,7 @@ static nir_ssa_def *
build_mat2_det(nir_builder *b, nir_ssa_def *col[2])
{
unsigned swiz[2] = {1, 0 };
- nir_ssa_def *p = nir_fmul(b, col[0], nir_swizzle(b, col[1], swiz, 2, true));
+ nir_ssa_def *p = nir_fmul(b, col[0], nir_swizzle(b, col[1], swiz, 2));
return nir_fsub(b, nir_channel(b, p, 0), nir_channel(b, p, 1));
}
@@ -52,12 +52,12 @@ build_mat3_det(nir_builder *b, nir_ssa_def *col[3])
nir_ssa_def *prod0 =
nir_fmul(b, col[0],
- nir_fmul(b, nir_swizzle(b, col[1], yzx, 3, true),
- nir_swizzle(b, col[2], zxy, 3, true)));
+ nir_fmul(b, nir_swizzle(b, col[1], yzx, 3),
+ nir_swizzle(b, col[2], zxy, 3)));
nir_ssa_def *prod1 =
nir_fmul(b, col[0],
- nir_fmul(b, nir_swizzle(b, col[1], zxy, 3, true),
- nir_swizzle(b, col[2], yzx, 3, true)));
+ nir_fmul(b, nir_swizzle(b, col[1], zxy, 3),
+ nir_swizzle(b, col[2], yzx, 3)));
nir_ssa_def *diff = nir_fsub(b, prod0, prod1);
@@ -76,9 +76,9 @@ build_mat4_det(nir_builder *b, nir_ssa_def **col)
swiz[j] = j + (j >= i);
nir_ssa_def *subcol[3];
- subcol[0] = nir_swizzle(b, col[1], swiz, 3, true);
- subcol[1] = nir_swizzle(b, col[2], swiz, 3, true);
- subcol[2] = nir_swizzle(b, col[3], swiz, 3, true);
+ subcol[0] = nir_swizzle(b, col[1], swiz, 3);
+ subcol[1] = nir_swizzle(b, col[2], swiz, 3);
+ subcol[2] = nir_swizzle(b, col[3], swiz, 3);
subdet[i] = build_mat3_det(b, subcol);
}
@@ -130,7 +130,7 @@ build_mat_subdet(struct nir_builder *b, struct vtn_ssa_value *src,
for (unsigned j = 0; j < size; j++) {
if (j != col) {
subcol[j - (j > col)] = nir_swizzle(b, src->elems[j]->def,
- swiz, size - 1, true);
+ swiz, size - 1);
}
}