perl -p0e 's/nir_builder_init\(&([^,]*), /\1 = nir_builder_create(/g' -i $(git grep -l nir_builder_init)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23860>
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
struct move_tex_coords_state state;
- nir_builder_init(&state.toplevel_b, impl);
+ state.toplevel_b = nir_builder_create(impl);
state.options = options;
state.num_wqm_vgprs = 0;
if (!function->impl)
continue;
- nir_builder_init(&b, function->impl);
+ b = nir_builder_create(function->impl);
/* Iterate in reverse so load_ubo lowering can look at
* the vulkan_resource_index to tell if it's an inline
if (!function->impl)
continue;
- nir_builder_init(&b, function->impl);
+ b = nir_builder_create(function->impl);
nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) {
{
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
struct rt_variables vars = create_rt_variables(shader, pCreateInfo->flags);
lower_rt_instructions(shader, &vars, 0);
{
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
/* Kill samples that are NOT covered by the mask */
assert(f->impl == impl);
}
- nir_builder_init(&state.b, impl);
+ state.b = nir_builder_create(impl);
state.consts = consts;
state.prog = prog;
state.mem_ctx = mem_ctx;
this->is_global = false;
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
b.cursor = nir_after_cf_list(&impl->body);
unsigned i = (ir->return_type != glsl_type::void_type) ? 1 : 0;
nir_rematerialize_derefs_in_use_blocks_impl(nir_function_impl *impl)
{
struct rematerialize_deref_state state = { 0 };
- nir_builder_init(&state.builder, impl);
+ state.builder = nir_builder_create(impl);
nir_foreach_block_unstructured(block, impl) {
state.block = block;
struct from_ssa_state state;
- nir_builder_init(&state.builder, impl);
+ state.builder = nir_builder_create(impl);
state.dead_ctx = ralloc_context(NULL);
state.phi_webs_only = phi_webs_only;
state.merge_node_table = _mesa_pointer_hash_table_create(NULL);
if (!ucp_enables)
return false;
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
/* NIR should ensure that, even in case of loops/if-else, there
* should be only a single predecessor block to end_block, which
create_clipdist_vars(shader, out, ucp_enables, true,
use_clipdist_array);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
nir_foreach_block(block, impl)
lower_clip_in_gs_block(&b, block, position, clipvertex, out,
struct lower_io_state state;
bool progress = false;
- nir_builder_init(&state.builder, impl);
+ state.builder = nir_builder_create(impl);
state.dead_ctx = ralloc_context(NULL);
state.modes = modes;
state.type_size = type_size;
{
struct locals_to_regs_state state;
- nir_builder_init(&state.builder, impl);
+ state.builder = nir_builder_create(impl);
state.progress = false;
state.regs_table = _mesa_hash_table_create(NULL, hash_deref, derefs_equal);
state.bool_bitsize = bool_bitsize;
nir_variable *in, *out;
nir_ssa_def *def;
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
/* The edge flag is the last input in st/mesa. This code is also called by
nir_foreach_function(function, shader) {
if (function->impl) {
- nir_builder_init(&state.b, function->impl);
+ state.b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
lower_pntc_ytransform_block(&state, block);
nir_builder b;
nir_variable *in, *new_out = NULL;
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
in = nir_state_variable_create(shader, glsl_vec4_type(),
"gl_PointSizeClampedMESA",
state.return_flag = NULL;
state.has_predicated_return = false;
state.removed_unreachable_code = false;
- nir_builder_init(&state.builder, impl);
+ state.builder = nir_builder_create(impl);
bool progress = lower_returns_in_cf_list(&impl->body, &state);
progress = progress || state.removed_unreachable_code;
}
nir_builder before, after;
- nir_builder_init(&before, impl);
- nir_builder_init(&after, impl);
+ before = nir_builder_create(impl);
+ after = nir_builder_create(impl);
call_idx = 0;
unsigned max_scratch_size = shader->scratch_size;
combine_stores_impl(struct combine_stores_state *state, nir_function_impl *impl)
{
state->progress = false;
- nir_builder_init(&state->b, impl);
+ state->b = nir_builder_create(impl);
nir_foreach_block(block, impl)
combine_stores_block(state, block);
nir_builder bld;
block_queue_init(&bq);
- nir_builder_init(&bld, impl);
+ bld = nir_builder_create(impl);
nir_metadata_require(impl, nir_metadata_dominance);
nir_foreach_function(function, shader) {
if (function->impl) {
- nir_builder_init(&builder, function->impl);
+ builder = nir_builder_create(function->impl);
bool impl_progress = false;
nir_foreach_block_safe(block, function->impl) {
s.dead_ctx = ralloc_context(NULL);
s.var_nodes = _mesa_pointer_hash_table_create(s.dead_ctx);
s.cast_nodes = _mesa_pointer_hash_table_create(s.dead_ctx);
- nir_builder_init(&s.builder, impl);
+ s.builder = nir_builder_create(impl);
nir_foreach_block(block, impl) {
if (opt_find_array_copies_block(&b, block, &s))
nir_function *main_entry_point = nir_function_create(b->shader, func_name);
nir_function_impl *impl = nir_function_impl_create(main_entry_point);
- nir_builder_init(&b->nb, impl);
+ b->nb = nir_builder_create(impl);
b->nb.cursor = nir_after_cf_list(&impl->body);
b->func_param_idx = 0;
* directly in our OpFunctionParameter handler.
*/
nir_function_impl *impl = nir_function_impl_create(func);
- nir_builder_init(&b->nb, impl);
+ b->nb = nir_builder_create(impl);
b->nb.cursor = nir_before_cf_list(&impl->body);
b->nb.exact = b->exact;
}
nir_function_impl *impl = func->nir_func->impl;
- nir_builder_init(&b->nb, impl);
+ b->nb = nir_builder_create(impl);
b->func = func;
b->nb.cursor = nir_after_cf_list(&impl->body);
b->nb.exact = b->exact;
assert(missing_mask != 0);
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
nir_ssa_def *zero = nir_imm_zero(&b, 4, 32);
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_ssa_def *primitive_id;
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
nir_variable *primitive_id_var = nir_variable_create(shader, nir_var_shader_out,
glsl_uint_type(), "primitive_id");
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_variable *tmp_vars[VARYING_SLOT_MAX] = {0};
nir_variable *out_vars[VARYING_SLOT_MAX] = {0};
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
shader->info.gs.vertices_out = (shader->info.gs.vertices_out - 2) * 3;
return false;
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, entry);
+ b = nir_builder_create(entry);
b.cursor = nir_before_cf_list(&entry->body);
return nir_shader_instructions_pass(shader, lower_gl_point_gs_instr,
memset(state.varyings, 0, sizeof(state.varyings));
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, entry);
+ b = nir_builder_create(entry);
b.cursor = nir_before_cf_list(&entry->body);
state.primitive_vert_count =
state.line_rectangular = line_rectangular;
// initialize pos_counter and stipple_counter
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, entry);
+ b = nir_builder_create(entry);
b.cursor = nir_before_cf_list(&entry->body);
nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1);
nir_store_var(&b, state.stipple_counter, nir_imm_float(&b, 0), 1);
{
nir_builder b;
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, entry);
+ b = nir_builder_create(entry);
// create stipple counter
nir_variable *stipple = nir_variable_create(shader, nir_var_shader_in,
// initialize pos_counter
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, entry);
+ b = nir_builder_create(entry);
b.cursor = nir_before_cf_list(&entry->body);
nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1);
// initialize stipple_pattern
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- nir_builder_init(&b, entry);
+ b = nir_builder_create(entry);
b.cursor = nir_before_cf_list(&entry->body);
nir_ssa_def *pattern = nir_load_push_constant(&b, 1, 32,
nir_imm_int(&b, ZINK_GFX_PUSHCONST_LINE_STIPPLE_PATTERN),
} else {
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(vs);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
assert(impl->end_block->predecessors->entries == 1);
b.cursor = nir_after_cf_list(&impl->body);
clamp_layer_output_emit(&b, &state);
if (shader->info.stage != MESA_SHADER_FRAGMENT)
return;
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) {
nir_builder b;
nir_function_impl *entrypoint = nir_shader_get_entrypoint(nir);
- nir_builder_init(&b, entrypoint);
+ b = nir_builder_create(entrypoint);
b.cursor = nir_before_block(nir_start_block(entrypoint));
nir_ssa_def *dw_off = nir_imm_int(&b, 0);
static void
lower_cs_intrinsics_convert_impl(struct lower_intrinsics_state *state)
{
- nir_builder_init(&state->builder, state->impl);
+ state->builder = nir_builder_create(state->impl);
nir_foreach_block(block, state->impl) {
lower_cs_intrinsics_convert_block(state, block);
lower_ray_query_impl(nir_function_impl *impl, struct lowering_state *state)
{
nir_builder _b, *b = &_b;
- nir_builder_init(&_b, impl);
+ _b = nir_builder_create(impl);
b->cursor = nir_before_block(nir_start_block(b->impl));
NIR_PASS_V(nir, brw_nir_lower_rt_intrinsics, devinfo);
- nir_builder_init(&b, nir_shader_get_entrypoint(b.shader));
+ b = nir_builder_create(nir_shader_get_entrypoint(b.shader));
/* brw_nir_lower_rt_intrinsics will leave us with a btd_global_arg_addr
* intrinsic which doesn't exist in compute shaders. We also created one
* above when we generated the BTD spawn intrinsic. Now we go through and
.view_mask = view_mask,
};
- nir_builder_init(&state.builder, entrypoint);
+ state.builder = nir_builder_create(entrypoint);
nir_foreach_block(block, entrypoint) {
nir_foreach_instr_safe(instr, block) {
if (state.primitive_count == NULL) {
nir_builder b;
nir_function_impl *entrypoint = nir_shader_get_entrypoint(nir);
- nir_builder_init(&b, entrypoint);
+ b = nir_builder_create(entrypoint);
b.cursor = nir_before_block(nir_start_block(entrypoint));
nir_ssa_def *zero = nir_imm_int(&b, 0);
state.primitive_count = anv_nir_prim_count_store(&b, zero);
.view_mask = view_mask,
};
- nir_builder_init(&state.builder, entrypoint);
+ state.builder = nir_builder_create(entrypoint);
nir_foreach_block(block, entrypoint) {
nir_foreach_instr_safe(instr, block) {
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
bool found = false;
nir_foreach_block_safe(block, impl) {
nir_foreach_instr_safe(instr, block) {
return false;
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder_init(&b, impl);
+ b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
if (clip_dist0)
zero_array_members(&b, clip_dist0);