/* If there's no render targets written, just put the write at the end */
if (!done) {
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder b =
- nir_builder_at(nir_after_block(nir_impl_last_block(impl)));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
insert_z_write(&b);
}
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_cf_list list;
- nir_cf_extract(&list, nir_before_block(nir_start_block(impl)),
- nir_after_block(nir_impl_last_block(impl)));
+ nir_cf_extract(&list, nir_before_impl(impl), nir_after_impl(impl));
/* Create a builder for the wrapped function */
nir_builder b = nir_builder_at(nir_after_block(nir_start_block(impl)));
{
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ b = nir_builder_at(nir_before_impl(impl));
/* Kill samples that are NOT covered by the mask */
nir_discard_agx(&b, nir_inot(&b, nir_load_api_sample_mask_agx(&b)));
/* Flush at end */
if (ctx.any_memory_stores) {
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
- nir_builder b =
- nir_builder_at(nir_after_block(nir_impl_last_block(impl)));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
nir_fence_pbe_to_tex_pixel_agx(&b);
}
initialise_coverage_var(struct lower_line_smooth_state *state,
nir_function_impl *impl)
{
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *line_width = nir_load_line_width(&b);
return false;
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
if (clip_dist0)
zero_array_members(&b, clip_dist0);
nir_store_var(b, result, nir_vec4(b, val, val, val, val), 0x8);
/* reset cursor to the end of the main function */
- b->cursor = nir_after_block(nir_impl_last_block(b->impl));
+ b->cursor = nir_after_impl(b->impl);
return result;
}
sh->info.fs.uses_sample_shading = true;
- nir_builder b = nir_builder_at(nir_after_block(nir_impl_last_block(impl)));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
nir_variable *fb = nir_variable_create(sh, nir_var_shader_out,
glsl_vec4_type(),
/* Shader inputs need to be lowered at the beginning of main() so set bulder
* cursor to insert packing code at the start of the main function.
*/
- state->b.cursor = nir_before_block(nir_start_block(state->impl));
+ state->b.cursor = nir_before_impl(state->impl);
/* insert new varyings, lower old ones to locals and add unpacking code a
* the start of the shader.
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_deref_instr *deref = NULL;
const struct glsl_type *type = NULL;
/* From this point on, it's structured */
impl->structured = true;
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
void *mem_ctx = ralloc_context(b.shader);
}
}
} else if (impl == state->entrypoint) {
- b.cursor = nir_before_block(nir_start_block(impl));
+ b.cursor = nir_before_impl(impl);
emit_copies(&b, &state->old_outputs, &state->new_outputs);
/* For all other shader types, we need to do the copies right before
emit_input_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
{
if (impl == state->entrypoint) {
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
emit_copies(&b, &state->old_inputs, &state->new_inputs);
if (state->shader->info.stage == MESA_SHADER_FRAGMENT)
fixup_interpolation(state, impl, &b);
* This provides stability for the algorithm and ensures that we don't
* accidentally get dependencies out-of-order.
*/
- nir_cursor cursor = nir_before_block(nir_start_block(impl));
+ nir_cursor cursor = nir_before_impl(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->pass_flags == STOP_PROCESSING_INSTR_FLAG)
struct set *deletes = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
nir_foreach_function_impl(impl, nir) {
bool func_progress = false;
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
/* create a new deref for the arrayed clipdistance variable at the start of the function */
nir_deref_instr *clipdist_deref = nir_build_deref_var(&b, dist0);
nir_def *zero = nir_imm_zero(&b, 1, 32);
/* Extract the current transform feedback shader */
nir_cf_list list;
- nir_cf_extract(&list, nir_before_block(nir_start_block(impl)),
- nir_after_block(nir_impl_last_block(impl)));
+ nir_cf_extract(&list, nir_before_impl(impl), nir_after_impl(impl));
/* Get a builder for the (now empty) shader */
nir_builder b = nir_builder_at(nir_after_block(nir_start_block(impl)));
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *temp_ubo_name = nir_undef(&b, 1, 32);
nir_def *temp_const_ubo_name = NULL;
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *temp_ubo_name = nir_undef(&b, 1, 32);
*/
if (c->fs_key->sample_coverage && !c->fs_key->sample_alpha_to_coverage) {
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder b = nir_builder_at(nir_after_block(nir_impl_last_block(impl)));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
vc4_nir_store_sample_mask(c, &b, nir_load_sample_mask_in(&b));
}
nir_shader_add_variable(nir, var);
store_location_var(vars, var, nir);
/* write zero so it doesn't get pruned */
- nir_builder b = nir_builder_at(nir_after_block(nir_impl_last_block(nir_shader_get_entrypoint(nir))));
+ nir_builder b = nir_builder_at(nir_after_impl(nir_shader_get_entrypoint(nir)));
nir_def *store = nir_imm_intN_t(&b, j == 3 ? 1 : 0, glsl_type_is_64bit(glsl_without_array(var->type)) ? 64 : 32);
if (nir_is_arrayed_io(copy, nir->info.stage)) {
var->type = glsl_array_type(var->type, glsl_array_size(ref->type), glsl_get_explicit_stride(ref->type));
fn->is_entrypoint = true;
nir_function_impl *impl = nir_function_impl_create(fn);
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *invocation_id = nir_load_invocation_id(&b);
nir_builder b;
nir_function_impl *entrypoint = nir_shader_get_entrypoint(nir);
- b = nir_builder_at(nir_before_block(nir_start_block(entrypoint)));
+ b = nir_builder_at(nir_before_impl(entrypoint));
nir_def *dw_off = nir_imm_int(&b, 0);
nir_def *zerovec = nir_imm_vec4(&b, 0, 0, 0, 0);
lower_ray_query_impl(nir_function_impl *impl, struct lowering_state *state)
{
nir_builder _b, *b = &_b;
- _b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ _b = nir_builder_at(nir_before_impl(impl));
state->rq_globals = nir_load_ray_query_global_intel(b);
{
bool progress = false;
- nir_builder build = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder build = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &build;
struct brw_nir_rt_globals_defs globals;
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- b->cursor = nir_before_block(nir_start_block(impl));
+ b->cursor = nir_before_impl(impl);
nir_def *shader_type = nir_load_btd_shader_type_intel(b);
if (state->instance_id == NULL) {
nir_builder *b = &state->builder;
- b->cursor = nir_before_block(nir_start_block(b->impl));
+ b->cursor = nir_before_impl(b->impl);
/* We use instancing for implementing multiview. The actual instance id
* is given by dividing instance_id by the number of views in this
if (state->view_index == NULL) {
nir_builder *b = &state->builder;
- b->cursor = nir_before_block(nir_start_block(b->impl));
+ b->cursor = nir_before_impl(b->impl);
assert(state->view_mask != 0);
if (util_bitcount(state->view_mask) == 1) {
if (state.primitive_count == NULL) {
nir_builder b;
nir_function_impl *entrypoint = nir_shader_get_entrypoint(nir);
- b = nir_builder_at(nir_before_block(nir_start_block(entrypoint)));
+ b = nir_builder_at(nir_before_impl(entrypoint));
nir_def *zero = nir_imm_int(&b, 0);
state.primitive_count = anv_nir_prim_count_store(&b, zero);
}
if (state->instance_id == NULL) {
nir_builder *b = &state->builder;
- b->cursor = nir_before_block(nir_start_block(b->impl));
+ b->cursor = nir_before_impl(b->impl);
/* We use instancing for implementing multiview. The actual instance id
* is given by dividing instance_id by the number of views in this
if (state->view_index == NULL) {
nir_builder *b = &state->builder;
- b->cursor = nir_before_block(nir_start_block(b->impl));
+ b->cursor = nir_before_impl(b->impl);
assert(state->view_mask != 0);
if (util_bitcount(state->view_mask) == 1) {
}
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder b = nir_builder_at(nir_after_block(nir_impl_last_block(impl)));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
/* Note: while ARB_fragment_program plus ARB_draw_buffers allows an array
* of result colors, prog_to_nir generates separate vars per slot so we
struct gl_program_parameter_list *paramList)
{
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *mvp[4];
for (int i = 0; i < 4; i++) {
nir_variable *printf_var = NULL;
nir_def *printf_deref = NULL;
nir_foreach_function_impl(impl, nir) {
- nir_builder b = nir_builder_at(nir_before_block(nir_start_block(impl)));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
bool progress = false;
nir_foreach_block(block, impl) {
if (intr->intrinsic != nir_intrinsic_load_subgroup_id)
return false;
- b->cursor = nir_before_block(nir_start_block(b->impl));
+ b->cursor = nir_before_impl(b->impl);
if (b->shader->info.workgroup_size[1] == 1 &&
b->shader->info.workgroup_size[2] == 1) {
/* When using Nx1x1 groups, use a simple stable algorithm
nir_metadata_loop_analysis, var);
} else {
nir_function_impl *func = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_after_block(nir_impl_last_block(func)));
+ nir_builder b = nir_builder_at(nir_after_impl(func));
add_layer_write(&b, NULL, var);
}
}