treewide: Use nir_builder_create more

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>
This commit is contained in:
Alyssa Rosenzweig
2023-06-26 10:42:47 -04:00
committed by Marge Bot
parent 815efcdf7e
commit 173b9ee69a
34 changed files with 46 additions and 46 deletions

View File

@@ -523,7 +523,7 @@ ac_nir_lower_tex(nir_shader *nir, const ac_nir_lower_tex_options *options)
nir_function_impl *impl = nir_shader_get_entrypoint(nir); nir_function_impl *impl = nir_shader_get_entrypoint(nir);
struct move_tex_coords_state state; struct move_tex_coords_state state;
nir_builder_init(&state.toplevel_b, impl); state.toplevel_b = nir_builder_create(impl);
state.options = options; state.options = options;
state.num_wqm_vgprs = 0; state.num_wqm_vgprs = 0;

View File

@@ -518,7 +518,7 @@ radv_nir_apply_pipeline_layout(nir_shader *shader, struct radv_device *device,
if (!function->impl) if (!function->impl)
continue; continue;
nir_builder_init(&b, function->impl); b = nir_builder_create(function->impl);
/* Iterate in reverse so load_ubo lowering can look at /* Iterate in reverse so load_ubo lowering can look at
* the vulkan_resource_index to tell if it's an inline * the vulkan_resource_index to tell if it's an inline

View File

@@ -274,7 +274,7 @@ radv_nir_lower_fs_barycentric(nir_shader *shader, const struct radv_pipeline_key
if (!function->impl) if (!function->impl)
continue; continue;
nir_builder_init(&b, function->impl); b = nir_builder_create(function->impl);
nir_foreach_block (block, impl) { nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) { nir_foreach_instr_safe (instr, block) {

View File

@@ -1534,7 +1534,7 @@ radv_nir_lower_rt_abi(nir_shader *shader, const VkRayTracingPipelineCreateInfoKH
{ {
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(shader); 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); struct rt_variables vars = create_rt_variables(shader, pCreateInfo->flags);
lower_rt_instructions(shader, &vars, 0); lower_rt_instructions(shader, &vars, 0);

View File

@@ -167,7 +167,7 @@ insert_sample_mask_write(nir_shader *s)
{ {
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(s); 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)); b.cursor = nir_before_block(nir_start_block(impl));
/* Kill samples that are NOT covered by the mask */ /* Kill samples that are NOT covered by the mask */

View File

@@ -1010,7 +1010,7 @@ gl_nir_lower_packed_varyings(const struct gl_constants *consts,
assert(f->impl == impl); assert(f->impl == impl);
} }
nir_builder_init(&state.b, impl); state.b = nir_builder_create(impl);
state.consts = consts; state.consts = consts;
state.prog = prog; state.prog = prog;
state.mem_ctx = mem_ctx; state.mem_ctx = mem_ctx;

View File

@@ -805,7 +805,7 @@ nir_visitor::visit(ir_function_signature *ir)
this->is_global = false; this->is_global = false;
nir_builder_init(&b, impl); b = nir_builder_create(impl);
b.cursor = nir_after_cf_list(&impl->body); b.cursor = nir_after_cf_list(&impl->body);
unsigned i = (ir->return_type != glsl_type::void_type) ? 1 : 0; unsigned i = (ir->return_type != glsl_type::void_type) ? 1 : 0;

View File

