return &load_const->def;
}
+static inline nir_ssa_def *
+nir_imm_bool(nir_builder *build, bool x)
+{
+ nir_const_value v;
+
+ memset(&v, 0, sizeof(v));
+ v.u32[0] = x ? NIR_TRUE : NIR_FALSE;
+
+ return nir_build_imm(build, 1, 32, v);
+}
+
+static inline nir_ssa_def *
+nir_imm_true(nir_builder *build)
+{
+ return nir_imm_bool(build, true);
+}
+
+static inline nir_ssa_def *
+nir_imm_false(nir_builder *build)
+{
+ return nir_imm_bool(build, false);
+}
+
static inline nir_ssa_def *
nir_imm_float(nir_builder *build, float x)
{
static inline nir_ssa_def *
nir_bany(nir_builder *b, nir_ssa_def *src)
{
- return nir_bany_inequal(b, src, nir_imm_int(b, 0));
+ return nir_bany_inequal(b, src, nir_imm_false(b));
}
static inline nir_ssa_def *
* this is always true within the if statement.
*/
if (n->num_components == 1)
- need_high_div = nir_imm_int(b, NIR_TRUE);
+ need_high_div = nir_imm_true(b);
nir_ssa_def *log2_d_lo = nir_ufind_msb(b, d_lo);
/* Initialize the variable to 0 */
b->cursor = nir_before_cf_list(&b->impl->body);
- nir_store_var(b, state->return_flag, nir_imm_int(b, NIR_FALSE), 1);
+ nir_store_var(b, state->return_flag, nir_imm_false(b), 1);
}
b->cursor = nir_after_block(block);
- nir_store_var(b, state->return_flag, nir_imm_int(b, NIR_TRUE), 1);
+ nir_store_var(b, state->return_flag, nir_imm_true(b), 1);
if (state->loop) {
/* We're in a loop; we need to break out of it. */
case nir_intrinsic_vote_feq:
case nir_intrinsic_vote_ieq:
if (options->lower_vote_trivial)
- return nir_imm_int(b, NIR_TRUE);
+ return nir_imm_true(b);
if (options->lower_vote_eq_to_ballot)
return lower_vote_eq_to_ballot(b, intrin, options);
case nir_intrinsic_vote_feq:
case nir_intrinsic_vote_ieq:
if (nir_src_is_const(intrin->src[0]))
- replacement = nir_imm_int(&b, NIR_TRUE);
+ replacement = nir_imm_true(&b);
break;
default:
break;
default: vtn_fail("invalid number of components");
}
val->ssa->def = nir_build_alu(&b->nb, op, src[0],
- nir_imm_int(&b->nb, NIR_FALSE),
+ nir_imm_false(&b->nb),
NULL, NULL);
}
break;
default: vtn_fail("invalid number of components");
}
val->ssa->def = nir_build_alu(&b->nb, op, src[0],
- nir_imm_int(&b->nb, NIR_TRUE),
+ nir_imm_true(&b->nb),
NULL, NULL);
}
break;
{
switch (branch_type) {
case vtn_branch_type_switch_break:
- nir_store_var(&b->nb, switch_fall_var, nir_imm_int(&b->nb, NIR_FALSE), 1);
+ nir_store_var(&b->nb, switch_fall_var, nir_imm_false(&b->nb), 1);
*has_switch_break = true;
break;
case vtn_branch_type_switch_fallthrough:
nir_local_variable_create(b->nb.impl, glsl_bool_type(), "cont");
b->nb.cursor = nir_before_cf_node(&loop->cf_node);
- nir_store_var(&b->nb, do_cont, nir_imm_int(&b->nb, NIR_FALSE), 1);
+ nir_store_var(&b->nb, do_cont, nir_imm_false(&b->nb), 1);
b->nb.cursor = nir_before_cf_list(&loop->body);
nir_pop_if(&b->nb, cont_if);
- nir_store_var(&b->nb, do_cont, nir_imm_int(&b->nb, NIR_TRUE), 1);
+ nir_store_var(&b->nb, do_cont, nir_imm_true(&b->nb), 1);
b->has_loop_continue = true;
}
*/
nir_variable *fall_var =
nir_local_variable_create(b->nb.impl, glsl_bool_type(), "fall");
- nir_store_var(&b->nb, fall_var, nir_imm_int(&b->nb, NIR_FALSE), 1);
+ nir_store_var(&b->nb, fall_var, nir_imm_false(&b->nb), 1);
/* Next, we gather up all of the conditions. We have to do this
* up-front because we also need to build an "any" condition so
nir_if *case_if = nir_push_if(&b->nb, cond);
bool has_break = false;
- nir_store_var(&b->nb, fall_var, nir_imm_int(&b->nb, NIR_TRUE), 1);
+ nir_store_var(&b->nb, fall_var, nir_imm_true(&b->nb), 1);
vtn_emit_cf_list(b, &cse->body, fall_var, &has_break, handler);
(void)has_break; /* We don't care */
nir_ssa_def *cmp = nir_ilt(b, coord, size);
unsigned coord_comps = glsl_get_sampler_coordinate_components(deref->type);
- nir_ssa_def *in_bounds = nir_imm_int(b, NIR_TRUE);
+ nir_ssa_def *in_bounds = nir_imm_true(b);
for (unsigned i = 0; i < coord_comps; i++)
in_bounds = nir_iand(b, in_bounds, nir_channel(b, cmp, i));