struct lower_io_state {
nir_builder builder;
- void *mem_ctx;
int (*type_size)(const struct glsl_type *type);
nir_variable_mode modes;
nir_lower_io_options options;
unreachable("Unknown variable mode");
}
- nir_intrinsic_instr *load = nir_intrinsic_instr_create(state->mem_ctx, op);
+ nir_intrinsic_instr *load =
+ nir_intrinsic_instr_create(state->builder.shader, op);
load->num_components = intrin->num_components;
nir_intrinsic_set_base(load, var->data.driver_location);
nir_intrinsic_store_output;
}
- nir_intrinsic_instr *store = nir_intrinsic_instr_create(state->mem_ctx, op);
+ nir_intrinsic_instr *store =
+ nir_intrinsic_instr_create(state->builder.shader, op);
store->num_components = intrin->num_components;
nir_src_copy(&store->src[0], &intrin->src[0], store);
}
nir_intrinsic_instr *atomic =
- nir_intrinsic_instr_create(state->mem_ctx, op);
+ nir_intrinsic_instr_create(state->builder.shader, op);
nir_intrinsic_set_base(atomic, var->data.driver_location);
}
nir_intrinsic_instr *bary_setup =
- nir_intrinsic_instr_create(state->mem_ctx, bary_op);
+ nir_intrinsic_instr_create(state->builder.shader, bary_op);
nir_ssa_dest_init(&bary_setup->instr, &bary_setup->dest, 2, 32, NULL);
nir_intrinsic_set_interp_mode(bary_setup, var->data.interpolation);
nir_builder_instr_insert(&state->builder, &bary_setup->instr);
nir_intrinsic_instr *load =
- nir_intrinsic_instr_create(state->mem_ctx,
+ nir_intrinsic_instr_create(state->builder.shader,
nir_intrinsic_load_interpolated_input);
load->num_components = intrin->num_components;
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&replacement->dest.ssa));
} else {
- nir_dest_copy(&replacement->dest, &intrin->dest, state->mem_ctx);
+ nir_dest_copy(&replacement->dest, &intrin->dest, &intrin->instr);
}
}
struct lower_io_state state;
nir_builder_init(&state.builder, impl);
- state.mem_ctx = ralloc_parent(impl);
state.modes = modes;
state.type_size = type_size;
state.options = options;