@@ -833,7 +833,7 @@ bool
nir_rematerialize_derefs_in_use_blocks_impl(nir_function_impl *impl) nir_rematerialize_derefs_in_use_blocks_impl(nir_function_impl *impl)
{ {
struct rematerialize_deref_state state = { 0 }; struct rematerialize_deref_state state = { 0 };
nir_builder_init(&state.builder, impl); state.builder = nir_builder_create(impl);
nir_foreach_block_unstructured(block, impl) { nir_foreach_block_unstructured(block, impl) {
state.block = block; state.block = block;

View File

@@ -856,7 +856,7 @@ nir_convert_from_ssa_impl(nir_function_impl *impl, bool phi_webs_only)
struct from_ssa_state state; struct from_ssa_state state;
nir_builder_init(&state.builder, impl); state.builder = nir_builder_create(impl);
state.dead_ctx = ralloc_context(NULL); state.dead_ctx = ralloc_context(NULL);
state.phi_webs_only = phi_webs_only; state.phi_webs_only = phi_webs_only;
state.merge_node_table = _mesa_pointer_hash_table_create(NULL); state.merge_node_table = _mesa_pointer_hash_table_create(NULL);

View File

@@ -328,7 +328,7 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables, bool use_vars,
if (!ucp_enables) if (!ucp_enables)
return false; return false;
nir_builder_init(&b, impl); b = nir_builder_create(impl);
/* NIR should ensure that, even in case of loops/if-else, there /* NIR should ensure that, even in case of loops/if-else, there
* should be only a single predecessor block to end_block, which * should be only a single predecessor block to end_block, which
@@ -409,7 +409,7 @@ nir_lower_clip_gs(nir_shader *shader, unsigned ucp_enables,
create_clipdist_vars(shader, out, ucp_enables, true, create_clipdist_vars(shader, out, ucp_enables, true,
use_clipdist_array); use_clipdist_array);
nir_builder_init(&b, impl); b = nir_builder_create(impl);
nir_foreach_block(block, impl) nir_foreach_block(block, impl)
lower_clip_in_gs_block(&b, block, position, clipvertex, out, lower_clip_in_gs_block(&b, block, position, clipvertex, out,

View File

@@ -718,7 +718,7 @@ nir_lower_io_impl(nir_function_impl *impl,
struct lower_io_state state; struct lower_io_state state;
bool progress = false; bool progress = false;
nir_builder_init(&state.builder, impl); state.builder = nir_builder_create(impl);
state.dead_ctx = ralloc_context(NULL); state.dead_ctx = ralloc_context(NULL);
state.modes = modes; state.modes = modes;
state.type_size = type_size; state.type_size = type_size;

View File

@@ -298,7 +298,7 @@ nir_lower_locals_to_regs_impl(nir_function_impl *impl, uint8_t bool_bitsize)
{ {
struct locals_to_regs_state state; struct locals_to_regs_state state;
nir_builder_init(&state.builder, impl); state.builder = nir_builder_create(impl);
state.progress = false; state.progress = false;
state.regs_table = _mesa_hash_table_create(NULL, hash_deref, derefs_equal); state.regs_table = _mesa_hash_table_create(NULL, hash_deref, derefs_equal);
state.bool_bitsize = bool_bitsize; state.bool_bitsize = bool_bitsize;

View File

@@ -32,7 +32,7 @@ lower_impl(nir_function_impl *impl)
nir_variable *in, *out; nir_variable *in, *out;
nir_ssa_def *def; nir_ssa_def *def;
nir_builder_init(&b, impl); b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body); b.cursor = nir_before_cf_list(&impl->body);
/* The edge flag is the last input in st/mesa. This code is also called by /* The edge flag is the last input in st/mesa. This code is also called by

View File

@@ -116,7 +116,7 @@ nir_lower_pntc_ytransform(nir_shader *shader,
nir_foreach_function(function, shader) { nir_foreach_function(function, shader) {
if (function->impl) { if (function->impl) {
nir_builder_init(&state.b, function->impl); state.b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) { nir_foreach_block(block, function->impl) {
lower_pntc_ytransform_block(&state, block); lower_pntc_ytransform_block(&state, block);

View File

@@ -40,7 +40,7 @@ lower_impl(nir_function_impl *impl,
nir_builder b; nir_builder b;
nir_variable *in, *new_out = NULL; 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(), in = nir_state_variable_create(shader, glsl_vec4_type(),
"gl_PointSizeClampedMESA", "gl_PointSizeClampedMESA",

View File

@@ -280,7 +280,7 @@ nir_lower_returns_impl(nir_function_impl *impl)
state.return_flag = NULL; state.return_flag = NULL;
state.has_predicated_return = false; state.has_predicated_return = false;
state.removed_unreachable_code = 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); bool progress = lower_returns_in_cf_list(&impl->body, &state);
progress = progress || state.removed_unreachable_code; progress = progress || state.removed_unreachable_code;

View File

@@ -560,8 +560,8 @@ spill_ssa_defs_and_lower_shader_calls(nir_shader *shader, uint32_t num_calls,
} }
nir_builder before, after; nir_builder before, after;
nir_builder_init(&before, impl); before = nir_builder_create(impl);
nir_builder_init(&after, impl); after = nir_builder_create(impl);
call_idx = 0; call_idx = 0;
unsigned max_scratch_size = shader->scratch_size; unsigned max_scratch_size = shader->scratch_size;

View File

@@ -400,7 +400,7 @@ static bool
combine_stores_impl(struct combine_stores_state *state, nir_function_impl *impl) combine_stores_impl(struct combine_stores_state *state, nir_function_impl *impl)
{ {
state->progress = false; state->progress = false;
nir_builder_init(&state->b, impl); state->b = nir_builder_create(impl);
nir_foreach_block(block, impl) nir_foreach_block(block, impl)
combine_stores_block(state, block); combine_stores_block(state, block);

View File

@@ -379,7 +379,7 @@ nir_opt_comparison_pre_impl(nir_function_impl *impl)
nir_builder bld; nir_builder bld;
block_queue_init(&bq); block_queue_init(&bq);
nir_builder_init(&bld, impl); bld = nir_builder_create(impl);
nir_metadata_require(impl, nir_metadata_dominance); nir_metadata_require(impl, nir_metadata_dominance);

View File

@@ -124,7 +124,7 @@ nir_opt_conditional_discard(nir_shader *shader)
nir_foreach_function(function, shader) { nir_foreach_function(function, shader) {
if (function->impl) { if (function->impl) {
nir_builder_init(&builder, function->impl); builder = nir_builder_create(function->impl);
bool impl_progress = false; bool impl_progress = false;
nir_foreach_block_safe(block, function->impl) { nir_foreach_block_safe(block, function->impl) {

View File

@@ -640,7 +640,7 @@ opt_find_array_copies_impl(nir_function_impl *impl)
s.dead_ctx = ralloc_context(NULL); s.dead_ctx = ralloc_context(NULL);
s.var_nodes = _mesa_pointer_hash_table_create(s.dead_ctx); s.var_nodes = _mesa_pointer_hash_table_create(s.dead_ctx);
s.cast_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) { nir_foreach_block(block, impl) {
if (opt_find_array_copies_block(&b, block, &s)) if (opt_find_array_copies_block(&b, block, &s))

View File

@@ -6629,7 +6629,7 @@ vtn_emit_kernel_entry_point_wrapper(struct vtn_builder *b,
nir_function *main_entry_point = nir_function_create(b->shader, func_name); nir_function *main_entry_point = nir_function_create(b->shader, func_name);
nir_function_impl *impl = nir_function_impl_create(main_entry_point); 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->nb.cursor = nir_after_cf_list(&impl->body);
b->func_param_idx = 0; b->func_param_idx = 0;

View File

@@ -225,7 +225,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
* directly in our OpFunctionParameter handler. * directly in our OpFunctionParameter handler.
*/ */
nir_function_impl *impl = nir_function_impl_create(func); 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.cursor = nir_before_cf_list(&impl->body);
b->nb.exact = b->exact; b->nb.exact = b->exact;
@@ -627,7 +627,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func,
} }
nir_function_impl *impl = func->nir_func->impl; nir_function_impl *impl = func->nir_func->impl;
nir_builder_init(&b->nb, impl); b->nb = nir_builder_create(impl);
b->func = func; b->func = func;
b->nb.cursor = nir_after_cf_list(&impl->body); b->nb.cursor = nir_after_cf_list(&impl->body);
b->nb.exact = b->exact; b->nb.exact = b->exact;

View File

@@ -600,7 +600,7 @@ d3d12_add_missing_dual_src_target(struct nir_shader *s,
assert(missing_mask != 0); assert(missing_mask != 0);
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(s); 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); b.cursor = nir_before_cf_list(&impl->body);
nir_ssa_def *zero = nir_imm_zero(&b, 4, 32); nir_ssa_def *zero = nir_imm_zero(&b, 4, 32);
@@ -629,7 +629,7 @@ d3d12_lower_primitive_id(nir_shader *shader)
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_ssa_def *primitive_id; 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, nir_variable *primitive_id_var = nir_variable_create(shader, nir_var_shader_out,
glsl_uint_type(), "primitive_id"); glsl_uint_type(), "primitive_id");
@@ -745,7 +745,7 @@ d3d12_lower_triangle_strip(nir_shader *shader)
nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_variable *tmp_vars[VARYING_SLOT_MAX] = {0}; nir_variable *tmp_vars[VARYING_SLOT_MAX] = {0};
nir_variable *out_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; shader->info.gs.vertices_out = (shader->info.gs.vertices_out - 2) * 3;

View File

@@ -398,7 +398,7 @@ lower_gl_point_gs(nir_shader *shader)
return false; return false;
nir_function_impl *entry = nir_shader_get_entrypoint(shader); 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); b.cursor = nir_before_cf_list(&entry->body);
return nir_shader_instructions_pass(shader, lower_gl_point_gs_instr, return nir_shader_instructions_pass(shader, lower_gl_point_gs_instr,
@@ -640,7 +640,7 @@ lower_pv_mode_gs(nir_shader *shader, unsigned prim)
memset(state.varyings, 0, sizeof(state.varyings)); memset(state.varyings, 0, sizeof(state.varyings));
nir_function_impl *entry = nir_shader_get_entrypoint(shader); 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); b.cursor = nir_before_cf_list(&entry->body);
state.primitive_vert_count = state.primitive_vert_count =
@@ -793,7 +793,7 @@ lower_line_stipple_gs(nir_shader *shader, bool line_rectangular)
state.line_rectangular = line_rectangular; state.line_rectangular = line_rectangular;
// initialize pos_counter and stipple_counter // initialize pos_counter and stipple_counter
nir_function_impl *entry = nir_shader_get_entrypoint(shader); 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); 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.pos_counter, nir_imm_int(&b, 0), 1);
nir_store_var(&b, state.stipple_counter, nir_imm_float(&b, 0), 1); nir_store_var(&b, state.stipple_counter, nir_imm_float(&b, 0), 1);
@@ -807,7 +807,7 @@ lower_line_stipple_fs(nir_shader *shader)
{ {
nir_builder b; nir_builder b;
nir_function_impl *entry = nir_shader_get_entrypoint(shader); nir_function_impl *entry = nir_shader_get_entrypoint(shader);
nir_builder_init(&b, entry); b = nir_builder_create(entry);
// create stipple counter // create stipple counter
nir_variable *stipple = nir_variable_create(shader, nir_var_shader_in, nir_variable *stipple = nir_variable_create(shader, nir_var_shader_in,
@@ -1122,7 +1122,7 @@ lower_line_smooth_gs(nir_shader *shader)
// initialize pos_counter // initialize pos_counter
nir_function_impl *entry = nir_shader_get_entrypoint(shader); 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); 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.pos_counter, nir_imm_int(&b, 0), 1);
@@ -1156,7 +1156,7 @@ lower_line_smooth_fs(nir_shader *shader, bool lower_stipple)
// initialize stipple_pattern // initialize stipple_pattern
nir_function_impl *entry = nir_shader_get_entrypoint(shader); 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); b.cursor = nir_before_cf_list(&entry->body);
nir_ssa_def *pattern = nir_load_push_constant(&b, 1, 32, nir_ssa_def *pattern = nir_load_push_constant(&b, 1, 32,
nir_imm_int(&b, ZINK_GFX_PUSHCONST_LINE_STIPPLE_PATTERN), nir_imm_int(&b, ZINK_GFX_PUSHCONST_LINE_STIPPLE_PATTERN),
@@ -2540,7 +2540,7 @@ clamp_layer_output(nir_shader *vs, nir_shader *fs, unsigned *next_location)
} else { } else {
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(vs); 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); assert(impl->end_block->predecessors->entries == 1);
b.cursor = nir_after_cf_list(&impl->body); b.cursor = nir_after_cf_list(&impl->body);
clamp_layer_output_emit(&b, &state); clamp_layer_output_emit(&b, &state);

View File

@@ -61,7 +61,7 @@ void rogue_nir_pfo(nir_shader *shader)
if (shader->info.stage != MESA_SHADER_FRAGMENT) if (shader->info.stage != MESA_SHADER_FRAGMENT)
return; return;
nir_builder_init(&b, impl); b = nir_builder_create(impl);
nir_foreach_block (block, impl) { nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) { nir_foreach_instr_safe (instr, block) {

View File

@@ -639,7 +639,7 @@ brw_nir_initialize_mue(nir_shader *nir,
nir_builder b; nir_builder b;
nir_function_impl *entrypoint = nir_shader_get_entrypoint(nir); 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)); b.cursor = nir_before_block(nir_start_block(entrypoint));
nir_ssa_def *dw_off = nir_imm_int(&b, 0); nir_ssa_def *dw_off = nir_imm_int(&b, 0);

View File

@@ -277,7 +277,7 @@ lower_cs_intrinsics_convert_block(struct lower_intrinsics_state *state,
static void static void
lower_cs_intrinsics_convert_impl(struct lower_intrinsics_state *state) 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) { nir_foreach_block(block, state->impl) {
lower_cs_intrinsics_convert_block(state, block); lower_cs_intrinsics_convert_block(state, block);

View File

@@ -503,7 +503,7 @@ static void
lower_ray_query_impl(nir_function_impl *impl, struct lowering_state *state) lower_ray_query_impl(nir_function_impl *impl, struct lowering_state *state)
{ {
nir_builder _b, *b = &_b; 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)); b->cursor = nir_before_block(nir_start_block(b->impl));

View File

@@ -505,7 +505,7 @@ brw_nir_create_raygen_trampoline(const struct brw_compiler *compiler,
NIR_PASS_V(nir, brw_nir_lower_rt_intrinsics, devinfo); 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 /* 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 * 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 * above when we generated the BTD spawn intrinsic. Now we go through and

View File

@@ -224,7 +224,7 @@ anv_nir_lower_multiview(nir_shader *shader, uint32_t view_mask,
.view_mask = view_mask, .view_mask = view_mask,
}; };
nir_builder_init(&state.builder, entrypoint); state.builder = nir_builder_create(entrypoint);
nir_foreach_block(block, entrypoint) { nir_foreach_block(block, entrypoint) {
nir_foreach_instr_safe(instr, block) { nir_foreach_instr_safe(instr, block) {

View File

@@ -122,7 +122,7 @@ anv_nir_lower_set_vtx_and_prim_count(nir_shader *nir)
if (state.primitive_count == NULL) { if (state.primitive_count == NULL) {
nir_builder b; nir_builder b;
nir_function_impl *entrypoint = nir_shader_get_entrypoint(nir); 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)); b.cursor = nir_before_block(nir_start_block(entrypoint));
nir_ssa_def *zero = nir_imm_int(&b, 0); nir_ssa_def *zero = nir_imm_int(&b, 0);
state.primitive_count = anv_nir_prim_count_store(&b, zero); state.primitive_count = anv_nir_prim_count_store(&b, zero);

View File

@@ -198,7 +198,7 @@ anv_nir_lower_multiview(nir_shader *shader, uint32_t view_mask)
.view_mask = view_mask, .view_mask = view_mask,
}; };
nir_builder_init(&state.builder, entrypoint); state.builder = nir_builder_create(entrypoint);
nir_foreach_block(block, entrypoint) { nir_foreach_block(block, entrypoint) {
nir_foreach_instr_safe(instr, block) { nir_foreach_instr_safe(instr, block) {

View File

@@ -241,7 +241,7 @@ st_nir_add_point_size(nir_shader *nir)
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(nir); nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_builder_init(&b, impl); b = nir_builder_create(impl);
bool found = false; bool found = false;
nir_foreach_block_safe(block, impl) { nir_foreach_block_safe(block, impl) {
nir_foreach_instr_safe(instr, block) { nir_foreach_instr_safe(instr, block) {
@@ -315,7 +315,7 @@ st_nir_zero_initialize_clip_distance(nir_shader *nir)
return false; return false;
nir_builder b; nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(nir); 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)); b.cursor = nir_before_block(nir_start_block(impl));
if (clip_dist0) if (clip_dist0)
zero_array_members(&b, clip_dist0); zero_array_members(&b, clip_dist0);